Skip to content

Commit

Permalink
Tickets/dm 40678 (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
fjammes authored Oct 4, 2023
2 parents 35f97be + fc2f851 commit 5a120cf
Show file tree
Hide file tree
Showing 28 changed files with 356 additions and 242 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: "Reusable workflow for qserv-operator build"

on:
workflow_call:

jobs:
build:
name: Build image
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Uninstall go provided by Ubuntu
run: |
sudo apt-get remove golang-go
sudo apt-get remove --auto-remove golang-go
sudo apt-get purge golang-go
- uses: actions/setup-go@v3
with:
go-version: '^1.19.2'
- run: go version
- name: Install go dependencies
run: |
go install golang.org/x/tools/cmd/goimports@latest
- name: Declare Version Variables
id: vars
shell: bash
run: |
OP_VERSION="$(git describe --always)"
echo "OP_IMAGE=$(. ./env.build.sh && echo $OP_IMAGE)" >> $GITHUB_ENV
echo "OP_IMAGE=${OP_IMAGE}"
- name: Install pre-requisites for build (Operator SDK)
run: ./prereq-build.sh
- name: Run Unit Tests
run: make test
- name: Build operator image
run: |
go mod download
./build.sh
mkdir -p artifacts
docker save "${{ env.OP_IMAGE }}" > artifacts/qserv-operator-image.tar
echo "${{ env.OP_IMAGE }}" > artifacts/qserv-operator-image-tag
- uses: actions/upload-artifact@v2
with:
name: docker-artifact
path: artifacts
image-analysis:
name: Analyze image
runs-on: ubuntu-22.04
permissions:
security-events: write
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download image
uses: actions/download-artifact@v3
with:
name: docker-artifact
path: artifacts
- name: Load image in local registry
run: |
docker load --input artifacts/qserv-operator-image.tar
echo "OP_IMAGE=$(cat artifacts/qserv-operator-image-tag)" >> $GITHUB_ENV
- name: Scan operator image
uses: anchore/scan-action@v3
id: scan
with:
image: "${{ env.OP_IMAGE }}"
acs-report-enable: true
fail-build: false
- name: Display SARIF report
run: |
cat ${{ steps.scan.outputs.sarif }}
- name: upload Anchore scan SARIF report
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ${{ steps.scan.outputs.sarif }}
154 changes: 0 additions & 154 deletions .github/workflows/ci.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/itest-full.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Qserv e2e workflow for all results protocols (http, ssi, xroot)"
on:
schedule:
# At 05:00 UTC on every day-of-week from Monday through Friday.
- cron: '0 5 * * 1-5'
pull_request:
branches:
- main

jobs:
build:
uses: ./.github/workflows/build.yml
e2e-matrix:
strategy:
max-parallel: 1
matrix:
results_protocol: [results_protocol_xroot, results_protocol_ssi, results_protocol_http]
uses: ./.github/workflows/itest.yml
needs: build
with:
results_protocol: ${{ matrix.results_protocol }}
17 changes: 17 additions & 0 deletions .github/workflows/itest-http.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Qserv e2e workflow for HTTP results protocol"
on:
push:

jobs:
build:
uses: ./.github/workflows/build.yml
e2e:
uses: ./.github/workflows/itest.yml
needs: build
with:
results_protocol: "results_protocol_http"
push:
name: Push qserv-operator image to public registry
uses: ./.github/workflows/push.yml
needs: e2e
secrets: inherit
62 changes: 62 additions & 0 deletions .github/workflows/itest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "Reusable workflow for qserv-operator e2e tests"

on:
workflow_call:
inputs:
results_protocol:
required: true
type: string

env:
RESULTS_PROTOCOL: ${{ inputs.results_protocol }}

jobs:
e2e:
name: Run e2e tests
runs-on: ubuntu-22.04
env:
GHA_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: apparmor
run: |
set -x
sudo apt-get remove mysql-server --purge
sudo apt-get install apparmor-profiles
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
- uses: actions/setup-go@v3
with:
go-version: '^1.19.2'
- run: go version
- name: Install go dependencies
run: |
go install golang.org/x/tools/cmd/goimports@latest
- name: Download qserv-operator image
uses: actions/download-artifact@v3
with:
name: docker-artifact
path: artifacts
- name: Create k8s/kind cluster
run: |
go install github.com/k8s-school/[email protected]
k8s-toolbox create -s
- name: Load container image inside kind
run: |
kind load image-archive artifacts/qserv-operator-image.tar
echo "OP_IMAGE=$(cat artifacts/qserv-operator-image-tag)" >> $GITHUB_ENV
- run: |
kubectl get nodes
- name: Install pre-requisites (cert-manager, kustomize)
run: ./prereq-install.sh
- name: Deploy operator
run: |
export OP_IMAGE="${{ env.OP_IMAGE }}"
./deploy.sh
- name: Deploy Qserv
run: kubectl apply -k manifests/"${{ env.RESULTS_PROTOCOL }}"
- name: Wait for Qserv to start
run: ./tests/tools/wait-qserv-ready.sh -v
- name: Run E2E Tests
run: ./tests/e2e/integration.sh

27 changes: 27 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Reusable workflow for qserv-operator build"

on:
workflow_call:

jobs:
push:
name: Push qserv-operator image to public registry
runs-on: ubuntu-22.04
steps:
- name: Download qserv-operator image
uses: actions/download-artifact@v3
with:
name: docker-artifact
path: artifacts
- name: Load image in local registry
run: |
docker load --input artifacts/qserv-operator-image.tar
echo "IMAGE=$(cat artifacts/qserv-operator-image-tag)" >> $GITHUB_ENV
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push image to Docker Hub
run: |
docker push ${{ env.IMAGE }}
Loading

0 comments on commit 5a120cf

Please sign in to comment.