Skip to content

OPCT-257: cleanup for openshift-tests-plugin refactor on v0.5.0 (#66) #408

OPCT-257: cleanup for openshift-tests-plugin refactor on v0.5.0 (#66)

OPCT-257: cleanup for openshift-tests-plugin refactor on v0.5.0 (#66) #408

Workflow file for this run

---
# test-build-release is the main workflow which will trigger
# linters, tests, and builds for the project for all events.
# It will also trigger the release workflows when a tag is created
# or when a push is made to the main branch.
name: test-build-release
on:
pull_request:
branches:
- main
- release-*
push:
branches:
- main
- release-*
tags:
- 'v*.*.*'
jobs:
# Pre jobs: Linter
linters:
uses: ./.github/workflows/pre_linters.yaml
# Pre jobs: unit tests and integration tests
test-openshift-tests-plugin:
uses: ./.github/workflows/pre_test-openshift-tests-plugin.yaml
# Pre jobs: reviewer using reviewdog
reviewer:
uses: ./.github/workflows/reviewer.yaml
# build-container-amd64: triggered when a PR is made
build-container-amd64:
runs-on: ubuntu-latest
needs:
- linters
- test-openshift-tests-plugin
- reviewer
env:
VERSION: "v0.0.0-devel-pr.${{ github.event.pull_request.number }}"
VERSION_TOOLS: v0.4.0
PLATFORMS: linux/amd64
EXPIRATION: 1d
PUSH: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Skip login step when the PR is from external repo, where
# Secrets isnt exported.
- name: Login to Docker Hub
if: github.event.pull_request.head.repo.full_name == github.repository
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_PASS }}
- name: "Build and push: plugin-openshift-tests"
uses: docker/build-push-action@v6
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
provenance: false
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
BUILD_VERSION=${{ env.VERSION }}
tags: "localhost/plugin-openshift-tests:latest"
outputs: |
type=image,name=localhost/plugin-openshift-tests:latest,push=false
load: true
context: ./openshift-tests-plugin
file: ./openshift-tests-plugin/Containerfile
- name: show images
run: docker images
# disable while not able to access the images previously built.
# Is it possible with cache-from/to?
# - name: "Build and push: plugin-artifacts-collector"
# uses: docker/build-push-action@v6
# with:
# platforms: ${{ env.PLATFORMS }}
# push: ${{ env.PUSH }}
# labels: |
# quay.expires-after=${{ env.EXPIRATION }}
# build-args: |
# QUAY_EXPIRATION=${{ env.EXPIRATION }}
# TOOLS_VERSION=${{ env.VERSION_TOOLS }}
# tags: quay.io/opct/plugin-artifacts-collector:${{ env.VERSION }}
# context: ./artifacts-collector
# file: ./artifacts-collector/Containerfile
- name: "Build and push: must-gather-monitoring"
uses: docker/build-push-action@v6
env:
PLUGIN_IMAGE_OVERRIDE: "localhost/plugin-openshift-tests:latest"
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
provenance: false
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
tags: quay.io/opct/must-gather-monitoring:${{ env.VERSION }}
context: ./must-gather-monitoring
file: ./must-gather-monitoring/Containerfile
#
# Releasing latest: triggered when push to main
#
release-latest:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [build-container-amd64]
env:
VERSION: "latest"
PLATFORMS: linux/amd64,linux/arm64
EXPIRATION: never
PUSH: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_PASS }}
- name: "Build and push: plugin-openshift-tests"
uses: docker/build-push-action@v6
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
provenance: false
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
BUILD_VERSION=${{ env.VERSION }}
tags: quay.io/opct/plugin-openshift-tests:${{ env.VERSION }}
context: ./openshift-tests-plugin
file: ./openshift-tests-plugin/Containerfile
- name: "Build and push: plugin-artifacts-collector"
uses: docker/build-push-action@v6
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
provenance: false
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
TOOLS_VERSION=${{ env.VERSION_TOOLS }}
tags: quay.io/opct/plugin-artifacts-collector:${{ env.VERSION }}
context: ./artifacts-collector
file: ./artifacts-collector/Containerfile
- name: "Build and push: must-gather-monitoring"
uses: docker/build-push-action@v6
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
provenance: false
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
tags: quay.io/opct/must-gather-monitoring:${{ env.VERSION }}
context: ./must-gather-monitoring
file: ./must-gather-monitoring/Containerfile
#
# Releasing tag: triggered when a tag is created
#
release-tag:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [build-container-amd64]
env:
PLATFORMS: linux/amd64,linux/arm64
EXPIRATION: never
PUSH: true
PLUGIN_REPO: quay.io/opct/plugin-openshift-tests
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set vars
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_PASS }}
- name: "Build and push: plugin-openshift-tests"
uses: docker/build-push-action@v6
env:
VERSION: ${{ steps.vars.outputs.tag }}
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
provenance: false
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
BUILD_VERSION=${{ env.VERSION }}
tags: ${{ env.PLUGIN_REPO }}:${{ env.VERSION }}
context: ./openshift-tests-plugin
file: ./openshift-tests-plugin/Containerfile
- name: "Build and push: plugin-artifacts-collector"
uses: docker/build-push-action@v6
env:
VERSION: ${{ steps.vars.outputs.tag }}
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
provenance: false
labels: |-
quay.expires-after=${{ env.EXPIRATION }}
build-args: |-
BUILD_VERSION=${{ env.VERSION }}
QUAY_EXPIRATION=${{ env.EXPIRATION }}
tags: quay.io/opct/plugin-artifacts-collector:${{ env.VERSION }}
context: ./artifacts-collector
file: ./artifacts-collector/Containerfile
- name: "Build and push: must-gather-monitoring"
uses: docker/build-push-action@v6
env:
VERSION: ${{ steps.vars.outputs.tag }}
with:
platforms: ${{ env.PLATFORMS }}
push: ${{ env.PUSH }}
provenance: false
labels: |
quay.expires-after=${{ env.EXPIRATION }}
build-args: |
QUAY_EXPIRATION=${{ env.EXPIRATION }}
tags: quay.io/opct/must-gather-monitoring:${{ env.VERSION }}
context: ./must-gather-monitoring
file: ./must-gather-monitoring/Containerfile
# https://github.com/mikepenz/release-changelog-builder-action#configuration
- name: Build Changelog
id: github_release
uses: mikepenz/[email protected]
with:
configuration: ".github/workflows/changelog-configuration.json"
# https://github.com/softprops/action-gh-release
- name: Create Release on Github
uses: softprops/[email protected]
env:
VERSION: ${{ steps.vars.outputs.tag }}
REPO: quay.io/opct/plugin-openshift-tests
URL: https://quay.io/repository/opct/plugin-openshift-tests?tab=tags
with:
body: |
## Changelog
Image published to [${REPO}:${VERSION}](${URL})
${{steps.github_release.outputs.changelog}}