Merge pull request #225 from joelsmith/release2131 #109
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
name: main build | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write # needed for signing the images with GitHub OIDC Token **not production ready** | |
container: ghcr.io/kedacore/keda-tools:1.22.2 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
lfs: true | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Go modules cache | |
uses: actions/cache@v3 | |
with: | |
path: /go/pkg | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
# Username used to log in to a Docker registry. If not set then no login will occur | |
username: ${{ github.repository_owner }} | |
# Password or personal access token used to log in to a Docker registry. If not set then no login will occur | |
password: ${{ secrets.GHCR_AUTH_PAT }} | |
# Server address of Docker registry. If not set then will default to Docker Hub | |
registry: ghcr.io | |
- name: Publish on GitHub Container Registry | |
run: make publish | |
# https://github.com/sigstore/cosign-installer | |
- name: Install Cosign | |
uses: sigstore/cosign-installer@v2 | |
- name: Check Cosign install! | |
run: cosign version | |
- name: Sign KEDA images published on GitHub Container Registry | |
# This step uses the identity token to provision an ephemeral certificate | |
# against the sigstore community Fulcio instance. | |
run: make sign-images | |
deploy-test: | |
needs: Build | |
name: Deploy-test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
lfs: true | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
# Username used to log in to a Docker registry. If not set then no login will occur | |
username: ${{ github.repository_owner }} | |
# Password or personal access token used to log in to a Docker registry. If not set then no login will occur | |
password: ${{ secrets.GHCR_AUTH_PAT }} | |
# Server address of Docker registry. If not set then will default to Docker Hub | |
registry: ghcr.io | |
# homebrew (+ gcc etc.) removed from $PATH on Ubuntu images. | |
# https://github.com/actions/runner-images/issues/6283 | |
- name: Setup Homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Setup Env | |
run: sudo apt-get install gcc-11 g++ binutils libc6 | |
- name: Install operator-sdk | |
run: brew install operator-sdk | |
- name: Download opm | |
run: | | |
version=1.26.1 | |
curl -L https://github.com/operator-framework/operator-registry/releases/download/v${version}/linux-amd64-opm --output opm | |
sudo chmod +x opm | |
sudo mv opm /usr/bin | |
- name: Run functionality tests | |
run: make test-functionality | |
- name: Run audit flags tests | |
run: make test-audit | |
- name: Setup test environment for deployment tests | |
run: | | |
kind create cluster | |
OLM_VERSION=$(curl -s https://api.github.com/repos/operator-framework/operator-lifecycle-manager/releases/latest | jq -r .tag_name) | |
curl -L https://github.com/operator-framework/operator-lifecycle-manager/releases/download/$OLM_VERSION/install.sh -o install.sh | |
chmod +x install.sh | |
./install.sh $OLM_VERSION | |
- name: Build and deploy KEDA olm operator index for deployment testing | |
run: | | |
kubectl create namespace keda | |
make deploy-olm-testing | |
- name: Run deployment tests | |
run: make test-deployment | |
deploy: | |
needs: Deploy-test | |
name: Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
lfs: true | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Go modules cache | |
uses: actions/cache@v3 | |
with: | |
path: /go/pkg | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
# Username used to log in to a Docker registry. If not set then no login will occur | |
username: ${{ github.repository_owner }} | |
# Password or personal access token used to log in to a Docker registry. If not set then no login will occur | |
password: ${{ secrets.GHCR_AUTH_PAT }} | |
# Server address of Docker registry. If not set then will default to Docker Hub | |
registry: ghcr.io | |
- name: Download opm | |
run: | | |
version=1.26.1 | |
curl -L https://github.com/operator-framework/operator-registry/releases/download/v${version}/linux-amd64-opm --output opm | |
sudo chmod +x opm | |
sudo mv opm /usr/bin | |
# homebrew (+ gcc etc.) removed from $PATH on Ubuntu images. | |
# https://github.com/actions/runner-images/issues/6283 | |
- name: Setup Homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Setup Env | |
run: sudo apt-get install gcc-11 g++ binutils libc6 | |
- name: Install operator-sdk | |
run: brew install operator-sdk | |
- name: Setup cluster and olm | |
run: | | |
kind create cluster | |
OLM_VERSION=$(curl -s https://api.github.com/repos/operator-framework/operator-lifecycle-manager/releases/latest | jq -r .tag_name) | |
curl -L https://github.com/operator-framework/operator-lifecycle-manager/releases/download/$OLM_VERSION/install.sh -o install.sh | |
chmod +x install.sh | |
./install.sh $OLM_VERSION | |
- name: Disable 'replaces' field, as the testing bundle doesn't replace anything | |
run: | | |
sed -i 's/replaces: /# replaces: /' bundle/manifests/keda.clusterserviceversion.yaml | |
- name: Build and deploy KEDA olm operator index | |
run: | | |
kubectl create namespace keda | |
make deploy-olm |