Skip to content

Use timeout utility instead of double-sub-shell hell #561

Use timeout utility instead of double-sub-shell hell

Use timeout utility instead of double-sub-shell hell #561

name: Container-tests by GitHub Action at Testing Farm
on:
issue_comment:
types:
- created
jobs:
build:
# This job only runs for '[test]' pull request comments by owner, member
name: Container-tests by GitHub Action on Testing Farm service
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
container-to-test: ["postgresql-container", "nginx-container", "s2i-perl-container", "s2i-python-container", "s2i-base-container" ]
os: ["fedora", "c9s", "rhel8", "rhel9", "c10s"]
if: |
github.event.issue.pull_request
&& (contains(github.event.comment.body, '[test]') || contains(github.event.comment.body, '[test-all]'))
&& contains(fromJson('["OWNER", "MEMBER"]'), github.event.comment.author_association)
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: "refs/pull/${{ github.event.issue.number }}/head"
- name: Set variables for Testing Farm
id: vars
run: |
api_key=${{ secrets.TF_INTERNAL_API_KEY }}
branch="master"
tf_scope="private"
tmt_repo="https://gitlab.cee.redhat.com/platform-eng-core-services/sclorg-tmt-plans"
if [ "${{ matrix.os }}" == "fedora" ] || [ "${{ matrix.os }}" == "c9s" ] || [ "${{ matrix.os }}" == "c10s" ]; then
api_key=${{ secrets.TF_PUBLIC_API_KEY }}
branch="main"
tf_scope="public"
tmt_repo="https://github.com/sclorg/sclorg-testing-farm"
if [ "${{ matrix.os }}" == "fedora" ]; then
compose="Fedora-latest"
context="Fedora"
tmt_plan="fedora"
else
if [ "${{ matrix.os }}" == "c9s" ]; then
compose="CentOS-Stream-9"
context="CentOS Stream 9"
tmt_plan="c9s"
else
compose="CentOS-Stream-10"
context="CentOS Stream 10"
tmt_plan="c10s"
fi
fi
else
if [ "${{ matrix.os }}" == "rhel8" ]; then
compose="RHEL-8.10.0-Nightly"
context="RHEL8"
tmt_plan="rhel8-docker"
else
compose="RHEL-9.4.0-Nightly"
context="RHEL9"
tmt_plan="rhel9-docker"
fi
fi
echo "api_key=$api_key" >> "$GITHUB_OUTPUT"
echo "branch=$branch" >> "$GITHUB_OUTPUT"
echo "tf_scope=$tf_scope" >> "$GITHUB_OUTPUT"
echo "tmt_repo=$tmt_repo" >> "$GITHUB_OUTPUT"
echo "compose=$compose" >> "$GITHUB_OUTPUT"
echo "context=$context" >> "$GITHUB_OUTPUT"
echo "tmt_plan=$tmt_plan" >> "$GITHUB_OUTPUT"
shell: bash
# https://github.com/sclorg/testing-farm-as-github-action
- name: Schedule tests on external Testing Farm by Testing-Farm-as-github-action
id: github_action
uses: sclorg/testing-farm-as-github-action@v1
with:
api_key: ${{ steps.vars.outputs.api_key }}
git_url: ${{ steps.vars.outputs.tmt_repo }}
git_ref: ${{ steps.vars.outputs.branch }}
tf_scope: ${{ steps.vars.outputs.tf_scope }}
tmt_plan_regex: ${{ steps.vars.outputs.tmt_plan }}
create_issue_comment: "true"
pull_request_status_name: "${{ steps.vars.outputs.context }} - ${{ matrix.container-to-test }}"
variables: "REPO_URL=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY;REPO_NAME=$GITHUB_REPOSITORY;PR_NUMBER=${{ github.event.issue.number }};OS=${{ matrix.os }};TEST_NAME=test;TESTED_IMAGE=${{ matrix.container-to-test }}"
compose: ${{ steps.vars.outputs.compose }}