-
Notifications
You must be signed in to change notification settings - Fork 25
77 lines (70 loc) · 2.64 KB
/
build_reusable.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
on:
workflow_call:
inputs:
archs:
description: "Build image for defined architectures. Must be comma-separated list of architectures."
required: false
default: "amd64,ppc64le"
type: string
tags:
description: "Tags to be used for the image. Must be space separated list of tags."
required: true
type: string
push:
description: "Determine if image should be pushed into registry. By default image will be only built and tested locally."
required: false
type: boolean
default: false
jobs:
build_container_image:
name: Build and check main image
runs-on: ubuntu-latest
steps:
- name: Check out Docker file code in the root directory
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static podman
- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: konflux-test
tags: ${{ inputs.tags }}
archs: ${{ inputs.archs }}
containerfiles: |
./Dockerfile
- name: Selfcheck - Integration test inside the image
run: |
archs="${{ inputs.archs }}"
for i in ${archs//,/$IFS}
do
echo "START of testing architecture ${arch}"
podman run --arch "${arch}" --rm -t ${{ steps.build-image.outputs.image-with-tag }} /selftest.sh
echo "END of testing for architecture ${arch}"
echo
done
- name: Push To deprecated appstudio quay.io
id: push-to-quay
if: ${{ inputs.push }}
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: quay.io/redhat-appstudio
username: ${{ secrets.KONFLUX_TEST_QUAY_USER }}
password: ${{ secrets.KONFLUX_TEST_QUAY_TOKEN }}
- name: Push To quay.io
id: push-to-quay-konflux-ci
if: ${{ inputs.push }}
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: quay.io/konflux-ci
username: ${{ secrets.KONFLUX_CI_TEST_QUAY_USER }}
password: ${{ secrets.KONFLUX_CI_TEST_QUAY_TOKEN }}
- name: Print image url
if: ${{ inputs.push }}
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }} and ${{ steps.push-to-quay-konflux-ci.outputs.registry-paths }}"