Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.github: Add image change reports to CI workflow #1046

Merged
merged 2 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 65 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ jobs:
run: |
sudo rm /bin/sh
sudo ln -s /bin/bash /bin/sh
sudo apt-get install -y ca-certificates curl gnupg lsb-release qemu-user-static git zstd
sudo apt-get update
sudo apt-get install -y ca-certificates curl git gnupg lsb-release python3 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 All @@ -63,11 +64,18 @@ jobs:
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

- uses: actions/checkout@v3
- name: Checkout scripts
uses: actions/checkout@v3
with:
path: scripts
fetch-depth: 0

- name: Checkout build scripts
uses: actions/checkout@v3
with:
repository: flatcar/flatcar-build-scripts
path: flatcar-build-scripts

# Hack alert: actions/checkout will check out the (disjunct) merge commit of a PR
# instead of its head commit. That commit is not connected to any branch.
# This causes breakage downstream e.g. when the devcontainer test wants to check out
Expand Down Expand Up @@ -186,6 +194,53 @@ jobs:
--output_root="${CI_CONTAINER_ARTIFACT_ROOT}" \
--torcx_root="${CI_CONTAINER_TORCX_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.
)
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 @@ -285,6 +340,14 @@ jobs:
path: |
scripts/torcx.tar

- name: Upload reports
uses: actions/upload-artifact@v3
with:
retention-days: 7
name: ${{ matrix.arch }}-image-changes-reports
path: |
scripts/image-changes-reports.txt

# Clean up what we uploaded already so the "vendor images" wildcard
# works when uploading artifacts in the next step.
- name: Remove update, generic and devcontainer images
Expand Down
Loading
Loading