Skip to content

Remove dependency on community.general.yum_versionlock module #202

Remove dependency on community.general.yum_versionlock module

Remove dependency on community.general.yum_versionlock module #202

Workflow file for this run

---
name: Run integration tests in Testing Farm
on:
# Tests that run on issue_comment are run from the main branch.
# Changes to this workflow and to tmt plans and tests need to be merged to
# main first appear in CI runs.
issue_comment:
types:
- created
permissions:
contents: read
# This is required for the ability to create/update the Pull request status
statuses: write
jobs:
debug_event:
runs-on: ubuntu-latest
steps:
- name: Dump github context
run: echo '${{ toJson(github) }}'
prepare_vars:
name: Get info from role and PR to determine if and how to test
# The concurrency key is used to prevent multiple workflows from running at the same time
concurrency:
# group name contains reponame-pr_num to allow simualteneous runs in different PRs
group: testing-farm-${{ github.event.repository.name }}-${{ github.event.issue.number }}
cancel-in-progress: true
# Let's schedule tests only on user request. NOT automatically.
# Only repository owner or member can schedule tests
if: |
github.event.issue.pull_request
&& contains(github.event.comment.body, '[citest]')
&& (contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)
|| contains('systemroller', github.event.comment.user.login))
runs-on: ubuntu-latest
outputs:
supported_platforms: ${{ steps.supported_platforms.outputs.supported_platforms }}
head_sha: ${{ steps.head_sha.outputs.head_sha }}
steps:
- name: Dump github context
run: echo "$GITHUB_CONTEXT"
shell: bash
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
- name: Checkout repo
uses: actions/checkout@v5
- name: Get head sha of the PR
id: head_sha
run: |
head_sha=$(gh api "repos/$REPO/pulls/$PR_NO" --jq '.head.sha')
echo "head_sha=$head_sha" >> $GITHUB_OUTPUT
env:
REPO: ${{ github.repository }}
PR_NO: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout PR
uses: actions/checkout@v5
with:
ref: ${{ steps.head_sha.outputs.head_sha }}
- name: Get supported platforms
id: supported_platforms
run: |
supported_platforms=""
meta_main=meta/main.yml
# All Fedora are supported, add latest Fedora versions to supported_platforms
if yq '.galaxy_info.galaxy_tags[]' "$meta_main" | grep -qi fedora$; then
supported_platforms+=" Fedora-41"
supported_platforms+=" Fedora-42"
fi
# Specific Fedora versions supported
if yq '.galaxy_info.galaxy_tags[]' "$meta_main" | grep -qiP 'fedora\d+$'; then
for fedora_ver in $(yq '.galaxy_info.galaxy_tags[]' "$meta_main" | grep -iPo 'fedora\K(\d+$)'); do
supported_platforms+=" Fedora-$fedora_ver"
done
fi
if yq '.galaxy_info.galaxy_tags[]' "$meta_main" | grep -qi el7; then
supported_platforms+=" CentOS-7"
supported_platforms+=" RHEL-7"
fi
if yq '.galaxy_info.galaxy_tags[]' "$meta_main" | grep -qi el8; then
supported_platforms+=" CentOS-Stream-8"
supported_platforms+=" RHEL-8"
fi
if yq '.galaxy_info.galaxy_tags[]' "$meta_main" | grep -qi el9; then
supported_platforms+=" CentOS-Stream-9"
supported_platforms+=" RHEL-9"
fi
echo "supported_platforms=$supported_platforms" >> $GITHUB_OUTPUT
- name: Print supported platforms
run: echo "supported_platforms=${{ steps.supported_platforms.outputs.supported_platforms }}"
testing-farm:
name: ${{ matrix.compose_managed_node }}/ansible-${{ matrix.ansible_version }}
needs: prepare_vars
strategy:
fail-fast: false
matrix:
include:
- ansible_version: 2.14
compose_controller: RHEL-9-Nightly
compose_managed_node: RHEL-7-LatestUpdated
- ansible_version: 2.16
compose_controller: RHEL-9-Nightly
compose_managed_node: RHEL-8.10.0-Nightly
- ansible_version: 2.17
compose_controller: RHEL-9-Nightly
compose_managed_node: RHEL-9.6.0-Nightly
runs-on: ubuntu-latest
steps:
- name: Set variables with DATETIME and artifact location
id: set_vars
run: |
printf -v DATETIME '%(%Y%m%d-%H%M%S)T' -1
ARTIFACTS_DIR_NAME="tf_${{ github.event.repository.name }}-${{ github.event.issue.number }}_\
${{ matrix.compose_managed_node }}-${{ matrix.ansible_version }}_$DATETIME/artifacts"
ARTIFACTS_TARGET_DIR=/srv/pub/alt/${{ vars.SR_LSR_USER }}/logs
ARTIFACTS_DIR=$ARTIFACTS_TARGET_DIR/$ARTIFACTS_DIR_NAME
ARTIFACTS_URL=https://dl.fedoraproject.org/pub/alt/${{ vars.SR_LSR_USER }}/logs/$ARTIFACTS_DIR_NAME
echo "DATETIME=$DATETIME" >> $GITHUB_OUTPUT
echo "ARTIFACTS_DIR=$ARTIFACTS_DIR" >> $GITHUB_OUTPUT
echo "ARTIFACTS_URL=$ARTIFACTS_URL" >> $GITHUB_OUTPUT
- name: Check if compose is supported
id: platform_check
run: |
platforms="${{ needs.prepare_vars.outputs.supported_platforms }}"
compose="${{ matrix.compose_managed_node }}"
is_supported="false"
# Loop through each word in the "platforms" string
for platform in $platforms; do
# Check if the compose name (e.g., "RHEL-7-LatestUpdated")
# contains the platform substring (e.g., "RHEL-7")
if [[ "$compose" == *"$platform"* ]]; then
is_supported="true"
break
fi
done
echo "is_supported=$is_supported" >> $GITHUB_OUTPUT
- name: Set commit status as pending
if: steps.platform_check.outputs.is_supported == 'true'
uses: myrotvorets/set-commit-status-action@master
with:
sha: ${{ needs.prepare_vars.outputs.head_sha }}
status: pending
context: ${{ matrix.compose_managed_node }}|ansible-${{ matrix.ansible_version }}
description: Test started
targetUrl: ""
- name: Set commit status as success with a description that platform is skipped
if: steps.platform_check.outputs.is_supported == 'false'
uses: myrotvorets/set-commit-status-action@master
with:
sha: ${{ needs.prepare_vars.outputs.head_sha }}
status: success
context: ${{ matrix.compose_managed_node }}|ansible-${{ matrix.ansible_version }}
description: The role does not support this platform. Skipping.
targetUrl: ""
- name: Check TF_API_KEY_RH
run: |
if [ -z "$TF_API_KEY_RH" ]; then
echo "TF_API_KEY_RH is empty"
else
echo "TF_API_KEY_RH is set"
fi
env:
TF_API_KEY_RH: ${{ secrets.TF_API_KEY_RH }}
- name: Run test in testing farm
# Change to the original action once this PR is merged:
# https://github.com/sclorg/testing-farm-as-github-action/pull/326
# uses: sclorg/testing-farm-as-github-action@v4
uses: spetrosi/testing-farm-as-github-action@compose-null-omit
if: steps.platform_check.outputs.is_supported == 'true'
with:
git_ref: main
pipeline_settings: '{ "type": "tmt-multihost" }'
environment_settings: '{ "provisioning": { "tags": { "BusinessUnit": "ansible_collection_leapp" } } }'
# Keeping SR_ARTIFACTS_URL at the bottom makes the link in logs clickable
variables: "SR_ANSIBLE_VER=${{ matrix.ansible_version }};\
SR_REPO_NAME=${{ github.event.repository.name }};\
SR_GITHUB_ORG=${{ github.repository_owner }};\
SR_PR_NUM=${{ github.event.issue.number }};\
SR_ARTIFACTS_DIR=${{ steps.set_vars.outputs.ARTIFACTS_DIR }};\
SR_TEST_LOCAL_CHANGES=false;\
SR_LSR_USER=${{ vars.SR_LSR_USER }};\
SR_TEST_LOCAL_CHANGES=false;\
COMPOSE_CONTROLLER=${{ matrix.compose_controller }};\
COMPOSE_MANAGED_NODE=${{ matrix.compose_managed_node }};\
RHEL_7_9_SERVER_REPO_URL=${{ secrets.RHEL_7_9_SERVER_REPO_URL }};\
RHEL_7_9_EXTRAS_REPO_URL=${{ secrets.RHEL_7_9_EXTRAS_REPO_URL }};\
RHEL_8_10_BASEOS_REPO_URL=${{ secrets.RHEL_8_10_BASEOS_REPO_URL }};\
RHEL_8_10_APPSTREAM_REPO_URL=${{ secrets.RHEL_8_10_APPSTREAM_REPO_URL }};\
RHEL_9_6_BASEOS_REPO_URL=${{ secrets.RHEL_9_6_BASEOS_REPO_URL }};\
RHEL_9_6_APPSTREAM_REPO_URL=${{ secrets.RHEL_9_6_APPSTREAM_REPO_URL }};\
RHEL_9_8_BASEOS_REPO_URL=${{ secrets.RHEL_9_8_BASEOS_REPO_URL }};\
RHEL_9_8_APPSTREAM_REPO_URL=${{ secrets.RHEL_9_8_APPSTREAM_REPO_URL }};\
RHEL_10_0_BASEOS_REPO_URL=${{ secrets.RHEL_10_0_BASEOS_REPO_URL }};\
RHEL_10_0_APPSTREAM_REPO_URL=${{ secrets.RHEL_10_0_APPSTREAM_REPO_URL }};\
BEAKERLIB_HARNESS_URL_NO_VER=${{ secrets.BEAKERLIB_HARNESS_URL_NO_VER }};\
SR_ARTIFACTS_URL=${{ steps.set_vars.outputs.ARTIFACTS_URL }}"
tmt_context: "initiator=testing-farm"
# Note that LINUXSYSTEMROLES_SSH_KEY must be single-line, TF doesn't read multi-line variables fine.
secrets: "SR_LSR_DOMAIN=${{ secrets.SR_LSR_DOMAIN }};\
SR_LSR_SSH_KEY=${{ secrets.SR_LSR_SSH_KEY }}"
compose: null
# There are two blockers for using public ranch:
# 1. multihost is not supported in public https://github.com/teemtee/tmt/issues/2620
# 2. Security issue that leaks long secrets - Jira TFT-2698
tf_scope: private
api_key: ${{ secrets.TF_API_KEY_RH }}
update_pull_request_status: false
- name: Set final commit status
uses: myrotvorets/set-commit-status-action@master
# always() is to run the step even if the previous step failed
if: always() && steps.platform_check.outputs.is_supported == 'true'
with:
sha: ${{ needs.prepare_vars.outputs.head_sha }}
status: ${{ job.status }}
context: ${{ matrix.compose_managed_node }}|ansible-${{ matrix.ansible_version }}
description: Test finished
targetUrl: ${{ steps.set_vars.outputs.ARTIFACTS_URL }}