Skip to content
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

chore: massive redo of Operator #295

Merged
merged 6 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/actions/setup-go-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Setup Go"
description: "Setup Go with caching"
inputs:
cache-prefix:
description: "Prefix for the cache key"
required: false
default: "go"
disable-cache:
description: "Disable caching"
required: false
default: "false"
go-version:
description: "Version of Go. Default 1.21"
required: false
default: "1.21"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should ask the GR guys some time if they have any interest in updating the armada repo to Go 1.21. (I've been building Armada with 1.21.1 and it seems to work fine).

outputs:
go-version:
description: "The installed Go version"
value: ${{ steps.setup-go.outputs.go-version }}
runs:
using: "composite"
steps:
- id: setup-go
uses: actions/setup-go@v4
with:
go-version: ${{ inputs.go-version }}
check-latest: true
cache: false
- id: cache-info
if: ${{ inputs.disable-cache != 'true' }}
shell: bash
run: echo path=$(go env GOCACHE) >> $GITHUB_OUTPUT
- uses: actions/cache@v3
if: ${{ inputs.disable-cache != 'true' }}
with:
path: ${{ steps.cache-info.outputs.path }}
key: ${{ inputs.cache-prefix }}-go-${{ steps.setup-go.outputs.go-version }}-mod-${{ hashFiles('go.sum') }}
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build

on:
workflow_call:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Go
id: setup-go
uses: ./.github/actions/setup-go-cache
with:
cache-prefix: go-build

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: v1.22.1
args: build --snapshot --clean
env:
DOCKER_REPO: "gresearch"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
DOCKER_BUILDX_BUILDER: "${{ steps.buildx.outputs.name }}"
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
uses: ./.github/workflows/test.yml
codeql:
uses: ./.github/workflows/codeql.yml
build:
uses: ./.github/workflows/build.yml
# Virtual job that can be configured as a required check before a PR can be merged.
all-required-checks-done:
name: All required checks done
Expand All @@ -33,7 +35,8 @@ jobs:
- lint
- test
- codeql
runs-on: ubuntu-22.04
- build
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,14 @@ jobs:
fail-fast: false
matrix:
language: ['go']
go: [ '1.20' ]
go: [ '1.21' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Golang with cache
uses: magnetikonline/action-golang-cache@v4
with:
go-version: "1.20"
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,19 @@ permissions:
jobs:
go-lint:
name: Golang Lint
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Golang with cache
uses: magnetikonline/action-golang-cache@v4
- uses: actions/setup-go@v4
with:
go-version: "1.20"
go-version: '1.21'
cache: false

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: "latest"
skip-pkg-cache: true
skip-build-cache: true
args: "-c ./.golangci.yml --timeout=10m --issues-exit-code=1 --max-issues-per-linter=0 --sort-results ./..."
only-new-issues: true
args: "-c ./.golangci.yml --timeout=10m --issues-exit-code=1 --sort-results ./..."
2 changes: 1 addition & 1 deletion .github/workflows/lint_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
main:
name: Validate PR title
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
validate:
if: github.event.workflow_run.event == 'push' && github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'armadaproject'
name: "Validate revision"
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"
with:
fetch-depth: 0

Expand All @@ -40,22 +40,23 @@ jobs:
release:
name: "Release"
needs: validate
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
environment: armada-dockerhub

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Fetch Git tags
run: git fetch --force --tags

- name: Set up Go
uses: actions/setup-go@v4
- name: Setup Go
id: setup-go
uses: ./.github/actions/setup-go-cache
with:
go-version: "1.20"
cache-prefix: go-build

- name: Set up Docker Buildx
id: buildx
Expand All @@ -78,18 +79,17 @@ jobs:
echo "GORELEASER_PREVIOUS_TAG=$previous_tag" >> $GITHUB_ENV

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: v1.19.2
version: v1.21.1
args: "-f ./.goreleaser.yaml release --clean"
env:
FULL_RELEASE: true
DOCKER_REPO: "gresearch"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
DOCKER_BUILDX_BUILDER: "${{ steps.buildx.outputs.name }}"
DOCKER_BUILDX_CACHE_FROM: "type=gha"
DOCKER_BUILDX_CACHE_TO: "type=gha,mode=max"

invoke-chart-push:
name: Invoke Chart push
needs: release
Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/release_rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
validate:
if: github.event.workflow_run.event == 'push' && github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'armadaproject'
name: "Validate revision"
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"
with:
fetch-depth: 0

Expand All @@ -40,19 +40,20 @@ jobs:
release:
name: Release
needs: validate
runs-on: "ubuntu-22.04"
runs-on: "ubuntu-latest"
environment: armada-dockerhub

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"
with:
fetch-depth: 0

- name: Setup Golang with Cache
uses: magnetikonline/action-golang-cache@v4
- name: Setup Go
id: setup-go
uses: ./.github/actions/setup-go-cache
with:
go-version: "1.20"
cache-prefix: go-build

- name: Set up Docker Buildx
id: buildx
Expand All @@ -65,17 +66,15 @@ jobs:
password: "${{ secrets.DOCKERHUB_PASS }}"

- name: "Run GoReleaser"
uses: "goreleaser/goreleaser-action@v4"
uses: "goreleaser/goreleaser-action@v5"
with:
distribution: "goreleaser"
version: v1.19.2
version: v1.21.1
args: "-f ./.goreleaser.yaml release --snapshot --skip-sbom --skip-sign --clean"
env:
DOCKER_REPO: "gresearch"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
DOCKER_BUILDX_BUILDER: "${{ steps.buildx.outputs.name }}"
DOCKER_BUILDX_CACHE_FROM: "type=gha"
DOCKER_BUILDX_CACHE_TO: "type=gha,mode=max"

- name: Run Docker push script
run: ./scripts/docker-push.sh -t '${{ github.event.workflow_run.head_sha }}'
Loading