-
Notifications
You must be signed in to change notification settings - Fork 55
99 lines (92 loc) · 4.03 KB
/
publish_images.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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