Repository navigation
chore(deps): update dependency kubernetes to v37 #242
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
| name: CI | |
| on: | |
| pull_request: | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Build | |
| run: go build ./... | |
| - name: Test | |
| run: go test $(go list ./... | grep -v keess/tests/e2e) | |
| - name: Detect changed files | |
| id: changes | |
| run: | | |
| BASE="${{ github.event.pull_request.base.sha }}" | |
| HEAD="${{ github.event.pull_request.head.sha }}" | |
| CHANGED=$(git diff --name-only "$BASE" "$HEAD") | |
| DOCKER_CHANGES=$(echo "$CHANGED" | grep '^Dockerfile' | grep -v '\.dockerignore$' || true) | |
| CHART_CHANGES=$(echo "$CHANGED" | grep '^chart/' || true) | |
| if [ -n "$DOCKER_CHANGES" ]; then | |
| echo "has_dockerfiles=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "has_dockerfiles=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| if [ -n "$CHART_CHANGES" ]; then | |
| echo "has_chart=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "has_chart=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Install goreleaser | |
| if: steps.changes.outputs.has_dockerfiles == 'true' | |
| uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3 | |
| with: | |
| distribution: goreleaser | |
| version: "v2.18.2" | |
| install-only: true | |
| - name: Docker build | |
| if: steps.changes.outputs.has_dockerfiles == 'true' | |
| run: make docker-build | |
| - name: Install Helm | |
| if: steps.changes.outputs.has_chart == 'true' | |
| uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1 | |
| - name: Helm lint | |
| if: steps.changes.outputs.has_chart == 'true' | |
| run: helm lint chart/ | |
| # values.yaml used to pin image digests, which silently detached the | |
| # deployed image from appVersion: the fleet ran a 1.3.3 build for months | |
| # while every version label said 1.4.2, and nothing caught it. appVersion | |
| # is now the only thing that selects an image -- this keeps it that way. | |
| - name: Assert rendered images match appVersion | |
| if: steps.changes.outputs.has_chart == 'true' | |
| run: | | |
| APP_VERSION=$(awk -F'"' '/^appVersion:/ {print $2}' chart/Chart.yaml) | |
| RENDERED=$(helm template chart/ \ | |
| --set localCluster=ci \ | |
| --set kubeconfigReloader.enabled=true \ | |
| | grep -E '^[[:space:]]*image:' \ | |
| | sed -E 's/^[[:space:]]*image:[[:space:]]*"?([^"]*)"?[[:space:]]*$/\1/') | |
| echo "appVersion: $APP_VERSION" | |
| echo "rendered images:" | |
| echo "$RENDERED" | |
| status=0 | |
| for want in "powerhome/keess:$APP_VERSION" \ | |
| "powerhome/keess-kubeconfig-reloader:$APP_VERSION"; do | |
| if ! echo "$RENDERED" | grep -qx "$want"; then | |
| echo "::error::expected rendered image '$want' -- appVersion must select the image; do not pin a tag or digest in chart/values.yaml" | |
| status=1 | |
| fi | |
| done | |
| exit $status | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0 | |
| with: | |
| version: v2.13.2 |