From 9013ebf0fbf990e4b18d7b74308498080e201cec Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 28 Feb 2022 13:08:30 +0100 Subject: [PATCH 1/6] GHA: explicitly specify whether $DISTRO packages require subscription to have all info at one place in the file. --- .github/workflows/rpm.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rpm.yml b/.github/workflows/rpm.yml index 370834fed..3461e824c 100644 --- a/.github/workflows/rpm.yml +++ b/.github/workflows/rpm.yml @@ -17,16 +17,22 @@ jobs: distro: - name: centos release: 7 + subscription: false - name: fedora release: 35 + subscription: false - name: fedora release: 34 + subscription: false - name: sles release: '15.3' + subscription: true - name: sles release: '12.5' + subscription: true - name: opensuse release: '15.3' + subscription: false runs-on: ubuntu-latest @@ -43,7 +49,7 @@ jobs: env: GITLAB_REGISTRY_RO_TOKEN: '${{ secrets.GITLAB_REGISTRY_RO_TOKEN }}' run: | - if [ '${{ matrix.distro.name }}' = sles ]; then + if [ ${{ matrix.distro.subscription }} = true ]; then if [ "$(tr -d '\n' <<<"$GITLAB_REGISTRY_RO_TOKEN" |wc -c)" -eq 0 ]; then echo '::set-output name=CAN_BUILD::false' echo '::set-output name=NEED_LOGIN::false' From f6b194e9aeaeb517e9bbe9b1b4face9f14e74f63 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 28 Feb 2022 15:43:19 +0100 Subject: [PATCH 2/6] GHA: new subscription packages repo access token with more permissions and URL-friendlier login name. --- .github/workflows/rpm.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rpm.yml b/.github/workflows/rpm.yml index 3461e824c..77ca2da7e 100644 --- a/.github/workflows/rpm.yml +++ b/.github/workflows/rpm.yml @@ -47,10 +47,10 @@ jobs: - name: Vars id: vars env: - GITLAB_REGISTRY_RO_TOKEN: '${{ secrets.GITLAB_REGISTRY_RO_TOKEN }}' + GITLAB_RO_TOKEN: '${{ secrets.GITLAB_RO_TOKEN }}' run: | if [ ${{ matrix.distro.subscription }} = true ]; then - if [ "$(tr -d '\n' <<<"$GITLAB_REGISTRY_RO_TOKEN" |wc -c)" -eq 0 ]; then + if [ "$(tr -d '\n' <<<"$GITLAB_RO_TOKEN" |wc -c)" -eq 0 ]; then echo '::set-output name=CAN_BUILD::false' echo '::set-output name=NEED_LOGIN::false' else @@ -69,9 +69,9 @@ jobs: - name: Login if: "steps.vars.outputs.NEED_LOGIN == 'true'" env: - GITLAB_REGISTRY_RO_TOKEN: '${{ secrets.GITLAB_REGISTRY_RO_TOKEN }}' + GITLAB_RO_TOKEN: '${{ secrets.GITLAB_RO_TOKEN }}' run: | - docker login registry.icinga.com -u build-docker/sles --password-stdin <<<"$GITLAB_REGISTRY_RO_TOKEN" + docker login registry.icinga.com -u github-actions --password-stdin <<<"$GITLAB_RO_TOKEN" - name: rpm-icinga2 if: "steps.vars.outputs.CAN_BUILD == 'true'" From 8c0b118302cd26b500bf9dfe3a14b7fd96f9b158 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 28 Feb 2022 13:24:17 +0100 Subject: [PATCH 3/6] GHA: correct subscription packages repo --- .github/workflows/rpm.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rpm.yml b/.github/workflows/rpm.yml index 77ca2da7e..b4c5aa7d6 100644 --- a/.github/workflows/rpm.yml +++ b/.github/workflows/rpm.yml @@ -74,12 +74,25 @@ jobs: docker login registry.icinga.com -u github-actions --password-stdin <<<"$GITLAB_RO_TOKEN" - name: rpm-icinga2 - if: "steps.vars.outputs.CAN_BUILD == 'true'" + if: "steps.vars.outputs.CAN_BUILD == 'true' && !matrix.distro.subscription" run: | set -exo pipefail git clone https://git.icinga.com/packaging/rpm-icinga2.git chmod o+w rpm-icinga2 + - name: subscription-rpm-icinga2 + if: "steps.vars.outputs.CAN_BUILD == 'true' && matrix.distro.subscription" + env: + GITLAB_RO_TOKEN: '${{ secrets.GITLAB_RO_TOKEN }}' + run: | + set -exo pipefail + git config --global credential.helper store + cat <~/.git-credentials + https://github-actions:${GITLAB_RO_TOKEN}@git.icinga.com + EOF + git clone https://git.icinga.com/packaging/subscription-rpm-icinga2.git rpm-icinga2 + chmod o+w rpm-icinga2 + - name: Restore/backup ccache if: "steps.vars.outputs.CAN_BUILD == 'true'" id: ccache From 799f451fc85e34e12fe6077b4bf058a639919107 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 28 Feb 2022 13:26:30 +0100 Subject: [PATCH 4/6] GHA: build RHEL --- .github/workflows/rpm.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/rpm.yml b/.github/workflows/rpm.yml index b4c5aa7d6..88a42a823 100644 --- a/.github/workflows/rpm.yml +++ b/.github/workflows/rpm.yml @@ -15,6 +15,12 @@ jobs: fail-fast: false matrix: distro: + - name: rhel + release: 8 + subscription: true + - name: rhel + release: 7 + subscription: true - name: centos release: 7 subscription: false From b6d22345f262f3473779e7368e2a7a3cf4d81850 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 28 Feb 2022 13:26:47 +0100 Subject: [PATCH 5/6] GHA: build Amazon Linux --- .github/workflows/rpm.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/rpm.yml b/.github/workflows/rpm.yml index 88a42a823..61931ab42 100644 --- a/.github/workflows/rpm.yml +++ b/.github/workflows/rpm.yml @@ -24,6 +24,9 @@ jobs: - name: centos release: 7 subscription: false + - name: amazon-linux + release: al2:x86_64 + subscription: true - name: fedora release: 35 subscription: false From 3c75e09e99dc010134c3658c0383ef3d41f884b9 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Tue, 1 Mar 2022 15:37:38 +0100 Subject: [PATCH 6/6] GHA: preserve .rpm job names --- .github/workflows/rpm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rpm.yml b/.github/workflows/rpm.yml index 61931ab42..0436c8259 100644 --- a/.github/workflows/rpm.yml +++ b/.github/workflows/rpm.yml @@ -9,7 +9,7 @@ on: jobs: rpm: - name: .rpm + name: .rpm (${{ matrix.distro.name }}, ${{ matrix.distro.release }}) strategy: fail-fast: false