2024-02-19 15:13:12 +01:00
|
|
|
name: Red Hat Catalog Description
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2024-02-19 17:00:38 +01:00
|
|
|
- '[0-9]+.[0-9]+'
|
2024-02-19 15:13:12 +01:00
|
|
|
paths:
|
|
|
|
- 'Dockerfiles/*/*/README.html'
|
2024-02-19 17:00:38 +01:00
|
|
|
- 'Dockerfiles/*/*/README.md'
|
2024-02-19 15:13:12 +01:00
|
|
|
- '.github/workflows/rhel_registry_description.yml'
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
env:
|
|
|
|
DOCKERFILES_DIRECTORY: "./Dockerfiles"
|
|
|
|
API_URL: "https://catalog.redhat.com/api/containers/v1/projects/certification/id/"
|
2024-02-19 15:30:29 +01:00
|
|
|
MATRIX_FILE: "build.json"
|
2024-02-19 15:13:12 +01:00
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
init:
|
2024-02-20 07:00:36 +01:00
|
|
|
name: Initialize workflow
|
2024-02-19 15:13:12 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
2024-02-20 07:00:36 +01:00
|
|
|
outputs:
|
|
|
|
components: ${{ steps.components.outputs.list }}
|
2024-02-20 07:04:49 +01:00
|
|
|
zabbix_release: ${{ steps.branch_info.outputs.zabbix_release }}
|
2024-02-19 15:13:12 +01:00
|
|
|
steps:
|
|
|
|
- name: Block egress traffic
|
|
|
|
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
|
|
|
|
with:
|
|
|
|
disable-sudo: true
|
2024-02-19 17:20:28 +01:00
|
|
|
egress-policy: block
|
2024-02-19 15:13:12 +01:00
|
|
|
allowed-endpoints: >
|
|
|
|
github.com:443
|
|
|
|
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
2024-02-20 07:28:00 +01:00
|
|
|
sparse-checkout: ${{ env.MATRIX_FILE }}
|
|
|
|
|
|
|
|
- name: Check ${{ env.MATRIX_FILE }} file
|
|
|
|
id: build_exists
|
|
|
|
env:
|
|
|
|
MATRIX_FILE: ${{ env.MATRIX_FILE }}
|
|
|
|
run: |
|
|
|
|
if [[ ! -f "$MATRIX_FILE" ]]; then
|
|
|
|
echo "::error::File $MATRIX_FILE is missing"
|
|
|
|
exit 1
|
|
|
|
fi
|
2024-02-19 15:13:12 +01:00
|
|
|
|
|
|
|
- name: Get branch info
|
|
|
|
id: branch_info
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
github_ref: ${{ github.ref }}
|
|
|
|
run: |
|
|
|
|
result=false
|
|
|
|
|
|
|
|
github_ref=${github_ref##*/}
|
|
|
|
|
|
|
|
echo "::group::Branch metadata"
|
2024-02-20 07:09:53 +01:00
|
|
|
echo "zabbix_release=${github_ref//.}"
|
2024-02-19 15:13:12 +01:00
|
|
|
echo "::endgroup::"
|
|
|
|
|
2024-02-19 16:58:59 +01:00
|
|
|
echo "zabbix_release=${github_ref//.}" >> $GITHUB_OUTPUT
|
2024-02-19 15:13:12 +01:00
|
|
|
|
|
|
|
- name: Prepare Zabbix component list
|
|
|
|
id: components
|
|
|
|
env:
|
|
|
|
MATRIX_FILE: ${{ env.MATRIX_FILE }}
|
|
|
|
run: |
|
|
|
|
component_list=$(jq -r '.components | map_values(select(.rhel == true)) | keys | @json' "$MATRIX_FILE")
|
|
|
|
|
|
|
|
echo "::group::Zabbix Component List"
|
|
|
|
echo "$component_list"
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
echo "list=$component_list" >> $GITHUB_OUTPUT
|
|
|
|
|
2024-02-20 07:00:36 +01:00
|
|
|
publish:
|
|
|
|
name: Initialize build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: init
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2024-02-20 07:02:19 +01:00
|
|
|
component: ${{ fromJson(needs.init.outputs.components) }}
|
2024-02-20 07:00:36 +01:00
|
|
|
steps:
|
|
|
|
- name: Block egress traffic
|
|
|
|
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
|
|
|
|
with:
|
|
|
|
disable-sudo: true
|
|
|
|
egress-policy: block
|
|
|
|
allowed-endpoints: >
|
|
|
|
catalog.redhat.com:443
|
|
|
|
files.pythonhosted.org:443
|
|
|
|
github.com:443
|
|
|
|
pypi.org:443
|
|
|
|
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
|
|
|
|
2024-02-19 15:13:12 +01:00
|
|
|
- name: Variables formating
|
|
|
|
id: var_format
|
|
|
|
env:
|
2024-02-19 16:49:04 +01:00
|
|
|
MATRIX_BUILD: ${{ matrix.component }}
|
2024-02-19 15:13:12 +01:00
|
|
|
run: |
|
|
|
|
MATRIX_BUILD=${MATRIX_BUILD^^}
|
|
|
|
MATRIX_BUILD=${MATRIX_BUILD//-/_}
|
|
|
|
|
|
|
|
echo "::group::Result"
|
|
|
|
echo "matrix_build=${MATRIX_BUILD}"
|
|
|
|
echo "::endgroup::"
|
|
|
|
echo "matrix_build=${MATRIX_BUILD}" >> $GITHUB_OUTPUT
|
|
|
|
|
2024-02-19 17:20:28 +01:00
|
|
|
- name: Setup Python 3.x
|
|
|
|
uses: actions/setup-python@v4
|
2024-02-19 15:58:48 +01:00
|
|
|
with:
|
|
|
|
python-version: '3.x'
|
|
|
|
|
2024-02-19 17:20:28 +01:00
|
|
|
- name: Install Python packages
|
2024-02-19 15:58:48 +01:00
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
2024-02-19 16:30:31 +01:00
|
|
|
pip install markdown requests
|
2024-02-19 15:58:48 +01:00
|
|
|
|
2024-02-20 07:28:00 +01:00
|
|
|
- name: Update Red Hat project description
|
2024-02-19 15:13:12 +01:00
|
|
|
env:
|
2024-02-19 16:32:42 +01:00
|
|
|
DESCRIPTION_FILE: ${{ format('{0}/{1}/rhel/README', env.DOCKERFILES_DIRECTORY, matrix.component) }}
|
2024-02-20 07:14:58 +01:00
|
|
|
PROJECT_ID: ${{ secrets[format('RHEL_{0}_{1}_PROJECT', needs.init.outputs.zabbix_release, steps.var_format.outputs.matrix_build)] }}
|
2024-02-19 15:13:12 +01:00
|
|
|
PYXIS_API_TOKEN: ${{ secrets.REDHAT_API_TOKEN }}
|
|
|
|
API_URL: ${{ env.API_URL }}
|
2024-02-19 17:07:02 +01:00
|
|
|
run: |
|
|
|
|
python ./.github/scripts/rhel_description.py
|
2024-02-20 07:28:00 +01:00
|
|
|
|
|
|
|
- name: Red Hat Gatalog URL
|
|
|
|
env:
|
|
|
|
COMPONENT: ${{ matrix.component }}
|
|
|
|
MATRIX_FILE: ${{ env.MATRIX_FILE }}
|
|
|
|
run: |
|
|
|
|
PROJECT_ID=$(jq -r ".components.\"$COMPONENT\".rhel_project" "$MATRIX_FILE")
|
|
|
|
|
|
|
|
echo "::group::URL"
|
|
|
|
echo "https://catalog.redhat.com/software/containers/${PROJECT_ID}"
|
|
|
|
echo "::endgroup::"
|