From 17161eda0f472ab832367ea6462f0a5d87b08e18 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Thu, 25 Apr 2024 12:04:15 +0900 Subject: [PATCH 01/34] test trigger From 9e05e02b877d44351054e47be55352665231c481 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Thu, 25 Apr 2024 12:21:49 +0900 Subject: [PATCH 02/34] minimal value change --- stack/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack/values.yaml b/stack/values.yaml index 8766957..4a9d994 100644 --- a/stack/values.yaml +++ b/stack/values.yaml @@ -120,7 +120,7 @@ global: autoscaling: enabled: true minReplicas: 1 - maxReplicas: 10 + maxReplicas: 11 targetCPUUtilizationPercentage: 80 targetMemoryUtilizationPercentage: 80 From e988f0bc93e2d1593cb17d041579b7256f4bce8d Mon Sep 17 00:00:00 2001 From: David Tsai Date: Thu, 25 Apr 2024 12:38:59 +0900 Subject: [PATCH 03/34] revert value change --- stack/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack/values.yaml b/stack/values.yaml index 4a9d994..8766957 100644 --- a/stack/values.yaml +++ b/stack/values.yaml @@ -120,7 +120,7 @@ global: autoscaling: enabled: true minReplicas: 1 - maxReplicas: 11 + maxReplicas: 10 targetCPUUtilizationPercentage: 80 targetMemoryUtilizationPercentage: 80 From 9b0783126edb2834e1fefa82852f5223ee255541 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Thu, 25 Apr 2024 12:40:38 +0900 Subject: [PATCH 04/34] specify root as ct chart directory --- .github/workflows/chart-testing.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index eaeba0c..60f560b 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -27,7 +27,7 @@ jobs: - name: Run chart-testing (list-changed) id: list-changed run: | - changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) + changed=$(ct list-changed --chart-dirs . --target-branch ${{ github.event.repository.default_branch }}) if [[ -n "$changed" ]]; then echo "changed=true" >> "$GITHUB_OUTPUT" fi From c376902973544ffa10947ee37b26ea58c7e115cc Mon Sep 17 00:00:00 2001 From: David Tsai Date: Mon, 22 Jul 2024 10:14:46 -0700 Subject: [PATCH 05/34] add gha jobs with test fixtures for validating template outputs --- .github/workflows/chart-testing.yaml | 22 ++++ test-fixtures/values.yaml | 182 +++++++++++++++++++++++++++ test-fixtures/values1.yaml | 1 + test-fixtures/values2.yaml | 168 +++++++++++++++++++++++++ 4 files changed, 373 insertions(+) create mode 100644 test-fixtures/values.yaml create mode 100644 test-fixtures/values1.yaml create mode 100644 test-fixtures/values2.yaml diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index 60f560b..0b4aa80 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -3,6 +3,7 @@ name: Lint and Test Charts on: pull_request jobs: + lint-test: runs-on: ubuntu-latest steps: @@ -16,6 +17,27 @@ jobs: with: version: v3.14.0 + - name: Set up kubectl + uses: azure/setup-kubectl@v3 + + - name: Validate chart template with default values + run: | + output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1) + if [[ $output -ne "error: no objects passed to apply" ]]; then + exit 1 + fi + + - name: Validate chart template with invalid values + run: | + output=$(helm template ./stack --values ./test-fixtures/values1.yaml | kubectl apply -f - --dry-run=client 2>&1) + if [[ $output -ne "Error: failed to parse ./test-fixtures/values1.yaml: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type map[string]interface {}" ]]; then + exit 1 + fi + + - name: Validate chart template with valid values + run: | + helm template ./stack --values ./test-fixtures/values2.yaml | kubectl apply -f - --dry-run=client 2>&1 + - uses: actions/setup-python@v4 with: python-version: '3.12' diff --git a/test-fixtures/values.yaml b/test-fixtures/values.yaml new file mode 100644 index 0000000..8766957 --- /dev/null +++ b/test-fixtures/values.yaml @@ -0,0 +1,182 @@ +# Service defaults +global: + replicaCount: 1 + + # Settings for the primary container + image: + repository: nginx + pullPolicy: IfNotPresent + tag: "latest" + + args: [] + command: [] + + imagePullSecrets: [] + nameOverride: "" + fullnameOverride: "" + + dnsPolicy: ClusterFirst + restartPolicy: Always + + # Probes for the primary container + livenessProbe: + failureThreshold: 3 + httpGet: + path: / + port: http + scheme: HTTP + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + initialDelaySeconds: 30 + readinessProbe: + failureThreshold: 3 + httpGet: + path: / + port: http + scheme: HTTP + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + initialDelaySeconds: 30 + startupProbe: + enabled: false + failureThreshold: 3 + successThreshold: 1 + initialDelaySeconds: 0 + timeoutSeconds: 1 + periodSeconds: 10 + exec: + command: + - ps + - '-ef' + + resources: + limits: + cpu: '1' + memory: '1Gi' + requests: + cpu: '100m' + memory: '128Mi' + + service: + type: ClusterIP + port: 80 + + initContainers: [] + sidecars: [] + + appConfig: + envContextConfigMapName: "" # App environment level configuration configmap name + stackContextConfigMapName: "" # Stack level configuration configmap name + envSecretName: "" # App environment level configuration secret name + stackSecretName: "" # Stack level configuration secret name + + # Global annotations to add to all resources + annotations: {} + # Annotations to add to pods + podAnnotations: {} + # Labels to add to pods + podLabels: {} + + serviceAccount: + # Specifies whether a service account should be created + create: false + # Automatically mount a ServiceAccount's API credentials? + automount: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + + podSecurityContext: {} + # fsGroup: 2000 + + securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + + ingress: + enabled: true + className: "" + host: chart-example.local + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + + autoscaling: + enabled: true + minReplicas: 1 + maxReplicas: 10 + targetCPUUtilizationPercentage: 80 + targetMemoryUtilizationPercentage: 80 + + # Additional volumes on the output Deployment definition. + volumes: [] + # - name: foo + # secret: + # secretName: mysecret + # optional: false + + # Additional volumeMounts on the output Deployment definition. + volumeMounts: [] + # - name: foo + # mountPath: "/etc/foo" + # readOnly: true + + nodeSelector: + kubernetes.io/arch: arm64 + + tolerations: [] + + affinity: {} + + topologySpreadConstraints: [] + +# Service overrides +services: {} + # service1: + # args: ["arg1", "arg2"] + # command: ["command1", "command2"] + # autoscaling: + # enabled: true + # minReplicas: 2 + # maxReplicas: 10 + # maxUnavailable: 1 + # replicaCount: 2 + # sidecars: + # - name: sidecar1 + # image: "sidecar1:latest" + # - name: sidecar2 + # image: "sidecar2:latest" + # initContainers: + # - name: initContainer1 + # image: "alpine:latest" + # command: ["echo", "Hello World"] + # service2: + # startupProbe: + # enabled: true + # autoscaling: + # enabled: true + # minReplicas: 2 + # maxReplicas: 10 + # maxUnavailable: 1 + # replicaCount: 2 + # sidecars: + # - name: sidecar3 + # image: sidecar3:latest + # - name: sidecar4 + # image: sidecar4:latest diff --git a/test-fixtures/values1.yaml b/test-fixtures/values1.yaml new file mode 100644 index 0000000..6f4f765 --- /dev/null +++ b/test-fixtures/values1.yaml @@ -0,0 +1 @@ +$ \ No newline at end of file diff --git a/test-fixtures/values2.yaml b/test-fixtures/values2.yaml new file mode 100644 index 0000000..5e14e39 --- /dev/null +++ b/test-fixtures/values2.yaml @@ -0,0 +1,168 @@ +# Service defaults +global: + replicaCount: 1 + + # Settings for the primary container + image: + repository: nginx + pullPolicy: IfNotPresent + tag: "latest" + + args: [] + command: [] + + imagePullSecrets: [] + nameOverride: "" + fullnameOverride: "" + + dnsPolicy: ClusterFirst + restartPolicy: Always + + # Probes for the primary container + livenessProbe: + failureThreshold: 3 + httpGet: + path: / + port: http + scheme: HTTP + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + initialDelaySeconds: 30 + readinessProbe: + failureThreshold: 3 + httpGet: + path: / + port: http + scheme: HTTP + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + initialDelaySeconds: 30 + startupProbe: + enabled: false + failureThreshold: 3 + successThreshold: 1 + initialDelaySeconds: 0 + timeoutSeconds: 1 + periodSeconds: 10 + exec: + command: + - ps + - '-ef' + + resources: + limits: + cpu: '1' + memory: '1Gi' + requests: + cpu: '100m' + memory: '128Mi' + + service: + type: ClusterIP + port: 80 + + initContainers: [] + sidecars: [] + + appConfig: + envContextConfigMapName: "" # App environment level configuration configmap name + stackContextConfigMapName: "" # Stack level configuration configmap name + envSecretName: "" # App environment level configuration secret name + stackSecretName: "" # Stack level configuration secret name + + # Global annotations to add to all resources + annotations: {} + # Annotations to add to pods + podAnnotations: {} + # Labels to add to pods + podLabels: {} + + serviceAccount: + # Specifies whether a service account should be created + create: false + # Automatically mount a ServiceAccount's API credentials? + automount: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + + podSecurityContext: {} + # fsGroup: 2000 + + securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + + ingress: + enabled: true + className: "" + host: chart-example.local + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + + autoscaling: + enabled: true + minReplicas: 1 + maxReplicas: 10 + targetCPUUtilizationPercentage: 80 + targetMemoryUtilizationPercentage: 80 + + # Additional volumes on the output Deployment definition. + volumes: [] + # - name: foo + # secret: + # secretName: mysecret + # optional: false + + # Additional volumeMounts on the output Deployment definition. + volumeMounts: [] + # - name: foo + # mountPath: "/etc/foo" + # readOnly: true + + nodeSelector: + kubernetes.io/arch: arm64 + + tolerations: [] + + affinity: {} + + topologySpreadConstraints: [] + +# Service overrides +services: + service1: + args: ["arg1", "arg2"] + command: ["command1", "command2"] + autoscaling: + enabled: true + minReplicas: 2 + maxReplicas: 10 + maxUnavailable: 1 + replicaCount: 2 + sidecars: + - name: sidecar1 + image: "sidecar1:latest" + - name: sidecar2 + image: "sidecar2:latest" + initContainers: + - name: initContainer1 + image: "alpine:latest" + command: ["echo", "Hello World"] \ No newline at end of file From a622ba63dc3eb3ae038ae102d566f3dda63256ab Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 03:05:02 -0700 Subject: [PATCH 06/34] update dependency --- .github/workflows/chart-testing.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index 0b4aa80..ac3f9cc 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -22,6 +22,7 @@ jobs: - name: Validate chart template with default values run: | + helm dependency update ./stack output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1) if [[ $output -ne "error: no objects passed to apply" ]]; then exit 1 From 6618e13826fb69e35de80d8fea0aef6b84d76d45 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 03:10:57 -0700 Subject: [PATCH 07/34] build dep --- .github/workflows/chart-testing.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index ac3f9cc..5d5e115 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -22,7 +22,7 @@ jobs: - name: Validate chart template with default values run: | - helm dependency update ./stack + helm dependency build ./stack output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1) if [[ $output -ne "error: no objects passed to apply" ]]; then exit 1 From 4100d4b1029c1ba5eb91ff1bb3df34ca159f4969 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 03:11:58 -0700 Subject: [PATCH 08/34] update and build --- .github/workflows/chart-testing.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index 5d5e115..277fcaf 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -22,6 +22,8 @@ jobs: - name: Validate chart template with default values run: | + helm repo add argo-helm-charts https://chanzuckerberg.github.io/argo-helm-charts/ + helm dep update ./stack helm dependency build ./stack output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1) if [[ $output -ne "error: no objects passed to apply" ]]; then From 56a8e71bba6135348522f80b1a0d57fe064597fd Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 03:40:49 -0700 Subject: [PATCH 09/34] disable oidc proxy in default test fixture --- test-fixtures/values.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test-fixtures/values.yaml b/test-fixtures/values.yaml index 8766957..8fe13e1 100644 --- a/test-fixtures/values.yaml +++ b/test-fixtures/values.yaml @@ -145,6 +145,8 @@ global: affinity: {} topologySpreadConstraints: [] + oidcProxy: + enabled: false # Service overrides services: {} @@ -179,4 +181,4 @@ services: {} # - name: sidecar3 # image: sidecar3:latest # - name: sidecar4 - # image: sidecar4:latest + # image: sidecar4:latest \ No newline at end of file From b294fd9929514d46fbc11aba370364e515fbd3d8 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 03:42:30 -0700 Subject: [PATCH 10/34] debug --- .github/workflows/chart-testing.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index 277fcaf..d7e9d59 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -26,6 +26,7 @@ jobs: helm dep update ./stack helm dependency build ./stack output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1) + echo $output if [[ $output -ne "error: no objects passed to apply" ]]; then exit 1 fi From dfc3091d3c748e4dc1c272aa5a18cab6714fe96d Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 03:43:20 -0700 Subject: [PATCH 11/34] debug --- .github/workflows/chart-testing.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index d7e9d59..27b8d17 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -26,6 +26,7 @@ jobs: helm dep update ./stack helm dependency build ./stack output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1) + echo "debug" echo $output if [[ $output -ne "error: no objects passed to apply" ]]; then exit 1 From 7b608b8cffa2f69dbc461e8959dfc1a447e70785 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 03:44:49 -0700 Subject: [PATCH 12/34] remove build --- .github/workflows/chart-testing.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index 27b8d17..6ed4334 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -24,7 +24,6 @@ jobs: run: | helm repo add argo-helm-charts https://chanzuckerberg.github.io/argo-helm-charts/ helm dep update ./stack - helm dependency build ./stack output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1) echo "debug" echo $output From 1ef5ff37d28a86d5630b99a2885d74abb28843e3 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 03:46:23 -0700 Subject: [PATCH 13/34] remove update --- .github/workflows/chart-testing.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index 6ed4334..e600b9f 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -22,8 +22,6 @@ jobs: - name: Validate chart template with default values run: | - helm repo add argo-helm-charts https://chanzuckerberg.github.io/argo-helm-charts/ - helm dep update ./stack output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1) echo "debug" echo $output From e992eb12cc619da2cf7e9d4af6bb51a77a6af1d2 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 03:47:43 -0700 Subject: [PATCH 14/34] build --- .github/workflows/chart-testing.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index e600b9f..60d0ac6 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -22,6 +22,7 @@ jobs: - name: Validate chart template with default values run: | + helm dependency build ./stack output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1) echo "debug" echo $output From aea2b3a5d5a68cab23ef64a08710a41e3b4253d3 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 03:48:48 -0700 Subject: [PATCH 15/34] update --- .github/workflows/chart-testing.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index 60d0ac6..48d1243 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -22,6 +22,7 @@ jobs: - name: Validate chart template with default values run: | + helm dependency update ./stack helm dependency build ./stack output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1) echo "debug" From ee2daa8d0c4e97d18cfce92bfcda7027bf5a3dbc Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 03:49:41 -0700 Subject: [PATCH 16/34] add repo --- .github/workflows/chart-testing.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index 48d1243..939f6be 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -22,6 +22,7 @@ jobs: - name: Validate chart template with default values run: | + helm repo add argo-helm-charts https://chanzuckerberg.github.io/argo-helm-charts/ helm dependency update ./stack helm dependency build ./stack output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1) From 7c6cc4dedf86c2773a846f12099f9fce1e3aa073 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 03:50:49 -0700 Subject: [PATCH 17/34] debug --- .github/workflows/chart-testing.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index 939f6be..f8593b0 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -25,8 +25,8 @@ jobs: helm repo add argo-helm-charts https://chanzuckerberg.github.io/argo-helm-charts/ helm dependency update ./stack helm dependency build ./stack - output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1) echo "debug" + output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1) echo $output if [[ $output -ne "error: no objects passed to apply" ]]; then exit 1 From 5e9c1721da46cd3314200d27337049a989124a35 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 04:03:33 -0700 Subject: [PATCH 18/34] add kind cluster --- .github/workflows/chart-testing.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index f8593b0..39159ec 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -20,6 +20,12 @@ jobs: - name: Set up kubectl uses: azure/setup-kubectl@v3 + - name: Create kind cluster + if: steps.list-changed.outputs.changed == 'true' + uses: helm/kind-action@v1.9.0 + with: + node_image: kindest/node:v1.30.2 + - name: Validate chart template with default values run: | helm repo add argo-helm-charts https://chanzuckerberg.github.io/argo-helm-charts/ From b51ef8afca7312c006a609b35065b0c02c6f9d2e Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 04:04:49 -0700 Subject: [PATCH 19/34] force cluster --- .github/workflows/chart-testing.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index 39159ec..d276e0d 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -21,7 +21,6 @@ jobs: uses: azure/setup-kubectl@v3 - name: Create kind cluster - if: steps.list-changed.outputs.changed == 'true' uses: helm/kind-action@v1.9.0 with: node_image: kindest/node:v1.30.2 From 7ac41a67db2a01d34b34c6eaa1dabab70df3c509 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 04:07:17 -0700 Subject: [PATCH 20/34] echo template --- .github/workflows/chart-testing.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index d276e0d..f6ca717 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -30,7 +30,8 @@ jobs: helm repo add argo-helm-charts https://chanzuckerberg.github.io/argo-helm-charts/ helm dependency update ./stack helm dependency build ./stack - echo "debug" + template=$(helm template ./stack --values ./test-fixtures/values.yaml) + echo $template output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1) echo $output if [[ $output -ne "error: no objects passed to apply" ]]; then From 01b24a3000465f9ab6afa7bbac0830f2d234bfee Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 04:09:37 -0700 Subject: [PATCH 21/34] debug --- .github/workflows/chart-testing.yaml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index f6ca717..c63bec7 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -19,18 +19,15 @@ jobs: - name: Set up kubectl uses: azure/setup-kubectl@v3 - - - name: Create kind cluster - uses: helm/kind-action@v1.9.0 - with: - node_image: kindest/node:v1.30.2 - name: Validate chart template with default values run: | helm repo add argo-helm-charts https://chanzuckerberg.github.io/argo-helm-charts/ helm dependency update ./stack helm dependency build ./stack + echo "debug1" template=$(helm template ./stack --values ./test-fixtures/values.yaml) + echo "debug2" echo $template output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1) echo $output From f95063395c4b326c0769f6cc0d9146ad7e765a2c Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 04:10:36 -0700 Subject: [PATCH 22/34] debug --- .github/workflows/chart-testing.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index c63bec7..81107e0 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -28,7 +28,7 @@ jobs: echo "debug1" template=$(helm template ./stack --values ./test-fixtures/values.yaml) echo "debug2" - echo $template + echo "template: $template" output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1) echo $output if [[ $output -ne "error: no objects passed to apply" ]]; then From 773918011487a042520d3bbb21168edfb2503189 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 04:12:44 -0700 Subject: [PATCH 23/34] get error --- .github/workflows/chart-testing.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index 81107e0..84b58a0 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -29,6 +29,7 @@ jobs: template=$(helm template ./stack --values ./test-fixtures/values.yaml) echo "debug2" echo "template: $template" + helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1 output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1) echo $output if [[ $output -ne "error: no objects passed to apply" ]]; then From 857fcff8db819fda1f1d3f98383e9021ba937352 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 04:22:25 -0700 Subject: [PATCH 24/34] suppress exit code --- .github/workflows/chart-testing.yaml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index 84b58a0..1c37820 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -25,13 +25,7 @@ jobs: helm repo add argo-helm-charts https://chanzuckerberg.github.io/argo-helm-charts/ helm dependency update ./stack helm dependency build ./stack - echo "debug1" - template=$(helm template ./stack --values ./test-fixtures/values.yaml) - echo "debug2" - echo "template: $template" - helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1 - output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1) - echo $output + output=$(helm template ./stack --values ./test-fixtures/values.yaml | kubectl apply -f - --dry-run=client 2>&1 || :) if [[ $output -ne "error: no objects passed to apply" ]]; then exit 1 fi From eca7a8c52ccbd61e894cf680ae82b1898d8831e8 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 04:24:04 -0700 Subject: [PATCH 25/34] suppress exit code of invalid values --- .github/workflows/chart-testing.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index 1c37820..77c78f4 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -32,7 +32,7 @@ jobs: - name: Validate chart template with invalid values run: | - output=$(helm template ./stack --values ./test-fixtures/values1.yaml | kubectl apply -f - --dry-run=client 2>&1) + output=$(helm template ./stack --values ./test-fixtures/values1.yaml | kubectl apply -f - --dry-run=client 2>&1 || :) if [[ $output -ne "Error: failed to parse ./test-fixtures/values1.yaml: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type map[string]interface {}" ]]; then exit 1 fi From db88bb71f73c8a1a93c9b325b91b1b4f831351dd Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 04:35:52 -0700 Subject: [PATCH 26/34] update setup-kubectl --- .github/workflows/chart-testing.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index 77c78f4..ec38ef5 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -18,7 +18,10 @@ jobs: version: v3.14.0 - name: Set up kubectl - uses: azure/setup-kubectl@v3 + uses: azure/setup-kubectl@v4 + with: + version: latest + id: install - name: Validate chart template with default values run: | From fc7b2f9b7149f3d9e30dfe3c7022d8c433c7011e Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 04:37:40 -0700 Subject: [PATCH 27/34] remove redirect --- .github/workflows/chart-testing.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index ec38ef5..e93ccc9 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -42,7 +42,7 @@ jobs: - name: Validate chart template with valid values run: | - helm template ./stack --values ./test-fixtures/values2.yaml | kubectl apply -f - --dry-run=client 2>&1 + helm template ./stack --values ./test-fixtures/values2.yaml | kubectl apply -f - --dry-run=client - uses: actions/setup-python@v4 with: From 517e4de219707603fa8c230643c79804f5f938e7 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 04:40:40 -0700 Subject: [PATCH 28/34] disable validate --- .github/workflows/chart-testing.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index e93ccc9..fec3080 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -42,7 +42,7 @@ jobs: - name: Validate chart template with valid values run: | - helm template ./stack --values ./test-fixtures/values2.yaml | kubectl apply -f - --dry-run=client + helm template ./stack --values ./test-fixtures/values2.yaml | kubectl apply -f - --dry-run=client --validate=false 2>&1 - uses: actions/setup-python@v4 with: From c002f08894cf534ebdff784eec2001984d98f620 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 04:46:28 -0700 Subject: [PATCH 29/34] verbose --- .github/workflows/chart-testing.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index fec3080..8845d78 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -42,7 +42,7 @@ jobs: - name: Validate chart template with valid values run: | - helm template ./stack --values ./test-fixtures/values2.yaml | kubectl apply -f - --dry-run=client --validate=false 2>&1 + helm template ./stack --values ./test-fixtures/values2.yaml | kubectl apply -f - --dry-run=client --validate=false --v=4 2>&1 - uses: actions/setup-python@v4 with: From 80f603890d520dc5e1ba443b1189a72931896ec2 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 04:47:43 -0700 Subject: [PATCH 30/34] max verbosity --- .github/workflows/chart-testing.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index 8845d78..5373dec 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -42,7 +42,7 @@ jobs: - name: Validate chart template with valid values run: | - helm template ./stack --values ./test-fixtures/values2.yaml | kubectl apply -f - --dry-run=client --validate=false --v=4 2>&1 + helm template ./stack --values ./test-fixtures/values2.yaml | kubectl apply -f - --dry-run=client --validate=false --v=10 2>&1 - uses: actions/setup-python@v4 with: From f4f6170b659a7e92cf5e32cb32a12cf70f2c81fe Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 04:49:16 -0700 Subject: [PATCH 31/34] debug get nodes --- .github/workflows/chart-testing.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index 5373dec..d22bf21 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -42,6 +42,7 @@ jobs: - name: Validate chart template with valid values run: | + kubectl get nodes -v=10 helm template ./stack --values ./test-fixtures/values2.yaml | kubectl apply -f - --dry-run=client --validate=false --v=10 2>&1 - uses: actions/setup-python@v4 From e7558ecc0d26db8f066ffbd176c59bd109babd96 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 04:53:43 -0700 Subject: [PATCH 32/34] get contexts --- .github/workflows/chart-testing.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index d22bf21..812d0f5 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -42,8 +42,8 @@ jobs: - name: Validate chart template with valid values run: | - kubectl get nodes -v=10 - helm template ./stack --values ./test-fixtures/values2.yaml | kubectl apply -f - --dry-run=client --validate=false --v=10 2>&1 + kubectl config get-contexts + helm template ./stack --values ./test-fixtures/values2.yaml | kubectl apply -f - --dry-run=client --validate=false 2>&1 - uses: actions/setup-python@v4 with: From 2587b3b965c581932231ddb2af68ab68de801857 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 04:55:31 -0700 Subject: [PATCH 33/34] try kind cluster --- .github/workflows/chart-testing.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index 812d0f5..4add1d0 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -23,6 +23,9 @@ jobs: version: latest id: install + - name: Create kind cluster 1 + uses: helm/kind-action@v1.9.0 + - name: Validate chart template with default values run: | helm repo add argo-helm-charts https://chanzuckerberg.github.io/argo-helm-charts/ From c2605da33f811699f167206de9729ab4d4d91aa6 Mon Sep 17 00:00:00 2001 From: David Tsai Date: Fri, 30 Aug 2024 05:02:25 -0700 Subject: [PATCH 34/34] cleanup --- .github/workflows/chart-testing.yaml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index 4add1d0..4db6975 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -23,8 +23,10 @@ jobs: version: latest id: install - - name: Create kind cluster 1 + - name: Create kind cluster uses: helm/kind-action@v1.9.0 + with: + node_image: kindest/node:v1.30.2 - name: Validate chart template with default values run: | @@ -45,8 +47,7 @@ jobs: - name: Validate chart template with valid values run: | - kubectl config get-contexts - helm template ./stack --values ./test-fixtures/values2.yaml | kubectl apply -f - --dry-run=client --validate=false 2>&1 + helm template ./stack --values ./test-fixtures/values2.yaml | kubectl apply -f - --dry-run=client 2>&1 - uses: actions/setup-python@v4 with: @@ -68,10 +69,6 @@ jobs: if: steps.list-changed.outputs.changed == 'true' run: ct lint --target-branch ${{ github.event.repository.default_branch }} - - name: Create kind cluster - if: steps.list-changed.outputs.changed == 'true' - uses: helm/kind-action@v1.8.0 - - name: Run chart-testing (install) if: steps.list-changed.outputs.changed == 'true' run: ct install --target-branch ${{ github.event.repository.default_branch }} \ No newline at end of file