RHEL 8 compose trigger #3419
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
--- | |
name: RHEL 8 compose trigger | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 1 * * *' | |
- cron: '0 13 * * *' | |
env: | |
COMPOSE_URL_810: "http://${{ secrets.DOWNLOAD_NODE }}/rhel-8/nightly/updates/RHEL-8" | |
jobs: | |
check-compose: | |
# Do not run this job on any fork repos | |
if: github.repository == 'virt-s1/rhel-edge' | |
runs-on: container-runner | |
container: quay.io/fedora/fedora:38-x86_64 | |
steps: | |
- uses: actions/checkout@v3 | |
- run: sudo dnf install -y gh | |
- name: Check RHEL 8.10 compose | |
id: check_compose_id_810 | |
run: | | |
curl -s ${COMPOSE_URL_810}/latest-RHEL-8.10.0/STATUS --output STATUS_810 | |
STATUS_810=$(cat STATUS_810) | |
if [[ "$STATUS_810" == "FINISHED" ]]; then | |
curl -s ${COMPOSE_URL_810}/latest-RHEL-8.10.0/COMPOSE_ID --output COMPOSE_ID_810 | |
COMPOSE_ID_810=$(cat COMPOSE_ID_810) | |
TESTED_COMPOSE_810=( $( cat compose/compose.810 ) ) | |
if [[ " ${TESTED_COMPOSE_810[*]} " =~ "$COMPOSE_ID_810" ]]; then | |
COMPOSE_ID_810="false" | |
fi | |
else | |
COMPOSE_ID_810="false" | |
fi | |
if [[ "$COMPOSE_ID_810" != "false" ]]; then | |
gh pr list -R virt-s1/rhel-edge --state open --json title --jq '.[].title' > PR_LIST_810 | |
PR_LIST_810=$(cat PR_LIST_810) | |
if [[ $PR_LIST_810 == *"$COMPOSE_ID_810"* ]]; then | |
echo "pr_running_810=true" >> $GITHUB_OUTPUT | |
else | |
echo "pr_running_810=false" >> $GITHUB_OUTPUT | |
fi | |
OSBUILD_VERSION_810=$(curl -s "${COMPOSE_URL_810}/${COMPOSE_ID_810}/compose/AppStream/x86_64/os/Packages/" | grep -ioE ">osbuild-[0-9].*<" | tr -d "><") | |
OSBUILD_COMPOSER_VERSION_810=$(curl -s "${COMPOSE_URL_810}/${COMPOSE_ID_810}/compose/AppStream/x86_64/os/Packages/" | grep -ioE ">osbuild-composer-[0-9].*<" | tr -d "><") | |
COMPOSER_CLI_VERSION_810=$(curl -s "${COMPOSE_URL_810}/${COMPOSE_ID_810}/compose/AppStream/x86_64/os/Packages/" | grep -ioE ">weldr-client-[0-9].*<" | tr -d "><") | |
echo "osbuild_version_810=$OSBUILD_VERSION_810" >> $GITHUB_OUTPUT | |
echo "osbuild_composer_version_810=$OSBUILD_COMPOSER_VERSION_810" >> $GITHUB_OUTPUT | |
echo "composer_cli_version_810=$COMPOSER_CLI_VERSION_810" >> $GITHUB_OUTPUT | |
else | |
echo "osbuild_version_810=Null" >> $GITHUB_OUTPUT | |
echo "osbuild_composer_version_810=Null" >> $GITHUB_OUTPUT | |
echo "composer_cli_version_810=Null" >> $GITHUB_OUTPUT | |
fi | |
echo "rhel810_compose=$COMPOSE_ID_810" >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
outputs: | |
rhel810_compose: ${{ steps.check_compose_id_810.outputs.rhel810_compose }} | |
osbuild_version_810: ${{ steps.check_compose_id_810.outputs.osbuild_version_810 }} | |
osbuild_composer_version_810: ${{ steps.check_compose_id_810.outputs.osbuild_composer_version_810 }} | |
composer_cli_version_810: ${{ steps.check_compose_id_810.outputs.composer_cli_version_810 }} | |
pr_running_810: ${{ steps.check_compose_id_810.outputs.pr_running_810 }} | |
rhel-8-10: | |
needs: check-compose | |
if: ${{ needs.check-compose.outputs.rhel810_compose != 'false' && needs.check-compose.outputs.pr_running_810 == 'false' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Add new compose id in compose.810 | |
run: | | |
compose_id="${{ needs.check-compose.outputs.rhel810_compose }}" | |
echo $compose_id >> compose/compose.810 | |
cat compose/compose.810 | |
- name: Get current date | |
id: date | |
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: "${{ needs.check-compose.outputs.rhel810_compose }} - ${{ steps.date.outputs.date }}" | |
committer: cloudkitebot <[email protected]> | |
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
branch: cpr | |
branch-suffix: random | |
delete-branch: true | |
title: "${{ needs.check-compose.outputs.rhel810_compose }} - ${{ steps.date.outputs.date }}" | |
labels: auto-merge,RHEL-8.10.0 | |
body: | | |
RHEL 8.10 compose ${{ needs.check-compose.outputs.rhel810_compose }} | |
- Date: ${{ steps.date.outputs.date }} | |
- Packages: | |
- ${{ needs.check-compose.outputs.osbuild_version_810 }} | |
- ${{ needs.check-compose.outputs.osbuild_composer_version_810 }} | |
- ${{ needs.check-compose.outputs.composer_cli_version_810 }} | |
- name: Enable Pull Request Automerge | |
if: steps.cpr.outputs.pull-request-operation == 'created' | |
uses: peter-evans/enable-pull-request-automerge@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} | |
merge-method: rebase | |
- name: Add a comment to trigger test workflow | |
uses: peter-evans/create-or-update-comment@v1 | |
with: | |
token: ${{ secrets.PAT }} | |
issue-number: ${{ steps.cpr.outputs.pull-request-number }} | |
body: /test-rhel-8-10 |