From de1da781ff3b1f54164ad5e7b5953aae93ae86f6 Mon Sep 17 00:00:00 2001 From: Marwan Sulaiman Date: Fri, 26 Jun 2020 11:54:23 -0400 Subject: [PATCH] Create helm github action * Trimmed trailing character fixing linting issue * AppVersion not appVersion for "{{ defaults .appVersion }}" in deployment.yaml * Update kind, helm and chart testing versions * apiVersion in Chart.yaml required helm 2.15.1 * kind deprecated kubeconfig-path in 0.7, fixed test-e2e.sh * apps/v1 rather than apps/v1beta2 in deployment.yaml * remove registry reference, add version back in for final fixes Co-authored-by: Chris Mills Co-authored-by: Marwan Sulaiman Co-authored-by: Aaron Schlesinger Co-authored-by: Ted Wexler --- .github/workflows/helm.yaml | 33 ++++++++ charts/athens-proxy/Chart.yaml | 1 + charts/athens-proxy/templates/deployment.yaml | 2 +- .../athens-proxy/templates/jaeger-deploy.yaml | 2 +- charts/athens-proxy/values.yaml | 4 +- cilist | 4 + test/ct.yaml | 1 + test/e2e-kind.sh | 8 +- test/local-path-provisioner.yaml | 82 +++++++++---------- 9 files changed, 89 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/helm.yaml create mode 100644 cilist diff --git a/.github/workflows/helm.yaml b/.github/workflows/helm.yaml new file mode 100644 index 00000000..2a904325 --- /dev/null +++ b/.github/workflows/helm.yaml @@ -0,0 +1,33 @@ +name: helm-charts +on: + pull_request: + types: [opened, reopened, synchronize] + # paths: + # - "charts/*" + # - "test/e2e-kind.sh" +jobs: + shellcheck: + if: github.event_name == 'pull_request' + name: Shellcheck Helm Charts + runs-on: ubuntu-latest + container: koalaman/shellcheck-alpine + steps: + - uses: actions/checkout@v2 + - run: shellcheck -x test/e2e-kind.sh + charts-e2e: + name: Run E2E Tests on the Helm Chart + needs: [shellcheck] + runs-on: ubuntu-latest + env: + CHART_TESTING_IMAGE: quay.io/helmpack/chart-testing + CHART_TESTING_TAG: v2.4.1 + K8S_VERSION: v1.18.0 + KIND_VERSION: v0.8.1 + steps: + - uses: actions/checkout@v2 + - run: git fetch --prune --unshallow + - run: test/e2e-kind.sh + # publish: + # runs-on: ubuntu-latest + # if: github.event_name == 'push' + # container: alpine/helm diff --git a/charts/athens-proxy/Chart.yaml b/charts/athens-proxy/Chart.yaml index 48d54593..1d819358 100644 --- a/charts/athens-proxy/Chart.yaml +++ b/charts/athens-proxy/Chart.yaml @@ -1,3 +1,4 @@ +apiVersion: v1 name: athens-proxy version: 0.4.12 appVersion: 0.9.0 diff --git a/charts/athens-proxy/templates/deployment.yaml b/charts/athens-proxy/templates/deployment.yaml index f77f4d08..f6f48c18 100644 --- a/charts/athens-proxy/templates/deployment.yaml +++ b/charts/athens-proxy/templates/deployment.yaml @@ -53,7 +53,7 @@ spec: {{- end }} containers: - name: {{ template "fullname" . }} - image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy | quote }} livenessProbe: failureThreshold: {{ .Values.livenessProbe.failureThreshold }} diff --git a/charts/athens-proxy/templates/jaeger-deploy.yaml b/charts/athens-proxy/templates/jaeger-deploy.yaml index d5057abb..75083cc3 100644 --- a/charts/athens-proxy/templates/jaeger-deploy.yaml +++ b/charts/athens-proxy/templates/jaeger-deploy.yaml @@ -1,5 +1,5 @@ {{- if .Values.jaeger.enabled -}} -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: {{ template "fullname" . }}-jaeger diff --git a/charts/athens-proxy/values.yaml b/charts/athens-proxy/values.yaml index 98448b4d..804bbe69 100644 --- a/charts/athens-proxy/values.yaml +++ b/charts/athens-proxy/values.yaml @@ -1,7 +1,9 @@ replicaCount: 1 image: - registry: docker.io + # registry: docker.io repository: gomods/athens + # this defaults to the Chart.yaml's appVersion. + # You can override this when you helm install tag: v0.9.0 ## Specify a imagePullPolicy diff --git a/cilist b/cilist new file mode 100644 index 00000000..58fa2861 --- /dev/null +++ b/cilist @@ -0,0 +1,4 @@ +1. Helm (CircleCI) + https://github.com/helm/chart-testing-action Testing action we could use +2. Windows tests (AppVeyor) +3. Build/Test/DockerPush (DroneCI) diff --git a/test/ct.yaml b/test/ct.yaml index 75576f8f..f081c88d 100644 --- a/test/ct.yaml +++ b/test/ct.yaml @@ -2,3 +2,4 @@ target-branch: main chart-dirs: - charts helm-extra-args: --timeout 800 +check-version-increment: false diff --git a/test/e2e-kind.sh b/test/e2e-kind.sh index 99fc3e0f..cd6078cd 100755 --- a/test/e2e-kind.sh +++ b/test/e2e-kind.sh @@ -57,9 +57,9 @@ create_kind_cluster() { docker_exec mkdir -p /root/.kube echo 'Copying kubeconfig to container...' - local kubeconfig - kubeconfig="$(kind get kubeconfig-path --name "$CLUSTER_NAME")" - docker cp "$kubeconfig" ct:/root/.kube/config + # local kubeconfig + kind get kubeconfig --name "$CLUSTER_NAME" > kube-config.yaml + docker cp kube-config.yaml ct:/root/.kube/config docker_exec kubectl cluster-info echo @@ -115,4 +115,4 @@ main() { lint_charts } -main +main \ No newline at end of file diff --git a/test/local-path-provisioner.yaml b/test/local-path-provisioner.yaml index 5dc0ed59..cba63d4c 100644 --- a/test/local-path-provisioner.yaml +++ b/test/local-path-provisioner.yaml @@ -15,18 +15,18 @@ metadata: name: local-path-provisioner-role namespace: local-path-storage rules: -- apiGroups: [""] - resources: ["nodes", "persistentvolumeclaims"] - verbs: ["get", "list", "watch"] -- apiGroups: [""] - resources: ["endpoints", "persistentvolumes", "pods"] - verbs: ["*"] -- apiGroups: [""] - resources: ["events"] - verbs: ["create", "patch"] -- apiGroups: ["storage.k8s.io"] - resources: ["storageclasses"] - verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["nodes", "persistentvolumeclaims"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["endpoints", "persistentvolumes", "pods"] + verbs: ["*"] + - apiGroups: [""] + resources: ["events"] + verbs: ["create", "patch"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding @@ -38,11 +38,11 @@ roleRef: kind: ClusterRole name: local-path-provisioner-role subjects: -- kind: ServiceAccount - name: local-path-provisioner-service-account - namespace: local-path-storage + - kind: ServiceAccount + name: local-path-provisioner-service-account + namespace: local-path-storage --- -apiVersion: apps/v1beta2 +apiVersion: apps/v1 kind: Deployment metadata: name: local-path-provisioner @@ -59,23 +59,23 @@ spec: spec: serviceAccountName: local-path-provisioner-service-account containers: - - name: local-path-provisioner - image: rancher/local-path-provisioner:v0.0.8 - imagePullPolicy: Always - command: - - local-path-provisioner - - --debug - - start - - --config - - /etc/config/config.json - volumeMounts: - - name: config-volume - mountPath: /etc/config/ - env: - - name: POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace + - name: local-path-provisioner + image: rancher/local-path-provisioner:v0.0.8 + imagePullPolicy: Always + command: + - local-path-provisioner + - --debug + - start + - --config + - /etc/config/config.json + volumeMounts: + - name: config-volume + mountPath: /etc/config/ + env: + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace volumes: - name: config-volume configMap: @@ -98,11 +98,11 @@ metadata: namespace: local-path-storage data: config.json: |- - { - "nodePathMap":[ - { - "node":"DEFAULT_PATH_FOR_NON_LISTED_NODES", - "paths":["/opt/local-path-provisioner"] - } - ] - } + { + "nodePathMap":[ + { + "node":"DEFAULT_PATH_FOR_NON_LISTED_NODES", + "paths":["/opt/local-path-provisioner"] + } + ] + }