-
Notifications
You must be signed in to change notification settings - Fork 39
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
release action: Create new release from list, include old release #40
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: Build and release Systemd sysext images | |
on: | ||
push: | ||
tags: | ||
- '*' | ||
- 'latest' | ||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
|
@@ -12,8 +12,8 @@ jobs: | |
steps: | ||
# checkout the sources | ||
- uses: actions/checkout@v3 | ||
# build the images and generate a manifest | ||
- name: build | ||
# prepare build host | ||
- name: install prerequisites | ||
run: | | ||
set -euxo pipefail | ||
|
||
|
@@ -24,70 +24,19 @@ jobs: | |
xz-utils \ | ||
gawk | ||
|
||
KBS_VERS=$(curl -fsSL --retry-delay 1 --retry 60 --retry-connrefused --retry-max-time 60 --connect-timeout 20 https://raw.githubusercontent.com/kubernetes/website/main/data/releases/schedule.yaml | yq -r '.schedules[].previousPatches[0].release' | awk '{print "kubernetes-v"$1}') | ||
[[ -z "${KBS_VERS}" ]] && echo "Failed fetching Kubernetes versions" && exit 1 | ||
- name: build release artifacts | ||
run: release_build.sh | ||
|
||
KBS_VERS_ARRAY=(${KBS_VERS}) | ||
- name: delete previous latest release | ||
uses: actions/checkout@v3 | ||
run: gh release delete latest --cleanup-tag | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
images=( | ||
"docker-24.0.9" | ||
"docker_compose-2.22.0" | ||
"wasmtime-13.0.0" | ||
) | ||
images+=("${KBS_VERS_ARRAY[@]}") | ||
|
||
streams=() | ||
|
||
for image in "${images[@]}"; do | ||
component="${image%-*}" | ||
version="${image#*-}" | ||
for arch in x86-64 arm64; do | ||
ARCH="${arch}" "./create_${component}_sysext.sh" "${version}" "${component}" | ||
mv "${component}.raw" "${image}-${arch}.raw" | ||
done | ||
streams+=("${component}:-@v") | ||
if [ "${component}" = "kubernetes" ]; then | ||
streams+=("kubernetes-${version%.*}:.@v") | ||
# Should give, e.g., v1.28 for v1.28.2 (use ${version#*.*.} to get 2) | ||
fi | ||
done | ||
for stream in "${streams[@]}"; do | ||
component="${stream%:*}" | ||
pattern="${stream#*:}" | ||
cat << EOF > "${component}.conf" | ||
[Transfer] | ||
Verify=false | ||
[Source] | ||
Type=url-file | ||
Path=https://github.com/flatcar/sysext-bakery/releases/latest/download/ | ||
MatchPattern=${component}${pattern}-%a.raw | ||
[Target] | ||
InstancesMax=3 | ||
Type=regular-file | ||
Path=/opt/extensions/${component%-*} | ||
CurrentSymlink=/etc/extensions/${component%-*}.raw | ||
EOF | ||
done | ||
|
||
cat << EOF > "noop.conf" | ||
[Source] | ||
Type=regular-file | ||
Path=/ | ||
[email protected] | ||
[Target] | ||
Type=regular-file | ||
Path=/ | ||
EOF | ||
|
||
# Fetch the current SHA256SUMS to append to it the new list of sha256 sums. | ||
curl -fsSLO https://github.com/flatcar/sysext-bakery/releases/download/latest/SHA256SUMS | ||
sha256sum *.raw >> SHA256SUMS | ||
sort --unique --key 2 --output SHA256SUMS SHA256SUMS | ||
|
||
# create a Github release with the generated artifacts | ||
- name: release | ||
- name: create a new latest release with all artifacts | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body_path: Release.md | ||
files: | | ||
SHA256SUMS | ||
*.raw | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
#!/bin/bash | ||
# | ||
# Build a bakery release of all sysexts. | ||
# | ||
# The release will include all sysexts from the "latest" release | ||
# (these will be downloaded). Sysexts listed in release_build_versions.txt | ||
# and _not_ included in the "latest" release will be built. | ||
|
||
set -euo pipefail | ||
|
||
|
||
echo | ||
echo "Fetching list of latest Kubernetes minor releases" | ||
echo "=================================================" | ||
KBS_VERS=$(curl -fsSL --retry-delay 1 --retry 60 --retry-connrefused \ | ||
--retry-max-time 60 --connect-timeout 20 \ | ||
https://raw.githubusercontent.com/kubernetes/website/main/data/releases/schedule.yaml \ | ||
| yq -r '.schedules[].previousPatches[0].release' \ | ||
| awk '{print "kubernetes-v"$1}') | ||
if [[ -z "${KBS_VERS}" ]] ; then | ||
echo "Failed fetching Kubernetes versions" | ||
exit 1 | ||
fi | ||
|
||
KBS_VERS_ARRAY=(${KBS_VERS}) | ||
printf "%s\n" "${KBS_VERS_ARRAY[@]}" | ||
|
||
echo | ||
echo "Fetching previous 'latest' release sysexts" | ||
echo "==========================================" | ||
curl -fsSL --retry-delay 1 --retry 60 --retry-connrefused \ | ||
--retry-max-time 60 --connect-timeout 20 \ | ||
https://api.github.com/repos/flatcar/sysext-bakery/releases/latest \ | ||
| jq -r '.assets[].browser_download_url' | grep -E '\.raw$' | tee prev_release_sysexts.txt | ||
|
||
for asset in $(cat prev_release_sysexts.txt); do | ||
echo | ||
echo " ## Fetching $(basename "${asset}") <-- ${asset}" | ||
wget "${asset}" | ||
done | ||
|
||
streams=() | ||
|
||
echo | ||
echo "Building sysexts" | ||
echo "================" | ||
|
||
mapfile -t images < <( awk '{ content=sub("[[:space:]]*#.*", ""); if ($0) print $0; }' \ | ||
release_build_versions.txt ) | ||
images+=("${KBS_VERS_ARRAY[@]}") | ||
|
||
echo "# Release 2024-02-01 16:44:51" > Release.md | ||
echo "The release adds the following sysexts:" >> Release.md | ||
|
||
for image in "${images[@]}"; do | ||
component="${image%-*}" | ||
version="${image#*-}" | ||
for arch in x86-64 arm64; do | ||
target="${image}-${arch}.raw" | ||
if [ -f "${target}" ] ; then | ||
echo " ## Skipping ${target} because it already exists (asset from previous release)" | ||
continue | ||
fi | ||
echo " ## Building ${target}." | ||
ARCH="${arch}" "./create_${component}_sysext.sh" "${version}" "${component}" | ||
mv "${component}.raw" "${target}" | ||
echo "* ${target}" >> Release.md | ||
done | ||
streams+=("${component}:-@v") | ||
if [ "${component}" = "kubernetes" ]; then | ||
streams+=("kubernetes-${version%.*}:.@v") | ||
# Should give, e.g., v1.28 for v1.28.2 (use ${version#*.*.} to get 2) | ||
fi | ||
done | ||
|
||
echo "" >> Release.md | ||
echo "The release includes the following sysexts from previous releases:" >> Release.md | ||
sed 's/^/* /' prev_release_sysexts.txt >> Release.md | ||
|
||
echo | ||
echo "Generating systemd-sysupdate configurations and SHA256SUM." | ||
echo "==========================================================" | ||
|
||
for stream in "${streams[@]}"; do | ||
component="${stream%:*}" | ||
pattern="${stream#*:}" | ||
cat << EOF > "${component}.conf" | ||
[Transfer] | ||
Verify=false | ||
[Source] | ||
Type=url-file | ||
Path=https://github.com/flatcar/sysext-bakery/releases/latest/download/ | ||
MatchPattern=${component}${pattern}-%a.raw | ||
[Target] | ||
InstancesMax=3 | ||
Type=regular-file | ||
Path=/opt/extensions/${component%-*} | ||
CurrentSymlink=/etc/extensions/${component%-*}.raw | ||
EOF | ||
done | ||
|
||
cat << EOF > "noop.conf" | ||
[Source] | ||
Type=regular-file | ||
Path=/ | ||
[email protected] | ||
[Target] | ||
Type=regular-file | ||
Path=/ | ||
EOF | ||
|
||
# Generate new SHA256SUMS from all assets | ||
sha256sum *.raw | tee SHA256SUMS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Versions to build. | ||
|
||
# For Kubernetes, we fetch the latest versions to be built. | ||
# The below lists _additional_ kubernetes versions to be built. | ||
|
||
kubernetes-v1.28.5 # required for CAPO CI | ||
|
||
|
||
|
||
docker-24.0.9 # Used in README.md. Update readme when version changes. | ||
docker-25.0.2 | ||
|
||
docker_compose-2.22.0 | ||
docker_compose-2.24.5 | ||
|
||
wasmtime-12.0.0 | ||
wasmtime-13.0.0 # Used in README.md. Update readme when version changes. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improvement: Also release on a weekly cadence
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, and should we always release
main
? Maybe a new action could run on every push and create alatest
tag and trigger this action here (I think it won't get invoked by another workflow as this is a mechanism to prevent recursion).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually, yes. For this (and the weekly build cadence) to add value we should first make the build auto-detect new versions for all sysexts (like it does for Kubernetes already): I've opened a tracking issue for that: #42