Skip to content

Commit

Permalink
Test chart version
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Nov 3, 2023
1 parent 2629ae9 commit c1c25a1
Show file tree
Hide file tree
Showing 17 changed files with 1,145 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
- name: Run checks
run: |
make ci
go test -v ./...
kubernetes:
name: Kubernetes
Expand Down
10 changes: 4 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ endif
### These variables should not need tweaking.
###

SRC_PKGS := apis schema # directories which hold app source (not vendored)
SRC_PKGS := apis schema tests # directories which hold app source (not vendored)
SRC_DIRS := $(SRC_PKGS)

DOCKER_PLATFORMS := linux/amd64 linux/arm linux/arm64
Expand Down Expand Up @@ -134,7 +134,6 @@ openapi: $(addprefix openapi-, $(subst :,_, $(API_GROUPS)))
-w $(DOCKER_REPO_ROOT) \
--env HTTP_PROXY=$(HTTP_PROXY) \
--env HTTPS_PROXY=$(HTTPS_PROXY) \
--env GO111MODULE=on \
--env GOFLAGS="-mod=vendor" \
$(BUILD_IMAGE) \
go run hack/gencrd/main.go
Expand Down Expand Up @@ -384,7 +383,6 @@ lint: $(BUILD_DIRS)
-v $$(pwd)/.go/cache:/.cache \
--env HTTP_PROXY=$(HTTP_PROXY) \
--env HTTPS_PROXY=$(HTTPS_PROXY) \
--env GO111MODULE=on \
--env GOFLAGS="-mod=vendor" \
$(BUILD_IMAGE) \
golangci-lint run --enable $(ADDTL_LINTERS) --timeout=10m --skip-files="generated.*\.go$\" --skip-dirs-use-default --skip-dirs=client,vendor
Expand All @@ -400,8 +398,8 @@ verify: verify-gen verify-modules

.PHONY: verify-modules
verify-modules:
GO111MODULE=on go mod tidy
GO111MODULE=on go mod vendor
go mod tidy
go mod vendor
@if !(git diff --exit-code HEAD); then \
echo "go module files are out of date"; exit 1; \
fi
Expand Down Expand Up @@ -439,7 +437,7 @@ check-license:
ltag -t "./hack/license" --excludes "vendor contrib libbuild" --check -v

.PHONY: ci
ci: verify check-license lint build unit-tests #cover
ci: verify check-license lint build #unit-tests cover

.PHONY: clean
clean:
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ go 1.18

require (
go.openviz.dev/installer v0.0.0-20230802073927-bc7c337886e9
gomodules.xyz/go-sh v0.1.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.25.3
k8s.io/apimachinery v0.25.4
kmodules.xyz/objectstore-api v0.25.1
Expand All @@ -17,6 +19,7 @@ require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.12.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/cli v20.10.22+incompatible // indirect
Expand Down Expand Up @@ -78,7 +81,6 @@ require (
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.25.3 // indirect
k8s.io/client-go v0.25.3 // indirect
k8s.io/klog/v2 v2.80.1 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 h1:sDMmm+q/3+BukdIpxwO365v/Rbspp2Nt5XntgQRXq8Q=
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM=
github.com/containerd/stargz-snapshotter/estargz v0.12.1 h1:+7nYmHJb0tEkcRaAW+MHqoKaJYZmkikupxCqVtmPuY0=
github.com/containerd/stargz-snapshotter/estargz v0.12.1/go.mod h1:12VUuCq3qPq4y8yUW+l5w3+oXV3cx2Po3KSe/SmPGqw=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
Expand Down Expand Up @@ -297,6 +299,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gomodules.xyz/go-sh v0.1.0 h1:1BJAuGREh2RhePt7HRrpmjnkbgfpXlCzc42SiyZ5dkc=
gomodules.xyz/go-sh v0.1.0/go.mod h1:N8IrjNiYppUI/rxENYrWD6FOrSxSyEZnIekPEWM7LP0=
gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw=
gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY=
gomodules.xyz/pointer v0.1.0 h1:sG2UKrYVSo6E3r4itAjXfPfe4fuXMi0KdyTHpR3vGCg=
Expand Down
68 changes: 68 additions & 0 deletions tests/check-charts_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
Copyright AppsCode Inc. and Contributors
Licensed under the AppsCode Community License 1.0.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://github.com/appscode/licenses/raw/1.0.0/AppsCode-Community-1.0.0.md
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package main

import (
"errors"
"os"
"path/filepath"
"runtime"
"testing"

"go.bytebuilders.dev/installer/apis/installer/v1alpha1"

shell "gomodules.xyz/go-sh"
"gopkg.in/yaml.v3"
)

func Test_checkVersions(t *testing.T) {
if err := checkVersions(); err != nil {
t.Errorf("checkVersions() error = %v", err)
}
}

func checkVersions() error {
_, file, _, ok := runtime.Caller(1)
if !ok {
return errors.New("failed to locate opscenter-features/values.yaml")
}

data, err := os.ReadFile(filepath.Join(filepath.Dir(file), "../charts/opscenter-features/values.yaml"))
if err != nil {
return err
}

var spec v1alpha1.OpscenterFeaturesSpec
err = yaml.Unmarshal(data, &spec)
if err != nil {
return err
}

sh := shell.NewSession()
sh.SetDir("/tmp")
sh.ShowCMD = true

for k, v := range spec.Helm.Releases {
// helm pull appscode/ace-installer --version=v2023.03.23
fullname := "oci://ghcr.io/appscode-charts/" + k
err := sh.Command("helm", "pull", fullname, "--version", v.Version).Run()
if err != nil {
return err
}
}
return nil
}
2 changes: 2 additions & 0 deletions vendor/github.com/codegangsta/inject/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions vendor/github.com/codegangsta/inject/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 92 additions & 0 deletions vendor/github.com/codegangsta/inject/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c1c25a1

Please sign in to comment.