-
Notifications
You must be signed in to change notification settings - Fork 28
86 lines (74 loc) · 2.71 KB
/
docker-image-ci.yml
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
name: Build Docker Image - CI
on:
release:
types:
- published
push:
branches:
- main
- 'release-\d.\d\d'
jobs:
build:
name: Build and push docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set image tag
shell: bash
run: |
image_tag=latest
if [ ${{ github.ref }} != 'refs/heads/main' ]; then
branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
version_digits=$(echo ${branch} | tr -d -c 0-9)
image_tag=v$(echo ${version_digits} | cut -b 1).$(echo ${version_digits:1}).0
fi
echo "IMAGE_TAG=${image_tag}" >> $GITHUB_OUTPUT
id: set_image_tag
- name: Build docker image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: eco-gotests
tags: ${{ steps.set_image_tag.outputs.IMAGE_TAG }}
containerfiles: |
./Dockerfile
archs: amd64, arm64
- name: Push To quay.io
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: quay.io/ocp-edge-qe
username: ${{ secrets.OCP_EDGE_QE_QUAY_USER }}
password: ${{ secrets.OCP_EDGE_QE_QUAY }}
- name: Print image url
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
- name: Log in to Registry
uses: redhat-actions/podman-login@v1
with:
registry: quay.io/ocp-edge-qe/eco-gotests
username: ${{ secrets.OCP_EDGE_QE_QUAY_USER }}
password: ${{ secrets.OCP_EDGE_QE_QUAY }}
- name: Build docker eco-gotests-ran-du image
id: build-image-system
uses: redhat-actions/buildah-build@v2
with:
image: eco-gotests-ran-du
tags: ${{ steps.set_image_tag.outputs.IMAGE_TAG }}
containerfiles: |
./images/system-tests/ran-du/Dockerfile
archs: amd64, arm64
- name: Push To quay.io eco-gotests-ran-du image
id: push-to-quay-eco-gotests-ran-du
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image-system.outputs.image }}
tags: ${{ steps.build-image-system.outputs.tags }}
registry: quay.io/ocp-edge-qe
username: ${{ secrets.OCP_EDGE_QE_QUAY_USER }}
password: ${{ secrets.OCP_EDGE_QE_QUAY }}
- name: Print image url eco-gotests-ran-du
run: echo "Image pushed to ${{ steps.push-to-quay-eco-gotests-ran-du.outputs.registry-paths }}"