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

[Backport][v2.7] GHA CI #472

Merged
merged 25 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
bd34476
remove drone CI
alexandreLamarre Apr 23, 2024
9ee9cae
add goreleaser to publish BRO
alexandreLamarre Apr 23, 2024
e15105c
Add CI install/setup scripts
alexandreLamarre Apr 23, 2024
836d477
Update dapper scripts to be more ergonomic
alexandreLamarre Apr 23, 2024
e524b91
Update dockerfile to not copy binary
alexandreLamarre Apr 23, 2024
caa0b6c
Introduce GHA for build & testing in CI
alexandreLamarre Apr 23, 2024
911f368
Introduce GHA for binary release CI
alexandreLamarre Apr 23, 2024
be43f56
Introduce GHA for publishing images to docker
alexandreLamarre Apr 23, 2024
c8d55b2
document integration testing methods
alexandreLamarre Apr 23, 2024
627e9cd
read vault secrets from EIO
alexandreLamarre Apr 23, 2024
2142bcd
linting, style & typos
alexandreLamarre Apr 25, 2024
3f3baca
add timeout to setup-cluster
alexandreLamarre Apr 25, 2024
fdcc858
fix typo in local ref for CI actions
alexandreLamarre May 1, 2024
84c45cf
tweak permissions and dispatch types for GHA
alexandreLamarre May 1, 2024
f6daf5e
require CI to pass before attempting to publish
alexandreLamarre May 13, 2024
f066b36
update k8s version support, based on rancher support matrix
alexandreLamarre May 13, 2024
03d8bb5
Add packaged release charts to github releases
alexandreLamarre May 14, 2024
c30011a
remove unecessary comments from goreleaser
alexandreLamarre May 13, 2024
c46837b
(test bug fix) source versions in package-helm script instead of exec…
alexandreLamarre May 13, 2024
110c94f
add race flag to hull tests
alexandreLamarre May 13, 2024
56dee5b
set GORELEASER_CURRENT_TAG as GHA vars.GITHUB_REF_NAME
mallardduck Jul 17, 2024
b02c35e
merge jobs with the same trigger and common pre-steps
mallardduck Jul 19, 2024
91cdb11
fix but with tag variable used
mallardduck Jul 19, 2024
c7b1365
update CI to also run on PRs pointing at 3 dot releases
mallardduck Jul 25, 2024
348914e
adjust pattern match to use [0-9]+
mallardduck Jul 25, 2024
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
249 changes: 0 additions & 249 deletions .drone.yml

This file was deleted.

88 changes: 88 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Backup Restore CI

permissions:
contents : read

on:
workflow_call:
push:
branches:
- release/v5.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this just be release/v* so we don't have to keep updating it?

- release/v4.0
- release/v3.0
paths-ignore:
- 'docs/**'
- '*.md'
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
jobs:
build:
strategy:
matrix:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Alternative to run on both platforms:

 strategy:
      matrix:
        archBox:
        - { arch: amd64, vmArch: x64 }
        - { arch: arm64, vmArch: arm64 }
    runs-on: runs-on,runner=1cpu-linux-${{ matrix.archBox.vmArch }},run-id=${{ github.run_id }}
    ```

os : [
Copy link
Collaborator

Choose a reason for hiding this comment

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

extra white-space at the end

ubuntu-latest
# org-rancher-arm64-containers
]
name : CI
runs-on : ${{ matrix.os }}
outputs:
k3sversions: ${{ steps.support.outputs.k3sversions }}
steps:
- name : Checkout repository
uses : actions/checkout@v4
with :
fetch-depth : 0
- name: Set K3s support output
id : support
run: ./.github/workflows/scripts/supported-versions.sh | awk '{print "k3sversions="$0}' >> $GITHUB_OUTPUT
- name : CI
run : make ci
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bro-build-artifacts-${{ matrix.os }}
path: ./dist/artifacts

test:
name : integration-test
needs : [
build
]
runs-on : ${{ matrix.os }}
strategy:
matrix:
os : [
ubuntu-latest
# org-rancher-arm64-containers,
]
K3S_VERSION : ${{ fromJSON(needs.build.outputs.k3sversions) }}
steps:
- name : Checkout repository
uses : actions/checkout@v4
- name : Fetch build artifacts
uses: actions/download-artifact@v4
with:
name: bro-build-artifacts-${{ matrix.os }}
path: ./dist/artifacts/
- name : Debug
Copy link
Collaborator

Choose a reason for hiding this comment

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

I use this too, but I assume we want to pull out the Debug parts once everything's working

run : ls -R ./dist/artifacts
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name : Load backup-restore-operator image
run : docker image load -i ./dist/artifacts/backup-restore-operator.img
- name : Setup up K3d
run : ./.github/workflows/scripts/install-k3d.sh
- name : Setup up mc
run : ./.github/workflows/scripts/install-mc.sh
- name : Setup k3d cluster
run : CLUSTER_NAME=backup-restore K3S_VERSION=${{ matrix.K3S_VERSION }} ./.github/workflows/scripts/setup-cluster.sh
- name : Run integration tests
run : ./scripts/integration
55 changes: 55 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name : Publish Images

on:
push:
tags:
- "*"

env:
REGISTRY: docker.io
REPO : rancher


jobs:
ci :
uses: rancher/backup-restore-operator/.github/workflows/ci.yaml@release/v5.0
alexandreLamarre marked this conversation as resolved.
Show resolved Hide resolved
permissions:
contents: read
push:
needs : [
ci
]
permissions:
contents : read
id-token: write
name : Build and push BRO images
runs-on : ubuntu-latest
steps:
- name : "Read vault secrets"
uses : rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials password | DOCKER_PASSWORD
- name : Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Copy link
Collaborator

Choose a reason for hiding this comment

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

Extra white-space at end of line 37

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
# setup tag name
- if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
echo TAG_NAME=$(echo $GITHUB_REF | sed -e "s|refs/tags/||") >> $GITHUB_ENV
- name: Build and push BRO image
uses: docker/build-push-action@v5
with:
context: .
file: ./package/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.REPO }}/backup-restore-operator:${{ env.TAG_NAME }}
platforms: linux/amd64,linux/arm64
Loading
Loading