Fix the ARCH thing ... can't always run go in GHA #2
This file contains 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
# Add a comment to force a change. | ||
name: Webhook CI | ||
on: | ||
workflow_call: | ||
push: | ||
branches: | ||
- release/v* | ||
paths-ignore: | ||
- '*.md' | ||
- '.gitignore' | ||
- 'CODEOWNERS' | ||
- 'LICENSE' | ||
pull_request: | ||
paths-ignore: | ||
- '*.md' | ||
- '.gitignore' | ||
- 'CODEOWNERS' | ||
- 'LICENSE' | ||
permissions: | ||
contents: read | ||
jobs: | ||
build: | ||
name: CI | ||
runs-on : ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- platform: linux/amd64 | ||
# - platform: linux/arm64 | ||
steps: | ||
- name : Checkout repository | ||
uses : actions/checkout@v4 | ||
with : | ||
fetch-depth : 0 | ||
- name : build | ||
run : make build | ||
- name : package for ci | ||
run : make package-for-ci | ||
- name : Save builds | ||
run : | | ||
mkdir -p dist/artifacts | ||
cp bin/* dist/artifacts/ | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: webhook-build-artifacts | ||
path: ./dist/artifacts | ||
####TODO: reinstate this | ||
#### - name : CI | ||
#### run : make ci | ||
#### name: webhook-build-artifacts-${{ matrix.os }} | ||
test: | ||
name : integration-test | ||
needs : [ | ||
build | ||
] | ||
runs-on : ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- platform: linux/amd64 | ||
# - platform: linux/arm64 | ||
steps: | ||
- name : Checkout repository | ||
uses : actions/checkout@v4 | ||
with : | ||
fetch-depth : 0 | ||
- name : Checkout rancher/rancher and build the chart | ||
run: | | ||
pushd "${{ runner.temp}}" | ||
git clone https://github.com/rancher/rancher.git rancherDir | ||
cd rancherDir | ||
git checkout release/v2.9 | ||
./scripts/chart/build chart | ||
tar cfz "${{ runner.temp }}/rancher.tgz" -C build/chart/rancher . | ||
popd | ||
- name : Fetch build artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: webhook-build-artifacts | ||
#### reinstate | ||
#### name: webhook-build-artifacts-${{ matrix.os }} | ||
path: ./dist/artifacts | ||
- name : Debug | ||
run : ls -R ./dist/artifacts | ||
- name : Retrieve builds | ||
run : | | ||
mkdir -p bin | ||
for x in rancher-webhook-integration.test webhook ; do | ||
if [ -e "dist/artifacts/$x" ] ; then | ||
cp "dist/artifacts/$x" bin/ | ||
fi | ||
done | ||
ls ./bin | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Build image | ||
uses: docker/build-push-action@v5.1.0 | ||
with: | ||
context: . | ||
tags: ghcr.io/rancher/webhook:${{ github.sha }} | ||
load: true | ||
push: false | ||
file: package/Dockerfile | ||
build-args: | | ||
TAG=${{ github.sha }} | ||
REPO=ghcr.io/rancher/webhook | ||
COMMIT=${{ github.sha }} | ||
- name : install K3d | ||
run : ./.github/workflows/scripts/install-k3d.sh | ||
- name : setup cluster | ||
run : ./.github/workflows/scripts/setup-cluster.sh | ||
env: | ||
CLUSTER_NAME: webhook | ||
K3S_VERSION: v1.28.9-k3s1 | ||
ARCH=linux/amd64 # TODO: set this to strategy.matrix.platform or something like that | ||
- name : start rancher | ||
run : ./.github/workflows/scripts/start-rancher.sh | ||
env: | ||
VERSION: "2.9" | ||
RANCHER_IMAGE_TAG: "v2.9.0-alpha2" | ||
CHART_PATH: "${{ runner.temp }}/rancher.tgz " | ||
- name : Run integration tests | ||
run : ./.github/workflows/scripts/integration-test-ci | ||
env: | ||
CLUSTER_NAME: webhook | ||
IMAGE_REPO: ghcr.io/rancher/webhook | ||
IMAGE_TAG: "${{ github.sha }}" | ||