-
Notifications
You must be signed in to change notification settings - Fork 97
143 lines (136 loc) · 4.87 KB
/
image-arm.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
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
name: 'Push latest ARM images'
on:
push:
branches:
- master
concurrency:
group: ci-arm-${{ github.head_ref || github.ref }}-${{ github.repository }}
cancel-in-progress: true
env:
FORCE_COLOR: 1
jobs:
get-core-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- run: |
git fetch --prune --unshallow
- id: set-matrix
run: |
content=`cat ./.github/flavors-arm.json`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# end of optional handling for multi line json
echo "::set-output name=matrix::{\"include\": $content }"
# The matrix for standard (provider) images
get-standard-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: |
sudo apt update && sudo apt install -y jq
- id: set-matrix
run: |
docker run --name luet quay.io/luet/base && docker cp luet:/usr/bin/luet ./
chmod +x luet
sudo mv luet /usr/bin/luet
# Construct an array like this from the found versions:
sudo luet --config framework-profile.yaml search -o json k8s/k3s | jq '.packages | map(.version)' > k3s_versions.json
# Create a combination of flavors and k3s versions.
content=$(jq -s '. | [combinations | .[0] + {"k3s_version": .[1]}] | map(select(.frameworkonly != "true")) | map(select(.standard == "true"))' .github/flavors-arm.json k3s_versions.json)
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# end of optional handling for multi line json
echo "::set-output name=matrix::{\"include\": $content }"
build-arm-core:
uses: ./.github/workflows/reusable-docker-arm-build.yaml
secrets: inherit
with:
flavor: ${{ matrix.flavor }}
model: ${{ matrix.model }}
worker: ${{ matrix.worker }}
needs:
- get-core-matrix
strategy:
fail-fast: false
matrix: ${{fromJson(needs.get-core-matrix.outputs.matrix)}}
image_and_iso_arm64_generic:
uses: ./.github/workflows/reusable-image-and-iso-arm-generic.yaml
secrets: inherit
with:
flavor: ${{ matrix.flavor }}
needs:
- get-core-matrix
strategy:
fail-fast: false
matrix:
flavor:
- "opensuse-leap"
notify:
runs-on: ubuntu-latest
if: failure()
needs:
- build-arm-core
- image_and_iso_arm64_generic
steps:
- uses: actions/checkout@v3
- run: |
git fetch --prune --unshallow
- name: save commit-message
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} && failure()
run: echo "COMMIT_MSG=$(git log -1 --pretty=format:%s)" >> $GITHUB_ENV
- name: notify if failure
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} && failure()
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job failure on master branch for job ${{ github.job }} in workflow \"${{ github.workflow }}\"\n\nCommit message is \"${{ env.COMMIT_MSG }}\"\n\n Commit sha is <https://github.com/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>"
}
},
{
"type": "divider"
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":thisisfine: Failed Run",
"emoji": true
},
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":kairos: Repository link",
"emoji": true
},
"url": "https://github.com/${{ github.repository }}"
}
]
}
]
}