Skip to content

Commit

Permalink
Merge pull request #1169 from flatcar/krnowak/image-changes
Browse files Browse the repository at this point in the history
Generate reports for OEM and base sysext images, allow reports against last nightly
  • Loading branch information
krnowak authored Nov 24, 2023
2 parents 3882897 + 3d4ddf8 commit 7b19e92
Show file tree
Hide file tree
Showing 6 changed files with 665 additions and 209 deletions.
60 changes: 8 additions & 52 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
sudo rm /bin/sh
sudo ln -s /bin/bash /bin/sh
sudo apt-get update
sudo apt-get install -y ca-certificates curl git gnupg lsb-release python3 qemu-user-static zstd
sudo apt-get install -y ca-certificates curl git gnupg lsb-release python3 python3-packaging qemu-user-static zstd
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
Expand Down Expand Up @@ -187,56 +187,6 @@ jobs:
--output_root="${CI_CONTAINER_ARTIFACT_ROOT}" \
prodtar container
- name: Generate reports
shell: bash
run: |
set -euo pipefail
set -x
source ci-automation/image_changes.sh
channel=alpha
vernum=$(source sdk_container/.repo/manifests/version.txt; echo "${FLATCAR_VERSION}")
board="${arch}-usr"
package_diff_env=(
"FROM_B=file://${PWD}/artifacts/${arch}-usr/latest"
# BOARD_B and CHANNEL_B are unused.
)
package_diff_params_b=(
# The package-diff script appends version to the file
# URL, but the directory with the image has no version
# component at its end, so we use . as a version.
'.'
)
size_changes_env=(
# Nothing to add.
)
size_changes_params_b=(
"local:${PWD}/artifacts/${arch}-usr/latest"
)
show_changes_env=(
# Nothing to add.
"SCRIPTS_REPO=scripts"
"COREOS_OVERLAY_REPO=coreos-overlay"
"PORTAGE_STABLE_REPO=portage-stable"
)
show_changes_params_overrides=(
# We may not have a tag handy, so we tell show-changes
# to use git HEAD as a reference to new changelog
# entries.
'NEW_VERSION=HEAD'
)
# Parent directory of the scripts repo, required by some other
# script.
work_directory='..'
generate_image_changes_report \
"${arch}" "${channel}" "${vernum}" 'image-changes-reports.txt' "../flatcar-build-scripts" "${work_directory}" \
"${package_diff_env[@]}" --- "${package_diff_params_b[@]}" -- \
"${size_changes_env[@]}" --- "${size_changes_params_b[@]}" -- \
"${show_changes_env[@]}" --- "${show_changes_params_overrides[@]}"
- name: Build VM image(s)
shell: bash
run: |
Expand Down Expand Up @@ -283,6 +233,12 @@ jobs:
mv * ../../images/
)
- name: Generate reports against last release
run: .github/workflows/image_changes.sh ${{ matrix.arch }} release

- name: Generate reports against last nightly
run: .github/workflows/image_changes.sh ${{ matrix.arch }} nightly

- name: Upload binpkgs
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -328,7 +284,7 @@ jobs:
retention-days: 7
name: ${{ matrix.arch }}-image-changes-reports
path: |
scripts/image-changes-reports.txt
scripts/image-changes-reports*.txt
# Clean up what we uploaded already so the "vendor images" wildcard
# works when uploading artifacts in the next step.
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/image_changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

set -x
set -euo pipefail

source ci-automation/image_changes.sh

# Callback invoked by run_image_changes_job, read its docs to learn
# about the details about the callback.
function github_ricj_callback() {
package_diff_env+=(
"FROM_B=file://${PWD}/artifacts/images"
# BOARD_B and CHANNEL_B are unused.
)
package_diff_params+=(
# The package-diff script appends version to the file
# URL, but the directory with the image has no version
# component at its end, so we use . as a version.
'.'
)
# Nothing to add to size changes env.
size_changes_params+=(
"local:${PWD}/artifacts/images"
)
show_changes_env+=(
# Override the default locations of repositories.
"SCRIPTS_REPO=."
"COREOS_OVERLAY_REPO=../coreos-overlay"
"PORTAGE_STABLE_REPO=../portage-stable"
)
show_changes_params+=(
# We may not have a tag handy, so we tell show-changes
# to use git HEAD as a reference to new changelog
# entries.
'NEW_VERSION=HEAD'
)
}

arch=${1}; shift
mode=${1}; shift
report_file_name="image-changes-reports-${mode}.txt"

run_image_changes_job "${arch}" "${mode}" "${report_file_name}" '../flatcar-build-scripts' github_ricj_callback
11 changes: 11 additions & 0 deletions ci-automation/base_sysexts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Definitions of base sysexts to be built. Used by image.sh and
# image_changes.sh.

if [[ ${1:-} = 'local' ]]; then
local ciabs_base_sysexts
fi

ciabs_base_sysexts=(
'containerd-flatcar:app-containers/containerd'
'docker-flatcar:app-containers/docker'
)
5 changes: 5 additions & 0 deletions ci-automation/image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ function _image_build_impl() {

apply_local_patches

source ci-automation/base_sysexts.sh 'local'
local base_sysexts_param
base_sysexts_param=$(export IFS=,; echo "${ciabs_base_sysexts[*]}")

# build image and related artifacts
./run_sdk_container -x ./ci-cleanup.sh -n "${image_container}" -C "${packages_image}" \
-v "${vernum}" \
Expand All @@ -96,6 +100,7 @@ function _image_build_impl() {
./run_sdk_container -n "${image_container}" -C "${packages_image}" \
-v "${vernum}" \
./build_image --board="${arch}-usr" --group="${channel}" \
--base_sysexts="${base_sysexts_param}" \
--output_root="${CONTAINER_IMAGE_ROOT}" \
--only_store_compressed \
prodtar container
Expand Down
Loading

0 comments on commit 7b19e92

Please sign in to comment.