-
Notifications
You must be signed in to change notification settings - Fork 63
111 lines (106 loc) · 3.52 KB
/
ubi8-build.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
100
101
102
103
104
105
106
107
108
109
110
111
name: Build of UBI 8 based Developer Images
on:
push:
branches: [ main ]
workflow_call:
# Map the workflow outputs to job outputs
secrets:
QUAY_USERNAME:
required: true
QUAY_PASSWORD:
required: true
outputs:
uniq_tag:
description: "The first output string"
value: ${{ jobs.build_universal_ubi8_image.outputs.output1 }}
jobs:
build_base_ubi8_image:
name: Build and publish base ubi8 image to Quay.io
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Free runner space
run: |
sudo rm -rf /usr/local/lib/android
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
quay.io/devfile/base-developer-image
flavor: |
latest=true
prefix=ubi8-,onlatest=true
tags: |
type=sha,prefix=ubi8-,format=short
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Docker Build & Push Base
uses: docker/build-push-action@v6
with:
push: ${{ github.event_name != 'pull_request' }}
provenance: false
context: base/ubi8
tags: |
quay.io/devfile/base-developer-image:latest
${{ steps.meta.outputs.tags }}
build_universal_ubi8_image:
name: Build and publish universal ubi8 image to Quay.io
runs-on: ubuntu-22.04
needs: build_base_ubi8_image
# job output for passing to mapping value (the workflow_call section)
outputs:
output1: ${{ steps.setTagName.outputs.uniq_tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Free runner space
run: |
sudo rm -rf /usr/local/lib/android
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
quay.io/devfile/universal-developer-image
flavor: |
latest=true
prefix=ubi8-,onlatest=true
tags: |
type=sha,prefix=ubi8-,format=short
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Docker Build & Push Universal
uses: docker/build-push-action@v6
with:
push: ${{ github.event_name != 'pull_request' }}
provenance: false
context: universal/ubi8
tags: |
quay.io/devfile/universal-developer-image:latest
${{ steps.meta.outputs.tags }}
- name: Get tag with uniq prefix
id: setTagName
# set the image with uniq tag prefix (for example: quay.io/..../base-developer-image:ubi8-7ad6cab) to env. var
# and define it for output. This output with tag image will be used in caller job
run: |
UNIQ_TAG_IMAGE=$(echo $DOCKER_METADATA_OUTPUT_JSON | jq .tags[0])
echo "...................$UNIQ_TAG_IMAGE"
echo "uniq_tag=$UNIQ_TAG_IMAGE" >> $GITHUB_OUTPUT