-
Notifications
You must be signed in to change notification settings - Fork 23
129 lines (112 loc) · 4.35 KB
/
Copy pathedpm-bootc.yaml
File metadata and controls
129 lines (112 loc) · 4.35 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: edpm-bootc image builder
on:
push:
branches:
- '*'
paths:
- bootc/**
- .github/workflows/edpm-bootc.yaml
workflow_dispatch:
env:
imageregistry: 'quay.io'
imagenamespace: ${{ secrets.IMAGENAMESPACE || secrets.QUAY_USERNAME }}
latesttag: latest
podified: current-podified
EDPM_BASE_IMAGE: quay.io/centos-bootc/centos-bootc:stream9
jobs:
check-secrets:
runs-on: ubuntu-latest
steps:
- name: Check secrets are set
id: have-secrets
if: "${{ env.imagenamespace != '' }}"
run: echo "ok=true" >> $GITHUB_OUTPUT
outputs:
have-secrets: ${{ steps.have-secrets.outputs.ok }}
build-edpm-bootc:
name: Build edpm-bootc using Makefile
runs-on: ubuntu-latest
needs: [check-secrets]
if: needs.check-secrets.outputs.have-secrets == 'true'
defaults:
run:
shell: bash
working-directory: ./bootc
steps:
- uses: actions/checkout@v4
- name: Set latest tag for non main branch
if: github.ref_name != 'main'
env:
BRANCH_NAME: ${{ github.ref_name }}
run: |
echo "latesttag=${BRANCH_NAME}-latest" >> $GITHUB_ENV
- name: Set EDPM_* env vars
run: |
echo "EDPM_BOOTC_REPO=${{ env.imageregistry }}/${{ env.imagenamespace }}/edpm-bootc" >> $GITHUB_ENV
echo "EDPM_BOOTC_TAG=${{ env.latesttag }}" >> $GITHUB_ENV
- name: Build output/yum.repos.d
id: build-output-yum-repos-d
run: |
podman run --rm -it -v .:/bootc:rw,z quay.io/centos/centos:stream9 /bin/bash -c "cd bootc; dnf -y install make; make output/yum.repos.d"
- name: Build and tag edpm-bootc container image
id: buildah-build-edpm-bootc
uses: redhat-actions/buildah-build@v2
with:
image: edpm-bootc
tags: ${{ env.latesttag }} ${{ github.sha }} ${{ env.podified }}
build-args:
EDPM_BASE_IMAGE=${{ env.EDPM_BASE_IMAGE }}
extra-args:
--volume /home/runner/work/edpm-image-builder/edpm-image-builder/bootc/output/yum.repos.d:/etc/yum.repos.d:rw,Z
containerfiles: |
./bootc/Containerfile
context: bootc
- name: Push edpm-bootc container image to ${{ env.imageregistry }}
id: push-edpm-bootc
uses: redhat-actions/push-to-registry@v2
with:
image: edpm-bootc
tags: ${{ env.latesttag }}
registry: ${{ env.imageregistry }}/${{ env.imagenamespace }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Print image url and digest
run: |
echo "Image pushed to ${{ steps.push-edpm-bootc.outputs.registry-paths }}"
echo "Image digest: ${{ steps.push-edpm-bootc.outputs.digest }}"
- name: bootc-image-builder edpm-bootc qcow2 image
id: edpm-bootc-qcow2-image-builder
run: |
# workaround https://github.com/containers/podman/issues/21683
sudo apt install -y sqlite3
echo "update DBConfig set GraphDriver = 'overlay' where GraphDriver = '';" | sudo sh -c '(cd /var/lib/containers/storage && sqlite3 db.sql)'
make output
# Pull the edpm-bootc container image as sudo. Previous build commands
# don't use sudo.
sudo podman pull ${{ env.imageregistry }}/${{ env.imagenamespace }}/edpm-bootc:${{ env.latesttag }}
make edpm-bootc.qcow2-no-build
make package-cp-deps
- name: Build and tag edpm-bootc qcow2 container image
id: buildah-build-edpm-bootc-qcow2
uses: redhat-actions/buildah-build@v2
with:
image: edpm-bootc
tags: ${{ env.latesttag }}-qcow2 ${{ github.sha }}-qcow2
containerfiles: |
./bootc/output/Containerfile.image
context: bootc/output
build-args: |
IMAGE_NAME=edpm-bootc
- name: Push edpm-bootc qcow2 container image to ${{ env.imageregistry }}
id: push-edpm-bootc-qcow2
uses: redhat-actions/push-to-registry@v2
with:
image: edpm-bootc
tags: ${{ env.latesttag }}-qcow2
registry: ${{ env.imageregistry }}/${{ env.imagenamespace }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Print qcow2 image url and digest
run: |
echo "Image pushed to ${{ steps.push-edpm-bootc-qcow2.outputs.registry-paths }}"
echo "Image digest: ${{ steps.push-edpm-bootc-qcow2.outputs.digest }}"