Skip to content

OPCT-289: migrating openshift-tests plugin implementation to Go #305

OPCT-289: migrating openshift-tests plugin implementation to Go

OPCT-289: migrating openshift-tests plugin implementation to Go #305

Workflow file for this run

---
name: CI Plugin workflow
on:
pull_request:
push:
tags:
- 'v*.*.*'
env:
REGISTRY_USER: opct+github_opct_plugins
REGISTRY_ADDR: quay.io
jobs:
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Shellcheck - hack
uses: azohra/shell-linter@latest
with:
path: "hack/*.sh"
- name: Shellcheck - Plugin - openshift-tests
uses: azohra/shell-linter@latest
with:
path: './openshift-tests-provider-cert/plugin/*.sh'
- name: Shellcheck - Plugin - openshift-tests - hack
uses: azohra/shell-linter@latest
with:
path: './openshift-tests-provider-cert/hack/*.sh'
#
# Build container image
#
build-container:
name: release container(devel)
if: ${{ github.event_name == 'pull_request' && github.base_ref == 'main' }}
runs-on: ubuntu-22.04
needs: [linters]
env:
VERSION: "v0.0.0-devel-pr.${{ github.event.pull_request.number }}"
TOOLS_REPO: localhost/tools
PLUGIN_TESTS_REPO: localhost/plugin-openshift-tests
MGM_REPO: localhost/must-gather-monitoring
#environment: production
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Log in to Quay.io
uses: redhat-actions/podman-login@v1
with:
username: ${{ env.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASS }}
registry: ${{ env.REGISTRY_ADDR }}
# # https://github.com/marketplace/actions/podman-login
# - name: Log in to Quay.io
# uses: redhat-actions/podman-login@v1
# with:
# username: ${{ env.PROD_QUAY_USER }}
# password: ${{ env.PROD_QUAY_PASS }}
# registry: quay.io
- name: Build and publish container images
shell: bash
run: |
#echo "> Logging to Quay.io and user [${{ env.OPCT_USER }}]:"
##podman login -u="${{ env.OPCT_USER }}" -p="${{ env.OPCT_PASS }}" quay.io
echo "> Build and publish container image:"
bash ./hack/build-all.sh
# # TODO1: arm64 environment on Github Actions is not working.
# # manual steps is required:
# # $ make build-arch-arm64 VERSION=${VERSION}
# # $ make push-manifests VERSION=${VERSION}
#
# # TODO2: Quay login is not working for newer steps. Secrets are returning empty values.
#
# image is not working with podman
# - uses: uraimo/run-on-arch-action@v2
# name: Build images arm64
# id: build
# with:
# arch: aarch64
# distro: ubuntu20.04
# shell: /bin/bash
# env: |
# VERSION: "v0.0.0-devel-pr.${{ github.event.pull_request.number }}"
# TOOLS_REPO: localhost/tools
# PLUGIN_TESTS_REPO: localhost/plugin-openshift-tests
# MGM_REPO: localhost/must-gather-monitoring
# run: |
# apt-get update \
# && apt -y install build-essential lsb-release curl gpg
# # https://podman.io/docs/installation
# mkdir -p /etc/apt/keyrings
# curl -fsSL "https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/Release.key" \
# | gpg --dearmor \
# | tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null
# echo \
# "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg]\
# https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/ /" \
# | tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null
# #apt-get update -qq
# apt-get -qq -y install podman
# echo "> Build and publish container image:"
# make build-arch-arm64 VERSION=${VERSION}
# - name: Build manifests
# shell: bash
# run: |
# echo "> Build and publish container image:"
# make build-manifests VERSION=${VERSION}
# - name: Push images
# shell: bash
# run: |
# echo "> PuBuild and publish manifests"
# make push-manifests VERSION=${VERSION}
# # Commenting in PR
- name: Find comment
uses: peter-evans/find-comment@v2
id: fbc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- id-build-comment -->'
- name: Create comment
# if: steps.fbc.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
<!-- id-build-comment -->
Images built:
- Tools: [quay.io/opct/tools:${{ env.VERSION }}](https://quay.io/repository/opct/tools?tab=tags)
- Plugin openshift-tests: [quay.io/opct/plugin-openshift-tests:${{ env.VERSION }}](https://quay.io/repository/opct/plugin-openshift-tests?tab=tags)
- Must-Gather Monitoring: [quay.io/opct/must-gather-monitoring:${{ env.VERSION }}](https://quay.io/repository/opct/must-gather-monitoring?tab=tags)
reactions: rocket
#
# Releasing: triggered when a tag is created
#
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs:
- build-container
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set vars
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Push Container image
env:
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
QUAY_USER: ${{ secrets.QUAY_USER }}
QUAY_PASS: ${{ secrets.QUAY_PASS }}
run: |
podman login -u="${QUAY_USER}" -p="${QUAY_PASS}" quay.io
cd openshift-tests-provider-cert/;
make release VERSION=$RELEASE_VERSION
# 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:
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
with:
body: |
## Changelog
Image published to [quay.io/ocp-cert/openshift-tests-provider-cert:$RELEASE_VERSION](https://quay.io/repository/ocp-cert/openshift-tests-provider-cert?tab=tags)
${{steps.github_release.outputs.changelog}}