-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OPCT-257: CI fix release/publish pipeline on GHA (#114)
This PR review the Github Actions (GHA) pipeline when publishing/releasing a new image when push to tags and `main` branch. Additionally, it merges the linters and e2e to a dedicated workflow definition file. It will also use the same workflow file to the entire pipeline, preventing managing many configurations for different events. Dry-run of this version is available in the following link: - Release a tag: https://github.com/redhat-openshift-ecosystem/provider-certification-tool/actions/runs/10274712671 - On a PR: https://github.com/redhat-openshift-ecosystem/provider-certification-tool/actions/runs/10274872530
- Loading branch information
Showing
5 changed files
with
358 additions
and
260 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
--- | ||
name: unit | ||
|
||
on: | ||
workflow_call: {} | ||
|
||
# golangci-lint-action requires those permissions to annotate issues in the PR. | ||
permissions: | ||
contents: read | ||
pull-requests: read | ||
|
||
env: | ||
GO_VERSION: 1.22 | ||
GOLANGCI_LINT_VERSION: v1.59 | ||
|
||
jobs: | ||
e2e-cmd_report: | ||
name: "e2e-cmd_report" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: opct-linux-amd64 | ||
path: /tmp/build/ | ||
|
||
- name: Running report | ||
env: | ||
BUCKET: openshift-provider-certification | ||
REGION: us-west-2 | ||
OPCT_MODE: v0.4.0/default | ||
EXEC_MODE: default | ||
ARTIFACT: 4.15.0-20240228-HighlyAvailable-vsphere-None.tar.gz | ||
OPCT: /tmp/build/opct-linux-amd64 | ||
run: | | ||
URI=${OPCT_MODE}/${ARTIFACT} | ||
URL=https://${BUCKET}.s3.${REGION}.amazonaws.com/${URI} | ||
echo "> Downloading sample artifact: ${URL}" | ||
wget -qO /tmp/result.tar.gz "${URL}" | ||
echo "> Setting run permissions to OPCT:" | ||
chmod u+x ${OPCT} | ||
echo "> Running OPCT report:" | ||
${OPCT} report /tmp/result.tar.gz | ||
e2e-cmd_adm-parse-etcd-logs: | ||
name: "e2e-cmd_adm-parse-etcd-logs" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: opct-linux-amd64 | ||
path: /tmp/build/ | ||
|
||
- name: Preparing testdata | ||
env: | ||
BUCKET: openshift-provider-certification | ||
REGION: us-west-2 | ||
VERSION: "testdata/must-gather-etcd-logs.tar.gz" | ||
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64 | ||
LOCAL_TEST_DATA: /tmp/must-gather.tar.gz | ||
LOCAL_TEST_DATA_DIR: /tmp/must-gather | ||
run: | | ||
URL=https://${BUCKET}.s3.${REGION}.amazonaws.com | ||
echo "> Downloading sample artifact: ${URL}/${VERSION}" | ||
wget -qO ${LOCAL_TEST_DATA} "${URL}/${VERSION}" | ||
echo "> Setting run permissions to OPCT:" | ||
chmod u+x ${CUSTOM_BUILD_PATH} | ||
echo "> Extracting testdata:" | ||
mkdir ${LOCAL_TEST_DATA_DIR} | ||
tar xfz ${LOCAL_TEST_DATA} -C ${LOCAL_TEST_DATA_DIR} | ||
- name: "e2e stdin reader: cat <etcd pod logs> | opct adm parse-etcd-logs" | ||
env: | ||
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64 | ||
TEST_DATA_DIR: /tmp/must-gather | ||
NS_PATH_ETCD: namespaces/openshift-etcd/pods | ||
LOG_PATH: etcd/etcd/logs | ||
run: | | ||
cat ${TEST_DATA_DIR}/*/*/${NS_PATH_ETCD}/*/${LOG_PATH}/*.log | \ | ||
${CUSTOM_BUILD_PATH} adm parse-etcd-logs | ||
- name: "e2e must-gather dir: opct adm parse-etcd-logs <must-gather-dir>" | ||
env: | ||
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64 | ||
TEST_DATA_DIR: /tmp/must-gather | ||
run: | | ||
${CUSTOM_BUILD_PATH} adm parse-etcd-logs ${TEST_DATA_DIR} | ||
- name: | | ||
e2e aggregate by hour: opct adm parse-etcd-logs | ||
--aggregator hour <must-gather-dir> | ||
env: | ||
OPCT: /tmp/build/opct-linux-amd64 | ||
TEST_DATA_DIR: /tmp/must-gather | ||
run: | | ||
${OPCT} adm parse-etcd-logs --aggregator hour ${TEST_DATA_DIR} | ||
- name: | | ||
e2e ignore error counters: opct adm parse-etcd-logs | ||
--skip-error-counter=true <must-gather-dir> | ||
env: | ||
OPCT: /tmp/build/opct-linux-amd64 | ||
TEST_DATA_DIR: /tmp/must-gather | ||
run: | | ||
${OPCT} adm parse-etcd-logs \ | ||
--skip-error-counter=true ${TEST_DATA_DIR} | ||
e2e-cmd_adm-parse-metrics: | ||
name: "e2e-cmd_adm-parse-metrics" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: opct-linux-amd64 | ||
path: /tmp/build/ | ||
|
||
- name: Preparing testdata | ||
env: | ||
BUCKET: openshift-provider-certification | ||
REGION: us-west-2 | ||
PREFIX: testdata/ci-external-aws-ccm_ | ||
VERSION: 1757495441294888960-artifacts_must-gather-metrics.tar.xz | ||
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64 | ||
LOCAL_TEST_DATA: /tmp/opct-metrics.tar.xz | ||
run: | | ||
DATA_VERSION=${PREFIX}${VERSION} | ||
URL=https://${BUCKET}.s3.${REGION}.amazonaws.com | ||
echo "> Downloading sample artifact: ${URL}/${DATA_VERSION}" | ||
wget -qO ${LOCAL_TEST_DATA} "${URL}/${DATA_VERSION}" | ||
echo "> Setting exec permissions to OPCT:" | ||
chmod u+x ${CUSTOM_BUILD_PATH} | ||
- name: "e2e parse metrics: opct adm parse-etcd-logs <must-gather-dir>" | ||
env: | ||
CUSTOM_BUILD_PATH: /tmp/build/opct-linux-amd64 | ||
LOCAL_TEST_DATA: /tmp/opct-metrics.tar.xz | ||
run: | | ||
${CUSTOM_BUILD_PATH} adm parse-metrics \ | ||
--input ${LOCAL_TEST_DATA} --output /tmp/metrics | ||
tree /tmp/metrics |
Oops, something went wrong.