Skip to content

Commit

Permalink
fix: set go version from mod (#267)
Browse files Browse the repository at this point in the history
# Description

Sets the GHA `setup-go` Go version from the go.mod, instead of
separately.

## Related Issue


## Checklist

- [x] I have read the [contributing
documentation](https://retina.sh/docs/contributing).
- [x] I signed and signed-off the commits (`git commit -S -s ...`). See
[this
documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification)
on signing commits.
- [x] I have correctly attributed the author(s) of the code.
- [x] I have tested the changes locally.
- [x] I have followed the project's style guidelines.
- [x] I have updated the documentation, if necessary.
- [x] I have added tests, if applicable.

## Screenshots (if applicable) or Testing Completed

Please add any relevant screenshots or GIFs to showcase the changes
made.

## Additional Notes

Add any additional notes or context about the pull request here.

---

Please refer to the [CONTRIBUTING.md](../CONTRIBUTING.md) file for more
information on how to contribute to this project.

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
  • Loading branch information
rbtr authored Apr 17, 2024
1 parent 424c0e4 commit 30a128b
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 36 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
goos: [linux, windows]
goarch: [amd64, arm64]
language: [go]
go-version: ["1.21"]
runs-on: ubuntu-latest
env:
IS_NOT_MERGE_GROUP: ${{ github.event_name != 'merge_group' }}
Expand All @@ -27,14 +26,14 @@ jobs:
contents: read
security-events: write
steps:
- name: Checkout repository
if: env.IS_NOT_MERGE_GROUP
uses: actions/checkout@v4
- name: Setup go
if: env.IS_NOT_MERGE_GROUP
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout repository
if: env.IS_NOT_MERGE_GROUP
uses: actions/checkout@v4
go-version-file: go.mod
- name: Initialize CodeQL
if: env.IS_NOT_MERGE_GROUP
uses: github/codeql-action/init@v3
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jobs:
strategy:
fail-fast: false
matrix:
go-version: ["1.21.x"]
goos: ["linux", "windows"]
goarch: ["amd64", "arm64"]
name: Lint
Expand All @@ -21,14 +20,14 @@ jobs:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
steps:
- uses: actions/setup-go@v5
if: env.IS_NOT_MERGE_GROUP
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v4
if: env.IS_NOT_MERGE_GROUP
with:
fetch-depth: 0
- uses: actions/setup-go@v5
if: env.IS_NOT_MERGE_GROUP
with:
go-version-file: go.mod
- name: golangci-lint
if: env.IS_NOT_MERGE_GROUP
uses: golangci/golangci-lint-action@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ">=1.21.0"
go-version-file: go.mod
- name: Run GoReleaser build
uses: goreleaser/goreleaser-action@v5
with:
Expand All @@ -39,7 +39,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ">=1.21.0"
go-version-file: go.mod
- name: Run GoReleaser release
uses: goreleaser/goreleaser-action@v5
with:
Expand Down
23 changes: 11 additions & 12 deletions .github/workflows/images.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build images and run E2E tests.
name: Build images and run E2E tests.

on:
pull_request:
Expand Down Expand Up @@ -26,7 +26,7 @@ jobs:

- uses: actions/setup-go@v4
with:
go-version: ">=1.21.0"
go-version-file: go.mod
- run: go version

- name: Set up QEMU
Expand Down Expand Up @@ -58,7 +58,6 @@ jobs:
env:
IS_MERGE_GROUP: ${{ github.event_name == 'merge_group' }}


retina-win-images:
name: Build Agent Windows Images
runs-on: ubuntu-latest
Expand All @@ -74,18 +73,18 @@ jobs:

- uses: actions/setup-go@v4
with:
go-version: ">=1.21.0"
go-version-file: go.mod
- run: go version

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Az CLI login
uses: azure/login@v1
if: ${{ github.event_name == 'merge_group' }}
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Build Images
shell: bash
run: |
Expand Down Expand Up @@ -121,7 +120,7 @@ jobs:

- uses: actions/setup-go@v4
with:
go-version: ">=1.21.0"
go-version-file: go.mod
- run: go version

- name: Set up QEMU
Expand All @@ -132,7 +131,7 @@ jobs:
if: ${{ github.event_name == 'merge_group' }}
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Build Images
shell: bash
run: |
Expand Down Expand Up @@ -169,7 +168,7 @@ jobs:

- name: Setup QEMU
uses: docker/setup-qemu-action@v3

- name: Azure CLI login
uses: azure/login@v1
with:
Expand All @@ -182,7 +181,7 @@ jobs:
az acr login -n ${{ vars.ACR_NAME }}
make manifest COMPONENT=${{ matrix.components }} \
IMAGE_REGISTRY=${{ vars.ACR_NAME }} \
e2e:
if: ${{ github.event_name == 'merge_group' }}
name: Run E2E Tests
Expand All @@ -200,7 +199,7 @@ jobs:
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: ">=1.21.0"
go-version-file: go.mod
- run: go version

- name: Az CLI login
Expand All @@ -214,4 +213,4 @@ jobs:
run: |
set -euo pipefail
export AZURE_SUBSCRIPTION_ID=${{ secrets.AZURE_SUBSCRIPTION }}
go test -v ./test/e2e/scenarios/retina/*.go -timeout 30m -tags=e2e -count=1 -args -image-tag=$(make version) -image-registry=${{ vars.ACR_NAME }} -image-namespace=${{ github.repository}}
go test -v ./test/e2e/scenarios/retina/*.go -timeout 30m -tags=e2e -count=1 -args -image-tag=$(make version) -image-registry=${{ vars.ACR_NAME }} -image-namespace=${{ github.repository}}
20 changes: 9 additions & 11 deletions .github/workflows/release-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:

- uses: actions/setup-go@v4
with:
go-version: ">=1.21.0"
go-version-file: go.mod
- run: go version

- name: Install Cosign
uses: sigstore/cosign-installer@v3.5.0

Expand All @@ -49,7 +49,7 @@ jobs:
IMAGE_NAMESPACE=${{ github.repository }} \
PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} \
BUILDX_ACTION=--push
- name: Sign container image
run: |
for image in retina-agent retina-init; do
Expand All @@ -58,7 +58,6 @@ jobs:
cosign sign --yes ${IMAGE_PATH}@${DIGEST}
done
retina-win-images:
name: Build Agent Windows Images
runs-on: ubuntu-latest
Expand All @@ -74,12 +73,12 @@ jobs:

- uses: actions/setup-go@v4
with:
go-version: ">=1.21.0"
go-version-file: go.mod
- run: go version

- name: Install Cosign
uses: sigstore/cosign-installer@v3.5.0

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

Expand Down Expand Up @@ -121,9 +120,9 @@ jobs:

- uses: actions/setup-go@v4
with:
go-version: ">=1.21.0"
go-version-file: go.mod
- run: go version

- name: Install Cosign
uses: sigstore/cosign-installer@v3.5.0

Expand All @@ -142,7 +141,7 @@ jobs:
IMAGE_NAMESPACE=${{ github.repository }} \
PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} \
BUILDX_ACTION=--push
- name: Sign container image
run: |
for image in retina-operator ; do
Expand All @@ -151,7 +150,6 @@ jobs:
cosign sign --yes ${IMAGE_PATH}@${DIGEST}
done
manifests:
name: Generate Manifests
runs-on: ubuntu-latest
Expand All @@ -167,7 +165,7 @@ jobs:

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Install Cosign
uses: sigstore/cosign-installer@v3.5.0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: "^1.21"
go-version-file: go.mod

- name: Make Retina Test image
env:
Expand Down

0 comments on commit 30a128b

Please sign in to comment.