Merge pull request #9266 from Icinga/feature/subscription

GHA: build RHEL and Amazon Linux
This commit is contained in:
Julian Brost 2022-03-02 09:09:07 +01:00 committed by GitHub
commit ab70178bb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 35 additions and 7 deletions

View File

@ -9,24 +9,39 @@ on:
jobs: jobs:
rpm: rpm:
name: .rpm name: .rpm (${{ matrix.distro.name }}, ${{ matrix.distro.release }})
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
distro: distro:
- name: rhel
release: 8
subscription: true
- name: rhel
release: 7
subscription: true
- name: centos - name: centos
release: 7 release: 7
subscription: false
- name: amazon-linux
release: al2:x86_64
subscription: true
- name: fedora - name: fedora
release: 35 release: 35
subscription: false
- name: fedora - name: fedora
release: 34 release: 34
subscription: false
- name: sles - name: sles
release: '15.3' release: '15.3'
subscription: true
- name: sles - name: sles
release: '12.5' release: '12.5'
subscription: true
- name: opensuse - name: opensuse
release: '15.3' release: '15.3'
subscription: false
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -41,10 +56,10 @@ jobs:
- name: Vars - name: Vars
id: vars id: vars
env: env:
GITLAB_REGISTRY_RO_TOKEN: '${{ secrets.GITLAB_REGISTRY_RO_TOKEN }}' GITLAB_RO_TOKEN: '${{ secrets.GITLAB_RO_TOKEN }}'
run: | 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 if [ "$(tr -d '\n' <<<"$GITLAB_RO_TOKEN" |wc -c)" -eq 0 ]; then
echo '::set-output name=CAN_BUILD::false' echo '::set-output name=CAN_BUILD::false'
echo '::set-output name=NEED_LOGIN::false' echo '::set-output name=NEED_LOGIN::false'
else else
@ -63,17 +78,30 @@ jobs:
- name: Login - name: Login
if: "steps.vars.outputs.NEED_LOGIN == 'true'" if: "steps.vars.outputs.NEED_LOGIN == 'true'"
env: env:
GITLAB_REGISTRY_RO_TOKEN: '${{ secrets.GITLAB_REGISTRY_RO_TOKEN }}' GITLAB_RO_TOKEN: '${{ secrets.GITLAB_RO_TOKEN }}'
run: | 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 - name: rpm-icinga2
if: "steps.vars.outputs.CAN_BUILD == 'true'" if: "steps.vars.outputs.CAN_BUILD == 'true' && !matrix.distro.subscription"
run: | run: |
set -exo pipefail set -exo pipefail
git clone https://git.icinga.com/packaging/rpm-icinga2.git git clone https://git.icinga.com/packaging/rpm-icinga2.git
chmod o+w rpm-icinga2 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 <<EOF >~/.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 - name: Restore/backup ccache
if: "steps.vars.outputs.CAN_BUILD == 'true'" if: "steps.vars.outputs.CAN_BUILD == 'true'"
id: ccache id: ccache