Publish OCI Images #4694
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: Publish OCI Images | |
on: | |
push: | |
branches: | |
- 3.21 | |
workflow_dispatch: | |
env: | |
COLORTERM: 'yes' | |
TERM: 'xterm-256color' | |
PYTEST_ADDOPTS: '--color=yes' | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- image: pulp-galaxy-ng | |
tag: "4.6" | |
- image: pulp | |
tag: "3.21" | |
- image: pulp-galaxy-ng | |
tag: "4.6-https" | |
- image: pulp | |
tag: "3.21-https" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Download s6-overlay | |
run: | | |
wget https://github.com/just-containers/s6-overlay/releases/download/v3.1.2.1/s6-overlay-x86_64.tar.xz | |
wget https://github.com/just-containers/s6-overlay/releases/download/v3.1.2.1/s6-overlay-noarch.tar.xz | |
wget https://github.com/just-containers/s6-overlay/releases/download/v3.1.2.1/s6-overlay-symlinks-arch.tar.xz | |
wget https://github.com/just-containers/s6-overlay/releases/download/v3.1.2.1/s6-overlay-symlinks-noarch.tar.xz | |
unxz s6-overlay*.tar.xz | |
gzip s6-overlay*.tar | |
- name: Set build args | |
if: contains(fromJSON('["4.6-https", "3.21-https"]'), matrix.tag) | |
run: | | |
echo "BUILD_ARG=--build-arg SCHEME=https" >> $GITHUB_ENV | |
echo "TEST_ARG=https" >> $GITHUB_ENV | |
- name: Build the images | |
run: | | |
docker build --file s6_images/pulp_ci_centos/Containerfile --tag pulp/pulp-ci-centos:${{ matrix.tag }} . ${{ env.BUILD_ARG }} | |
docker tag pulp/pulp-ci-centos:${{ matrix.tag }} ghcr.io/pulp/pulp-ci-centos:${{ matrix.tag }} | |
docker tag pulp/pulp-ci-centos:${{ matrix.tag }} quay.io/pulp/pulp-ci-centos:${{ matrix.tag }} | |
LOCATION="${{ matrix.image }}" | |
LOCATION=${LOCATION//-/_} | |
docker build --file "s6_images/${LOCATION}/Containerfile" --tag pulp/${{ matrix.image }}:${{ matrix.tag }} . --build-arg FROM_TAG=${{ matrix.tag }} | |
docker tag pulp/${{ matrix.image }}:${{ matrix.tag }} ghcr.io/pulp/${{ matrix.image }}:${{ matrix.tag }} | |
docker tag pulp/${{ matrix.image }}:${{ matrix.tag }} quay.io/pulp/${{ matrix.image }}:${{ matrix.tag }} | |
echo "IMAGE=$IMAGE" >> $GITHUB_ENV | |
- name: Test the images | |
run: s6_images/assets/test.sh "pulp/${{ matrix.image }}:${{ matrix.tag }}" ${{ env.TEST_ARG }} | |
- name: Github login | |
env: | |
PULP_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PULP_GITHUB_USERNAME: ${{ github.actor }} | |
run: echo "$PULP_GITHUB_TOKEN" | docker login -u "$PULP_GITHUB_USERNAME" --password-stdin ghcr.io | |
- name: Push ci image to github | |
run: | | |
docker push ghcr.io/pulp/${{ matrix.image }}:${{ matrix.tag }} | |
if [ "$IMAGE" = "pulp" ]; then | |
docker push ghcr.io/pulp/pulp-ci-centos:${{ matrix.tag }} | |
fi | |
- name: Docker login | |
env: | |
DOCKER_BOT_PASSWORD: ${{ secrets.DOCKER_BOT_PASSWORD }} | |
DOCKER_BOT_USERNAME: ${{ secrets.DOCKER_BOT_USERNAME }} | |
run: echo "$DOCKER_BOT_PASSWORD" | docker login -u "$DOCKER_BOT_USERNAME" --password-stdin docker.io | |
- name: Push ci image to dockerhub | |
run: | | |
docker push docker.io/pulp/${{ matrix.image }}:${{ matrix.tag }} | |
if [ "$IMAGE" = "pulp" ]; then | |
docker push docker.io/pulp/pulp-ci-centos:${{ matrix.tag }} | |
fi | |
- name: Quay login | |
env: | |
QUAY_BOT_PASSWORD: ${{ secrets.QUAY_BOT_PASSWORD }} | |
QUAY_BOT_USERNAME: ${{ secrets.QUAY_BOT_USERNAME }} | |
run: echo "$QUAY_BOT_PASSWORD" | docker login -u "$QUAY_BOT_USERNAME" --password-stdin quay.io | |
- name: Push ci image to quay | |
run: | | |
docker push quay.io/pulp/${{ matrix.image }}:${{ matrix.tag }} | |
if [ "$IMAGE" = "pulp" ]; then | |
docker push quay.io/pulp/pulp-ci-centos:${{ matrix.tag }} | |
fi | |
- name: Display log on error | |
if: failure() | |
run: docker logs pulp |