Skip to content

Commit

Permalink
replace chart-testing and helm github actions with nix
Browse files Browse the repository at this point in the history
This commit removes all references to joejulian/chart-testing-action and
azure/setup-helm in favor of relying on nix to provide these packages.

There are a few side effects to this commit:
- All github actions are now run through `nix develop --impure --command
  bash`. This may interact strangely with the actions that install a
  dependency (ie kind) but would only result in running the version
  that's provided by nix.
- helm has been upgraded to `v3.14.2`

Fixes #1097.
  • Loading branch information
chrisseto committed Mar 20, 2024
1 parent bf2d27a commit 1d31f7e
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 95 deletions.
27 changes: 12 additions & 15 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
# This is to test only the Redpanda Chart Nightly
name: Nightly - Lint/Test Redpanda-Chart

defaults:
run:
shell: nix develop --impure --command bash {0}

on:
schedule:
- cron: '0 1 * * 1-5' # 01:00 AM UTC Monday - Friday
Expand All @@ -32,16 +36,13 @@ jobs:
git checkout main
git checkout -
- name: Set up Helm
uses: azure/setup-helm@v3
- uses: cachix/install-nix-action@v26
with:
version: v3.12.2

- name: Set up chart-testing
uses: joejulian/chart-testing-action@9f27771144b6debb69e1f85d5f5a3eae8485d057 # v2.4.0-3
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Run chart-testing (lint)
run: ct lint --config .github/ct-redpanda.yaml

test:
name: Run ct tests for ci values matching ${{ matrix.testvaluespattern }} for Redpanda version ${{ matrix.version }}
strategy:
Expand All @@ -68,19 +69,15 @@ jobs:
git checkout main
git checkout -
- uses: cachix/install-nix-action@v26
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up for matrix
run: |
echo bash -O extglob -c "rm -v charts/redpanda/ci/!(${{ matrix.testvaluespattern }})"
bash -O extglob -c "rm -v charts/redpanda/ci/!(${{ matrix.testvaluespattern }})"
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.11.1

- name: Set up chart-testing
uses: joejulian/chart-testing-action@9f27771144b6debb69e1f85d5f5a3eae8485d057 # v2.4.0-3

- name: Create kind cluster
uses: helm/kind-action@99576bfa6ddf9a8e612d83b513da5a75875caced # v1.9.0
with:
Expand Down Expand Up @@ -164,4 +161,4 @@ jobs:
--upgrade \
--config .github/ct-redpanda.yaml \
--helm-extra-set-args="--set=image.tag=${{ matrix.version }}" \
--skip-missing-values
--skip-missing-values
22 changes: 10 additions & 12 deletions .github/workflows/nightly_redpanda_tip.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ on:
schedule:
- cron: '0 2 * * 1-5' # 01:00 AM UTC Monday - Friday
workflow_dispatch: {}

defaults:
run:
shell: nix develop --impure --command bash {0}

jobs:
test-redpanda-nightly:
name: Run ct tests for ci values matching ${{ matrix.testvaluespattern }} for Redpanda nightly build
Expand All @@ -46,14 +51,15 @@ jobs:
git checkout main
git checkout -
- uses: cachix/install-nix-action@v26
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up for matrix
run: |
echo bash -O extglob -c "rm -v charts/redpanda/ci/!(${{ matrix.testvaluespattern }})"
bash -O extglob -c "rm -v charts/redpanda/ci/!(${{ matrix.testvaluespattern }})"
- uses: actions/setup-go@v5
with:
go-version: '>=1.20.4'
- run: go install github.com/joejulian/docker-tag-list@latest

- name: Get latest nightly tag
Expand All @@ -63,14 +69,6 @@ jobs:
docker-tag-list -c '~0.0.0-0' --latest -r redpandadata/redpanda-nightly | sed 's/-a..64$//'
)" >> $GITHUB_OUTPUT
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.12.2

- name: Set up chart-testing
uses: joejulian/chart-testing-action@9f27771144b6debb69e1f85d5f5a3eae8485d057 # v2.4.0-3

- name: Create kind cluster
uses: helm/kind-action@99576bfa6ddf9a8e612d83b513da5a75875caced # v1.9.0
with:
Expand Down Expand Up @@ -133,4 +131,4 @@ jobs:
--github-groups \
--config .github/ct-redpanda.yaml \
--helm-extra-set-args="--set=image.tag=${{ steps.latestTag.outputs.TAG }} --set=image.repository=redpandadata/redpanda-nightly" \
--skip-missing-values
--skip-missing-values
29 changes: 12 additions & 17 deletions .github/workflows/pull_requests_connectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,21 @@ on:
- '!charts/operator/**'
- '!charts/redpanda/**'
- '!**/*.md'

defaults:
run:
shell: nix develop --impure --command bash {0}

jobs:
lint:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash {0} # Explicit restore the default for jobs not using nix.
steps:
- name: Noop
run: echo noop

version-and-lint:
runs-on: ubuntu-22.04
steps:
Expand All @@ -51,14 +60,6 @@ jobs:
- name: Run CI file name checker
run: .github/check-ci-files.sh charts/connectors/ci

- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.12.2

- name: Set up chart-testing
uses: joejulian/chart-testing-action@9f27771144b6debb69e1f85d5f5a3eae8485d057 # v2.4.0-3

- name: Connectors lint
run: ct lint --config .github/ct-connectors.yaml --github-groups

Expand All @@ -73,10 +74,8 @@ jobs:
git checkout main
git checkout -
- name: install dyff
run: curl -Ls https://github.com/homeport/dyff/releases/download/v1.5.6/dyff_1.5.6_linux_amd64.tar.gz | tar xzv dyff
- name: compare connectors values with main
run: ./dyff --color=off -k between -s <(git show 'origin/main:charts/connectors/values.yaml') charts/connectors/values.yaml
run: dyff --color=off -k between -s <(git show 'origin/main:charts/connectors/values.yaml') charts/connectors/values.yaml

test:
needs: lint
Expand All @@ -93,13 +92,9 @@ jobs:
git checkout main
git checkout -
- name: Set up Helm
uses: azure/setup-helm@v3
- uses: cachix/install-nix-action@v26
with:
version: v3.11.1

- name: Set up chart-testing
uses: joejulian/chart-testing-action@9f27771144b6debb69e1f85d5f5a3eae8485d057 # v2.4.0-3
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Run chart-testing (list-changed)
id: list-changed
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/pull_requests_from_origin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ on:
- '!charts/kminion/**'
- '!charts/operator/**'
- '!**/*.md'

defaults:
run:
shell: nix develop --impure --command bash {0}

jobs:
test:
if: ${{ github.event.pull_request.head.repo.full_name == 'redpanda-data/helm-charts' }}
Expand All @@ -53,13 +58,9 @@ jobs:
git checkout main
git checkout -
- name: Set up Helm
uses: azure/setup-helm@v3
- uses: cachix/install-nix-action@v26
with:
version: v3.12.2

- name: Set up chart-testing
uses: joejulian/chart-testing-action@9f27771144b6debb69e1f85d5f5a3eae8485d057 # v2.4.0-3
github_access_token: ${{ secrets.GITHUB_TOKEN }}

# we're excluding console from testing until we have a way to test it with Redpanda
- name: Run chart-testing (list-changed)
Expand Down
37 changes: 20 additions & 17 deletions .github/workflows/pull_requests_kminion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,21 @@ on:
- '!charts/operator/**'
- '!charts/redpanda/**'
- '!**/*.md'

defaults:
run:
shell: nix develop --impure --command bash {0}

jobs:
lint:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash {0} # Explicit restore the default for jobs not using nix.
steps:
- name: Noop
run: echo noop

version-and-lint:
runs-on: ubuntu-22.04
steps:
Expand All @@ -48,16 +57,12 @@ jobs:
git checkout main
git checkout -
- name: Run CI file name checker
run: .github/check-ci-files.sh charts/kminion/ci

- name: Set up Helm
uses: azure/setup-helm@v3
- uses: cachix/install-nix-action@v26
with:
version: v3.12.2
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up chart-testing
uses: joejulian/chart-testing-action@9f27771144b6debb69e1f85d5f5a3eae8485d057 # v2.4.0-3
- name: Run CI file name checker
run: .github/check-ci-files.sh charts/kminion/ci

- name: Kminion lint
run: ct lint --config .github/ct-kminion.yaml --github-groups
Expand All @@ -73,10 +78,12 @@ jobs:
git checkout main
git checkout -
- name: install dyff
run: curl -Ls https://github.com/homeport/dyff/releases/download/v1.5.6/dyff_1.5.6_linux_amd64.tar.gz | tar xzv dyff
- uses: cachix/install-nix-action@v26
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: compare kminion values with main
run: ./dyff --color=off -k between -s <(git show 'origin/main:charts/kminion/values.yaml') charts/kminion/values.yaml
run: dyff --color=off -k between -s <(git show 'origin/main:charts/kminion/values.yaml') charts/kminion/values.yaml

test:
needs: lint
Expand All @@ -93,13 +100,9 @@ jobs:
git checkout main
git checkout -
- name: Set up Helm
uses: azure/setup-helm@v3
- uses: cachix/install-nix-action@v26
with:
version: v3.11.1

- name: Set up chart-testing
uses: joejulian/chart-testing-action@9f27771144b6debb69e1f85d5f5a3eae8485d057 # v2.4.0-3
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Run chart-testing (list-changed)
id: list-changed
Expand Down
38 changes: 20 additions & 18 deletions .github/workflows/pull_requests_operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,16 @@ on:
- '!charts/redpanda/**'
- '!**/*.md'

defaults:
run:
shell: nix develop --impure --command bash {0}

jobs:
lint:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash {0} # Explicit restore the default for jobs not using nix.
steps:
- name: Noop
run: echo noop
Expand All @@ -49,16 +56,12 @@ jobs:
git checkout main
git checkout -
- name: Run CI file name checker
run: .github/check-ci-files.sh charts/operator/ci

- name: Set up Helm
uses: azure/setup-helm@v3
- uses: cachix/install-nix-action@v26
with:
version: v3.12.2
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up chart-testing for operator
uses: joejulian/chart-testing-action@9f27771144b6debb69e1f85d5f5a3eae8485d057 # v2.4.0-3
- name: Run CI file name checker
run: .github/check-ci-files.sh charts/operator/ci

- name: Operator lint
run: ct lint --config .github/ct-operator.yaml --github-groups
Expand All @@ -74,10 +77,13 @@ jobs:
git checkout main
git checkout -
- name: install dyff
run: curl -Ls https://github.com/homeport/dyff/releases/download/v1.5.6/dyff_1.5.6_linux_amd64.tar.gz | tar xzv dyff
- uses: cachix/install-nix-action@v26
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: compare operator values with main
run: ./dyff --color=off -k between -s <(git show 'origin/main:charts/operator/values.yaml') charts/operator/values.yaml
run: dyff --color=off -k between -s <(git show 'origin/main:charts/operator/values.yaml') charts/operator/values.yaml

test:
needs: lint
name: Run ct tests for operator chart
Expand All @@ -93,20 +99,16 @@ jobs:
git checkout main
git checkout -
- name: Set up Helm
uses: azure/setup-helm@v3
- uses: cachix/install-nix-action@v26
with:
version: v3.11.1
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Get appVersion
id: app_version
uses: mikefarah/yq@master
with:
cmd: yq .appVersion charts/operator/Chart.yaml

- name: Set up chart-testing
uses: joejulian/chart-testing-action@9f27771144b6debb69e1f85d5f5a3eae8485d057 # v2.4.0-3

# we're excluding console from testing until we have a way to test it with Redpanda
- name: Run chart-testing (list-changed)
id: list-changed
Expand Down Expand Up @@ -162,4 +164,4 @@ jobs:
- name: Summarize the results of the test matrix pass/fail
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs)}}
jobs: ${{ toJSON(needs)}}
Loading

0 comments on commit 1d31f7e

Please sign in to comment.