Skip to content

Commit 89f0cba

Browse files
committed
.github/ci: Deduplicate the image changes job
1 parent 0490c9c commit 89f0cba

File tree

2 files changed

+74
-112
lines changed

2 files changed

+74
-112
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -234,120 +234,10 @@ jobs:
234234
)
235235
236236
- name: Generate reports against last release
237-
shell: bash
238-
run: |
239-
set -euo pipefail
240-
set -x
241-
242-
source ci-automation/image_changes.sh
243-
244-
git_tag=''
245-
git_tag_for_release . git_tag
246-
declare -a var_names=(
247-
package_diff_env package_diff_params
248-
size_changes_env size_changes_params
249-
show_changes_env show_changes_params
250-
)
251-
declare -a "${var_names[@]}"
252-
version_description=''
253-
var_names+=( version_description )
254-
255-
prepare_env_vars_and_params_for_release "${arch}" "${git_tag}" "${var_names[@]}"
256-
257-
package_diff_env+=(
258-
"FROM_B=file://${PWD}/artifacts/images"
259-
# BOARD_B and CHANNEL_B are unused.
260-
)
261-
package_diff_params+=(
262-
# The package-diff script appends version to the file
263-
# URL, but the directory with the image has no version
264-
# component at its end, so we use . as a version.
265-
'.'
266-
)
267-
# Nothing to add to size changes env.
268-
size_changes_params+=(
269-
"local:${PWD}/artifacts/images"
270-
)
271-
show_changes_env+=(
272-
# Override the default locations of repositories.
273-
"SCRIPTS_REPO=."
274-
"COREOS_OVERLAY_REPO=../coreos-overlay"
275-
"PORTAGE_STABLE_REPO=../portage-stable"
276-
)
277-
show_changes_params+=(
278-
# We may not have a tag handy, so we tell show-changes
279-
# to use git HEAD as a reference to new changelog
280-
# entries.
281-
'NEW_VERSION=HEAD'
282-
)
283-
284-
declare -a oemids base_sysexts
285-
get_oem_id_list . "${arch}" oemids
286-
get_base_sysext_list . "${arch}" base_sysexts
287-
generate_image_changes_report \
288-
"${version_description}" 'image-changes-reports-release.txt' "../flatcar-build-scripts" \
289-
"${package_diff_env[@]}" --- "${package_diff_params[@]}" -- \
290-
"${size_changes_env[@]}" --- "${size_changes_params[@]}" -- \
291-
"${show_changes_env[@]}" --- "${show_changes_params[@]}" -- \
292-
"${oemids[@]}" -- "${base_sysexts[@]}"
237+
run: .github/workflows/image_changes.sh release
293238

294239
- name: Generate reports against last nightly
295-
shell: bash
296-
run: |
297-
set -euo pipefail
298-
set -x
299-
300-
source ci-automation/image_changes.sh
301-
302-
git_tag=''
303-
git_tag_for_nightly . git_tag
304-
declare -a var_names=(
305-
package_diff_env package_diff_params
306-
size_changes_env size_changes_params
307-
show_changes_env show_changes_params
308-
)
309-
declare -a "${var_names[@]}"
310-
version_description=''
311-
var_names+=( version_description )
312-
313-
prepare_env_vars_and_params_for_bincache "${arch}" "${git_tag}" "${var_names[@]}"
314-
315-
package_diff_env+=(
316-
"FROM_B=file://${PWD}/artifacts/images"
317-
# BOARD_B and CHANNEL_B are unused.
318-
)
319-
package_diff_params+=(
320-
# The package-diff script appends version to the file
321-
# URL, but the directory with the image has no version
322-
# component at its end, so we use . as a version.
323-
'.'
324-
)
325-
# Nothing to add to size changes env.
326-
size_changes_params+=(
327-
"local:${PWD}/artifacts/images"
328-
)
329-
show_changes_env+=(
330-
# Override the default locations of repositories.
331-
"SCRIPTS_REPO=."
332-
"COREOS_OVERLAY_REPO=../coreos-overlay"
333-
"PORTAGE_STABLE_REPO=../portage-stable"
334-
)
335-
show_changes_params+=(
336-
# We may not have a tag handy, so we tell show-changes
337-
# to use git HEAD as a reference to new changelog
338-
# entries.
339-
'NEW_VERSION=HEAD'
340-
)
341-
342-
declare -a oemids base_sysexts
343-
get_oem_id_list . "${arch}" oemids
344-
get_base_sysext_list . "${arch}" base_sysexts
345-
generate_image_changes_report \
346-
"${version_description}" 'image-changes-reports-release.txt' "../flatcar-build-scripts" \
347-
"${package_diff_env[@]}" --- "${package_diff_params[@]}" -- \
348-
"${size_changes_env[@]}" --- "${size_changes_params[@]}" -- \
349-
"${show_changes_env[@]}" --- "${show_changes_params[@]}" -- \
350-
"${oemids[@]}" -- "${base_sysexts[@]}"
240+
run: .github/workflows/image_changes.sh nightly
351241

352242
- name: Upload binpkgs
353243
uses: actions/upload-artifact@v3

.github/workflows/image_changes.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/bash
2+
3+
set -x
4+
set -euo pipefail
5+
6+
mode=${1}; shift
7+
case ${mode} in
8+
release|nightly)
9+
:
10+
;;
11+
*)
12+
echo "invalid mode ${mode@Q}" >&2
13+
exit 1
14+
;;
15+
esac
16+
17+
git_tag_for_mode="git_tag_for_${mode}"
18+
prepare_env_vars_and_params_for_mode="prepare_env_vars_and_params_for_${mode}"
19+
report_file_name="image-changes-reports-${mode}.txt"
20+
21+
source ci-automation/image_changes.sh
22+
23+
git_tag=''
24+
"${git_tag_for_mode}" . git_tag
25+
26+
declare -a var_names=(
27+
package_diff_env package_diff_params
28+
size_changes_env size_changes_params
29+
show_changes_env show_changes_params
30+
)
31+
declare -a "${var_names[@]}"
32+
version_description=''
33+
var_names+=( version_description )
34+
35+
"${prepare_env_vars_and_params_for_mode}" "${arch}" "${git_tag}" "${var_names[@]}"
36+
37+
package_diff_env+=(
38+
"FROM_B=file://${PWD}/artifacts/images"
39+
# BOARD_B and CHANNEL_B are unused.
40+
)
41+
package_diff_params+=(
42+
# The package-diff script appends version to the file
43+
# URL, but the directory with the image has no version
44+
# component at its end, so we use . as a version.
45+
'.'
46+
)
47+
# Nothing to add to size changes env.
48+
size_changes_params+=(
49+
"local:${PWD}/artifacts/images"
50+
)
51+
show_changes_env+=(
52+
# Override the default locations of repositories.
53+
"SCRIPTS_REPO=."
54+
"COREOS_OVERLAY_REPO=../coreos-overlay"
55+
"PORTAGE_STABLE_REPO=../portage-stable"
56+
)
57+
show_changes_params+=(
58+
# We may not have a tag handy, so we tell show-changes
59+
# to use git HEAD as a reference to new changelog
60+
# entries.
61+
'NEW_VERSION=HEAD'
62+
)
63+
64+
declare -a oemids base_sysexts
65+
get_oem_id_list . "${arch}" oemids
66+
get_base_sysext_list . "${arch}" base_sysexts
67+
generate_image_changes_report \
68+
"${version_description}" "${report_file_name}" "../flatcar-build-scripts" \
69+
"${package_diff_env[@]}" --- "${package_diff_params[@]}" -- \
70+
"${size_changes_env[@]}" --- "${size_changes_params[@]}" -- \
71+
"${show_changes_env[@]}" --- "${show_changes_params[@]}" -- \
72+
"${oemids[@]}" -- "${base_sysexts[@]}"

0 commit comments

Comments
 (0)