Skip to content
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
72 changes: 72 additions & 0 deletions .github/workflows/build-roxie-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Build Roxie Image

on:
workflow_call:
outputs:
image:
description: "Built image with tag"
value: ${{ jobs.build-roxie-image.outputs.image }}

env:
REGISTRY: quay.io
IMAGE_NAME: rhacs-eng/roxie

jobs:
build-roxie-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
outputs:
image: ${{ steps.meta.outputs.tags }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true

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

- name: Log in to Quay.io
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}

- name: Get build metadata
id: build-meta
run: |
echo "version=$(make version)" >> $GITHUB_OUTPUT
echo "build_date=$(make get-build-date)" >> $GITHUB_OUTPUT

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: type=raw,value=${{ steps.build-meta.outputs.version }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
ROXIE_VERSION=${{ steps.build-meta.outputs.version }}
BUILD_DATE=${{ steps.build-meta.outputs.build_date }}
cache-from: |
type=gha
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: type=gha,mode=max
27 changes: 27 additions & 0 deletions .github/workflows/create-dev-cluster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Create Dev Cluster

on:
workflow_call:
inputs:
cluster-name:
required: true
type: string
outputs:
cluster-name:
description: "Name of the created cluster"
value: ${{ jobs.create-dev-cluster.outputs.cluster-name }}

jobs:
create-dev-cluster:
runs-on: ubuntu-latest
outputs:
cluster-name: ${{ inputs.cluster-name }}
steps:
- uses: stackrox/actions/infra/create-cluster@v1
with:
flavor: gke-default
name: ${{ inputs.cluster-name }}
args: machine-type=e2-standard-4,nodes=3,gcp-image-type=ubuntu_containerd
lifespan: "2h"
wait: true
token: ${{ secrets.INFRA_CI_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/delete-dev-cluster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Delete Dev Cluster

on:
workflow_call:
inputs:
cluster-name:
required: true
type: string

jobs:
delete-dev-cluster:
runs-on: ubuntu-latest
env:
INFRA_TOKEN: ${{ secrets.INFRA_CI_TOKEN }}
steps:
- name: Install infractl
uses: stackrox/actions/infra/install-infractl@v1

- name: Delete cluster
run: |
"$HOME/.local/bin/infractl" delete "${{ inputs.cluster-name }}"
101 changes: 101 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: E2E Tests

on:
workflow_call:
inputs:
cluster-name:
required: true
type: string
image:
required: true
type: string
env:
REGISTRY: quay.io
IMAGE_NAME: rhacs-eng/roxie

jobs:
e2e-tests:
runs-on: ubuntu-latest
container:
image: quay.io/stackrox-io/apollo-ci:stackrox-test-0.5.11
env:
CLUSTER_NAME: ${{ inputs.cluster-name }}
KUBECONFIG: /github/home/artifacts/kubeconfig
INFRA_TOKEN: ${{ secrets.INFRA_CI_TOKEN }}
INFRACTL: bin/infractl -k -e localhost:8443
USE_GKE_GCLOUD_AUTH_PLUGIN: "True"
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Fix repository ownership
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Log in to Quay.io
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}

- name: Extract roxie binary from image
run: |
docker create --name roxie-extract "${{ inputs.image }}"
docker cp roxie-extract:/usr/local/bin/roxie "$GITHUB_WORKSPACE/roxie"
docker rm roxie-extract

- name: Install roxie binary
run: |
cp "${GITHUB_WORKSPACE}/roxie" /usr/local/bin/roxie
chmod +x /usr/local/bin/roxie
roxie version

- name: Install roxctl
env:
ROXCTL_VERSION: "4.10.0"
ROXCTL_SHA256: "5db647b14569465866c0162522e83393ebf02f671f4556b1b3ed551b9f8433bc"
run: |
curl -fsSLo /usr/local/bin/roxctl \
"https://mirror.openshift.com/pub/rhacs/assets/${ROXCTL_VERSION}/bin/Linux/roxctl"
echo "${ROXCTL_SHA256} /usr/local/bin/roxctl" | sha256sum -c -
chmod +x /usr/local/bin/roxctl
roxctl version

- name: Authenticate to GCloud
uses: google-github-actions/auth@v3
with:
credentials_json: ${{ secrets.ROXIE_CI_AUTOMATION_GCP_SA }}

- name: Set up Cloud SDK
uses: "google-github-actions/setup-gcloud@v3"
with:
install_components: "gke-gcloud-auth-plugin"

- name: Download production infractl
uses: stackrox/actions/infra/install-infractl@v1

- name: Download artifacts
run: |
/github/home/.local/bin/infractl artifacts "$CLUSTER_NAME" -d /github/home/artifacts >> "$GITHUB_STEP_SUMMARY"

- name: Testing cluster connection
run: |
kubectl get namespaces

- name: Run e2e tests
env:
REGISTRY_USERNAME: ${{ secrets.QUAY_RHACS_ENG_RO_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.QUAY_RHACS_ENG_RO_PASSWORD }}
SKIP_OLM_TESTS: "true"
run: |
make run-test-e2e

- name: Run integration tests
env:
REGISTRY_USERNAME: ${{ secrets.QUAY_RHACS_ENG_RO_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.QUAY_RHACS_ENG_RO_PASSWORD }}
run: |
make test-integration
42 changes: 42 additions & 0 deletions .github/workflows/main-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Main

on:
push:
branches: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
unit-tests:
uses: ./.github/workflows/unit-tests.yml

create-dev-cluster:
uses: ./.github/workflows/create-dev-cluster.yml
with:
cluster-name: infra-roxie-main-${{ github.run_number }}
secrets: inherit

build-roxie-image:
uses: ./.github/workflows/build-roxie-image.yml
permissions:
contents: read
packages: write
secrets: inherit

e2e-tests:
needs: [ create-dev-cluster, build-roxie-image ]
uses: ./.github/workflows/e2e-tests.yml
with:
cluster-name: ${{ needs.create-dev-cluster.outputs.cluster-name }}
image: ${{ needs.build-roxie-image.outputs.image }}
secrets: inherit

delete-dev-cluster:
if: ${{ always() && needs.create-dev-cluster.result == 'success' }}
needs: [ create-dev-cluster, e2e-tests ]
uses: ./.github/workflows/delete-dev-cluster.yml
with:
cluster-name: ${{ needs.create-dev-cluster.outputs.cluster-name }}
secrets: inherit
42 changes: 42 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: PR

on:
pull_request:
branches: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
unit-tests:
uses: ./.github/workflows/unit-tests.yml

create-dev-cluster:
uses: ./.github/workflows/create-dev-cluster.yml
with:
cluster-name: infra-roxie-pr-${{ github.event.pull_request.number }}
secrets: inherit

build-roxie-image:
uses: ./.github/workflows/build-roxie-image.yml
permissions:
contents: read
packages: write
secrets: inherit

e2e-tests:
needs: [ create-dev-cluster, build-roxie-image ]
uses: ./.github/workflows/e2e-tests.yml
with:
cluster-name: ${{ needs.create-dev-cluster.outputs.cluster-name }}
image: ${{ needs.build-roxie-image.outputs.image }}
secrets: inherit

delete-dev-cluster:
if: ${{ always() && needs.create-dev-cluster.result == 'success' }}
needs: [ create-dev-cluster, e2e-tests ]
uses: ./.github/workflows/delete-dev-cluster.yml
with:
cluster-name: ${{ needs.create-dev-cluster.outputs.cluster-name }}
secrets: inherit
28 changes: 0 additions & 28 deletions .github/workflows/test.yml

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Unit Tests

on:
workflow_call:

jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true

- name: Check go.mod tidiness
run: |
go mod tidy
if ! git diff --exit-code go.mod go.sum; then
echo "::error::go.mod or go.sum are not tidy. Please run 'go mod tidy' and commit the changes."
exit 1
fi

- name: Run unit tests
run: make test
Loading
Loading