-
Notifications
You must be signed in to change notification settings - Fork 12
chore: Add initial base chart tests #493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dacbd
wants to merge
21
commits into
main
Choose a base branch
from
dacbd/initial-base-chart-testing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
2c219f6
docs additions
dacbd ee503ed
tests and snaps
dacbd 9e3c1b2
additional resources for test
dacbd 060af6c
add workflow
dacbd 97215cf
add job test
dacbd 29fdc29
enable test
dacbd 2d43028
update name
dacbd 0ad46f3
prevent long names from breaking tests
dacbd 467531b
correct list
dacbd b14497e
update github actions
dacbd a1e04d1
script tweaks
dacbd 9195243
uneeded pushd/popd
dacbd 4b5dab8
more actions cleanup
dacbd 9d4d47e
adjust job creation script
dacbd 8a7e402
tweak tests
dacbd 64b5d8a
remove test.enabled wrapper
dacbd 14dd8f3
simple test
dacbd 77575c1
fix test script
dacbd 8c2346d
fix test
dacbd 3247f39
update snapshots / script
dacbd 6fbb33a
better test?
dacbd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| name: Test operator-wandb Chart | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - charts/operator-wandb/** | ||
| - test-configs/wandb-base/** | ||
|
|
||
| jobs: | ||
| snapshots: | ||
| name: Snapshot testing | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Helm | ||
| uses: azure/[email protected] | ||
| with: | ||
| version: v3.17.0 | ||
| - name: Helm snapshot build and test | ||
| run: | | ||
| pushd ./charts/operator-wandb/ | ||
| helm repo add bitnami https://charts.bitnami.com/bitnami | ||
| helm repo add stakater https://stakater.github.io/stakater-charts | ||
| helm repo add prometheus https://prometheus-community.github.io/helm-charts | ||
| popd | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| helm plugin install https://github.com/origranot/helm-cascade | ||
| helm plugin install https://github.com/jlandowner/helm-chartsnap | ||
| ./snapshots.sh build | ||
| ./snapshots.sh run | ||
| # currently this action always tries to install helm, so dont use it for now | ||
| - name: Chart Snapshots | ||
| if: ${{ !always() }} | ||
| uses: jlandowner/helm-chartsnap-action@v1 | ||
| id: chartsnap | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| with: | ||
| chart: charts/wandb-base/ | ||
| values: test-configs/wandb-base/ | ||
|
|
||
| test: | ||
| name: Test Chart | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| k8s-version: ["v1.32.2", "v1.31.6", "v1.30.10"] | ||
| configuration: | ||
| [ | ||
| ] | ||
| runs-on: ubuntu-latest | ||
| environment: Helm Charts | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Set up Helm | ||
| uses: azure/[email protected] | ||
| with: | ||
| version: v3.17.0 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.10" | ||
|
|
||
| - name: Set up chart-testing | ||
| uses: helm/[email protected] | ||
| with: | ||
| version: v3.12.0 | ||
|
|
||
| - name: Run chart-testing (list-changed) | ||
| id: list-changed | ||
| run: | | ||
| changed=$(ct list-changed --config ct.yaml) | ||
| if [[ -n "$changed" ]]; then | ||
| echo "::set-output name=changed::true" | ||
| fi | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Create kind cluster | ||
| uses: helm/[email protected] | ||
| with: | ||
| version: v0.27.0 | ||
| cluster_name: chart-testing-${{ matrix.k8s-version }}-${{ matrix.configuration }} | ||
| node_image: kindest/node:${{ matrix.k8s-version }} | ||
| if: env.ACT || steps.list-changed.outputs.changed == 'true' | ||
|
|
||
| - name: Apply user defined secrets | ||
| run: | | ||
| if [[ -d test-configs/additional-resources/${{matrix.configuration}} ]]; then | ||
| kubectl --context kind-chart-testing-${{ matrix.k8s-version }}-${{ matrix.configuration }} apply -f test-configs/additional-resources/${{matrix.configuration}} | ||
| else | ||
| echo "No additional resources to be applied for ${{matrix.configuration}}" | ||
| fi | ||
| if: env.ACT || steps.list-changed.outputs.changed == 'true' | ||
|
|
||
| #- name: Run chart-testing (install) | ||
| # env: | ||
| # LICENSE: ${{ secrets.LICENSE }} | ||
| # if: env.ACT || steps.list-changed.outputs.changed == 'true' | ||
| # run: | | ||
| # ct install --namespace default \ | ||
| # --charts ./charts/operator-wandb \ | ||
| # --config ct.yaml \ | ||
| # --helm-extra-args '--kube-context kind-chart-testing-${{ matrix.k8s-version }}-${{ matrix.configuration }} --timeout 600s' \ | ||
| # --helm-extra-set-args '--values test-configs/operator-wandb/${{ matrix.configuration }}.yaml --set=license=$LICENSE' | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
test-configs/additional-resources/env-values-example/configmap.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: my-configmap | ||
| data: | ||
| configmap-key: "test" |
6 changes: 6 additions & 0 deletions
6
test-configs/additional-resources/env-values-example/secret.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: my-secret | ||
| stringData: | ||
| secret-key: "test" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| dynamicFields: | ||
| - jsonPath: | ||
| - /metadata/labels/helm.sh~1chart | ||
| value: '###CHART_VERSION###' |
107 changes: 107 additions & 0 deletions
107
test-configs/wandb-base/__snapshots__/env-precedence-chart-env.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| # chartsnap: snapshot_version=v3 | ||
| --- | ||
| # Source: wandb-base/templates/pdb.yaml | ||
| apiVersion: policy/v1 | ||
| kind: PodDisruptionBudget | ||
| metadata: | ||
| name: chartsnap-wandb-base | ||
| labels: | ||
| helm.sh/chart: '###CHART_VERSION###' | ||
| app.kubernetes.io/name: wandb-base | ||
| app.kubernetes.io/instance: chartsnap | ||
| app.kubernetes.io/managed-by: Helm | ||
| spec: | ||
| selector: | ||
| matchExpressions: | ||
| - key: batch.kubernetes.io/job-name | ||
| operator: DoesNotExist | ||
| matchLabels: | ||
| app.kubernetes.io/name: wandb-base | ||
| app.kubernetes.io/instance: chartsnap | ||
| maxUnavailable: 1 | ||
| --- | ||
| # Source: wandb-base/templates/serviceaccount.yaml | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: chartsnap-wandb-base | ||
| labels: | ||
| helm.sh/chart: '###CHART_VERSION###' | ||
| app.kubernetes.io/name: wandb-base | ||
| app.kubernetes.io/instance: chartsnap | ||
| app.kubernetes.io/managed-by: Helm | ||
| automountServiceAccountToken: true | ||
| --- | ||
| # Source: wandb-base/templates/job.yaml | ||
| apiVersion: batch/v1 | ||
| kind: Job | ||
| metadata: | ||
| name: chartsnap-test | ||
| labels: | ||
| helm.sh/chart: '###CHART_VERSION###' | ||
| app.kubernetes.io/name: wandb-base | ||
| app.kubernetes.io/instance: chartsnap | ||
| app.kubernetes.io/managed-by: Helm | ||
| spec: | ||
| template: | ||
| metadata: | ||
| labels: | ||
| helm.sh/chart: wandb-base-0.11.0 | ||
| app.kubernetes.io/name: wandb-base | ||
| app.kubernetes.io/instance: chartsnap | ||
| app.kubernetes.io/managed-by: Helm | ||
| spec: | ||
| containers: | ||
| - name: example | ||
| command: | ||
| - /bin/bash | ||
| args: | ||
| - -c | ||
| - | | ||
| echo "EXAMPLE=$EXAMPLE" | ||
| EXPECTED="400" | ||
| if [ "$EXAMPLE" = "$EXPECTED" ]; then | ||
| echo "Value is $EXPECTED" | ||
| exit 0 | ||
| else | ||
| echo "Value is NOT $EXPECTED" | ||
| exit 1 | ||
| fi | ||
| envFrom: | ||
| env: | ||
| - name: EXAMPLE | ||
| value: "400" | ||
| securityContext: | ||
| allowPrivilegeEscalation: false | ||
| capabilities: | ||
| add: [] | ||
| drop: [] | ||
| privileged: false | ||
| readOnlyRootFilesystem: false | ||
| image: "debian:12-slim" | ||
| imagePullPolicy: | ||
| restartPolicy: Never | ||
| serviceAccountName: chartsnap-wandb-base | ||
| securityContext: | ||
| fsGroup: 0 | ||
| fsGroupChangePolicy: OnRootMismatch | ||
| runAsGroup: 0 | ||
| runAsNonRoot: true | ||
| runAsUser: 999 | ||
| seccompProfile: | ||
| type: RuntimeDefault | ||
| topologySpreadConstraints: | ||
| - labelSelector: | ||
| matchLabels: | ||
| app.kubernetes.io/instance: chartsnap | ||
| app.kubernetes.io/name: wandb-base | ||
| maxSkew: 1 | ||
| topologyKey: topology.kubernetes.io/zone | ||
| whenUnsatisfiable: ScheduleAnyway | ||
| - labelSelector: | ||
| matchLabels: | ||
| app.kubernetes.io/instance: chartsnap | ||
| app.kubernetes.io/name: wandb-base | ||
| maxSkew: 1 | ||
| topologyKey: kubernetes.io/hostname | ||
| whenUnsatisfiable: ScheduleAnyway |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.