-
Notifications
You must be signed in to change notification settings - Fork 13
161 lines (149 loc) · 5.35 KB
/
build.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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
---
name: Build
permissions:
issues: write
pull-requests: read
contents: read
on:
workflow_dispatch:
inputs:
keep_workdir:
description: set to anything to keep around the work directory for inspection after the job finishes
required: false
extract_install_logs:
description: set to anything to save anaconda logs and remove from rpm/iso
required: false
finalbuild:
description: set to True for a final build
required: true
default: "False"
checkiso:
description: set to anything to verify the ISO
required: false
push:
branches: [master]
schedule:
# Running every morning in EMEA timezone
- cron: '0 6 * * *'
jobs:
set-kernel:
strategy:
matrix:
name: [el8, el9]
runs-on: [image-builders, "${{ matrix.name }}"]
steps:
- name: mount /host/modules
run: |
echo "Kernel version $(uname -r)"
mkdir -p /host/modules
umount -f /host/modules 2>/dev/null || true
mount --bind /lib/modules/$(uname -r) /host/modules
build-matrix:
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- name: el8
container-name: el8stream
- name: el9
container-name: el9stream
runs-on: [image-builders, "${{ matrix.name }}"]
needs: set-kernel
container:
image: quay.io/ovirt/buildcontainer:${{ matrix.container-name }}
volumes:
- /host/modules:/host/modules
options: --privileged
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build
env:
EXTRACT_INSTALL_LOGS: ${{ github.event.inputs.extract_install_logs }}
FINALBUILD: ${{ github.event.inputs.finalbuild }}
CHECK_ISO: ${{ github.event.inputs.checkiso }}
SUPERMIN_MODULES: /host/modules
SUPERMIN_KERNEL: /host/modules/vmlinuz
run: ./build.sh
- name: Upload rpm to resources.ovirt.org
uses: ovirt/ovirt-resources-upload-action@main
with:
username: ${{ secrets.SSH_USERNAME_FOR_RESOURCES_OVIRT_ORG }}
key: ${{ secrets.SSH_KEY_FOR_RESOURCES_OVIRT_ORG }}
known_hosts: ${{ secrets.KNOWN_HOSTS_FOR_RESOURCES_OVIRT_ORG }}
source: tmp.repos/RPMS/noarch/*.rpm
target: github-ci/ovirt-node-ng-image/${{ matrix.name }}
cleanup: yes
createrepo: yes
delete_before_upload: yes
# keep 10 last builds + repodata
keep_files_count: 11
- name: Upload iso to resources.ovirt.org
uses: ovirt/ovirt-resources-upload-action@main
with:
username: ${{ secrets.SSH_USERNAME_FOR_RESOURCES_OVIRT_ORG }}
key: ${{ secrets.SSH_KEY_FOR_RESOURCES_OVIRT_ORG }}
known_hosts: ${{ secrets.KNOWN_HOSTS_FOR_RESOURCES_OVIRT_ORG }}
source: ovirt-node-ng-installer-*.iso
target: github-ci/ovirt-node-ng-image
cleanup: yes
createrepo: no
delete_before_upload: yes
# keep 20 last builds
keep_files_count: 20
- name: Upload logs and manifests to github
uses: actions/upload-artifact@v3
with:
name: "logs-and-manifests${{ matrix.name }}"
path: |
exported-artifacts
- name: Clean up mount and entire workdir
if: always()
run: |
umount -f /host/modules
[[ -z "${{ github.event.inputs.keep_workdir }}" ]] && rm -rf $PWD/*
close-build-issue-on-success:
name: Report workflow success
runs-on: ubuntu-latest
needs:
- build-matrix
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Add a comment about successful job and close issue
run: |
set -e
LABEL="build-failed"
ISSUENO=$(gh issue list -l $LABEL | awk ' { print $1 } ' | head -n 1)
if [ -n "$ISSUENO" ]; then
MESSAGE="✅ The oVirt Node build CI job is now [successful](https://github.com/oVirt/ovirt-node-ng-image/actions/runs/${{ github.run_id }}), closing issue."
gh issue comment "${ISSUENO}" --body "${MESSAGE}"
gh issue close "${ISSUENO}"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
open-build-issue-on-failure:
name: Report workflow failure
runs-on: ubuntu-latest
if: ${{ always() && (needs.build-matrix.result=='failure') }}
needs:
- build-matrix
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Add a comment about failed job
run: |
set -e
TITLE="Failed oVirt Node build job"
LABEL="build-failed"
ISSUENO=$(gh issue list -l $LABEL | awk ' { print $1 } ' | head -n 1)
if [ -z "$ISSUENO" ]; then
MESSAGE="❌ The oVirt Node build CI job failed. [Please investigate.](https://github.com/oVirt/ovirt-node-ng-image/actions/runs/${{ github.run_id }})"
gh issue create --title "${TITLE}" --body "${MESSAGE}" --label "${LABEL}"
else
MESSAGE="❌ oVirt Node build CI job is still failing. [Please investigate.](https://github.com/oVirt/ovirt-node-ng-image/actions/runs/${{ github.run_id }})"
gh issue comment "${ISSUENO}" --body "${MESSAGE}"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}