test build info update & changelog
Some checks failed
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / build-and-push-rootfs-archives (push) Successful in 11m52s
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / generate-changelogs (push) Successful in 1m10s
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / build-and-push-docker-images (push) Successful in 2m33s
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / generate-build-info (push) Failing after 37s
Some checks failed
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / build-and-push-rootfs-archives (push) Successful in 11m52s
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / generate-changelogs (push) Successful in 1m10s
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / build-and-push-docker-images (push) Successful in 2m33s
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / generate-build-info (push) Failing after 37s
This commit is contained in:
@@ -234,21 +234,19 @@ jobs:
|
|||||||
- name: Checkout source
|
- name: Checkout source
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Clone upload repo
|
- name: Prepare temporary build-info workspace
|
||||||
run: |
|
run: mkdir -p buildinfo
|
||||||
GIT_CREDENTIAL="${{ secrets.GIT_TOKEN || secrets.GIT_PASSWORD }}"
|
|
||||||
git clone --depth=1 "https://${{ env.GIT_USERNAME }}:${GIT_CREDENTIAL}@gitea.fithwum.tech/fithwum/debian-base.git" upload-repo
|
|
||||||
|
|
||||||
- name: Copy checksum file into workspace
|
- name: Copy sha256sums.txt if available
|
||||||
run: |
|
run: |
|
||||||
if [[ -f ../sha256sums.txt ]]; then
|
if [[ -f ../sha256sums.txt ]]; then
|
||||||
cp ../sha256sums.txt upload-repo/
|
cp ../sha256sums.txt buildinfo/
|
||||||
else
|
else
|
||||||
echo "[ERROR] sha256sums.txt missing!"
|
echo "[ERROR] sha256sums.txt missing!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Generate build-info.json per version
|
- name: Generate build-info.json files
|
||||||
run: |
|
run: |
|
||||||
human_size() {
|
human_size() {
|
||||||
local b=$1
|
local b=$1
|
||||||
@@ -263,26 +261,24 @@ jobs:
|
|||||||
printf "%s%s\n" "$b" "${S[$s]}"
|
printf "%s%s\n" "$b" "${S[$s]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
cd upload-repo
|
cd buildinfo
|
||||||
for version in $VERSIONS; do
|
for version in $VERSIONS; do
|
||||||
echo "[INFO] Generating build-info.json for $version"
|
echo "[INFO] Generating build-info.json for $version"
|
||||||
mkdir -p "$version"
|
mkdir -p "$version"
|
||||||
infofile="$version/build-info.json"
|
infofile="$version/build-info.json"
|
||||||
|
|
||||||
image="gitea.fithwum.tech/fithwum/debian-base:$version"
|
image="gitea.fithwum.tech/fithwum/debian-base:$version"
|
||||||
|
|
||||||
digest=$(docker inspect --format='{{if .RepoDigests}}{{index .RepoDigests 0}}{{else}}unknown{{end}}' "$image" 2>/dev/null || echo "unknown")
|
digest=$(docker inspect --format='{{if .RepoDigests}}{{index .RepoDigests 0}}{{else}}unknown{{end}}' "$image" 2>/dev/null || echo "unknown")
|
||||||
size_bytes=$(docker image inspect "$image" --format='{{.Size}}' 2>/dev/null || echo "0")
|
size_bytes=$(docker image inspect "$image" --format='{{.Size}}' 2>/dev/null || echo "0")
|
||||||
|
|
||||||
size_bytes=${size_bytes//[^0-9]/}
|
size_bytes=${size_bytes//[^0-9]/}
|
||||||
if [[ -z "$size_bytes" ]]; then size_bytes=0; fi
|
[[ -z "$size_bytes" ]] && size_bytes=0
|
||||||
|
|
||||||
size_human=$(human_size "$size_bytes")
|
size_human=$(human_size "$size_bytes")
|
||||||
|
|
||||||
# Load SHA256 from file if available
|
sha256="unknown"
|
||||||
SHA256=$(grep "$version/debian-$version.tar.bz2" ../sha256sums.txt | awk '{print $1}')
|
if [[ -f ../sha256sums.txt ]]; then
|
||||||
if [[ -z "$SHA256" ]]; then
|
sha256=$(grep "$version/debian-$version.tar.bz2" ../sha256sums.txt | awk '{print $1}')
|
||||||
SHA256="unknown"
|
[[ -z "$sha256" ]] && sha256="unknown"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
jq -n \
|
jq -n \
|
||||||
@@ -293,7 +289,7 @@ jobs:
|
|||||||
--arg digest "$digest" \
|
--arg digest "$digest" \
|
||||||
--arg image_size "$size_human" \
|
--arg image_size "$size_human" \
|
||||||
--argjson image_size_bytes "$size_bytes" \
|
--argjson image_size_bytes "$size_bytes" \
|
||||||
--arg sha256 "$SHA256" \
|
--arg sha256 "$sha256" \
|
||||||
'{
|
'{
|
||||||
version: $version,
|
version: $version,
|
||||||
commit: $commit,
|
commit: $commit,
|
||||||
@@ -304,7 +300,19 @@ jobs:
|
|||||||
image_size_bytes: $image_size_bytes,
|
image_size_bytes: $image_size_bytes,
|
||||||
rootfs_sha256: $sha256
|
rootfs_sha256: $sha256
|
||||||
}' > "$infofile"
|
}' > "$infofile"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Clone upload repo
|
||||||
|
run: |
|
||||||
|
GIT_CREDENTIAL="${{ secrets.GIT_TOKEN || secrets.GIT_PASSWORD }}"
|
||||||
|
git clone --depth=1 "https://${{ env.GIT_USERNAME }}:${GIT_CREDENTIAL}@gitea.fithwum.tech/fithwum/debian-base.git" upload-repo
|
||||||
|
|
||||||
|
- name: Copy build-info.json into repo
|
||||||
|
run: |
|
||||||
|
for version in $VERSIONS; do
|
||||||
|
mkdir -p "upload-repo/$version"
|
||||||
|
cp "buildinfo/$version/build-info.json" "upload-repo/$version/build-info.json"
|
||||||
|
done
|
||||||
|
|
||||||
- name: Commit and push build-info if changed
|
- name: Commit and push build-info if changed
|
||||||
run: |
|
run: |
|
||||||
@@ -317,14 +325,10 @@ jobs:
|
|||||||
git commit -m "Update build-info on $(date -u +'%Y-%m-%dT%H:%M:%SZ')"
|
git commit -m "Update build-info on $(date -u +'%Y-%m-%dT%H:%M:%SZ')"
|
||||||
git push
|
git push
|
||||||
|
|
||||||
# Tag the commit for each version
|
|
||||||
for version in $VERSIONS; do
|
for version in $VERSIONS; do
|
||||||
TAG="build-$version"
|
TAG="build-$version"
|
||||||
# Delete local tag if exists
|
|
||||||
git tag -d "$TAG" 2>/dev/null || true
|
git tag -d "$TAG" 2>/dev/null || true
|
||||||
# Create tag on current HEAD
|
|
||||||
git tag "$TAG"
|
git tag "$TAG"
|
||||||
# Push tag to remote (force in case tag exists)
|
|
||||||
git push origin "$TAG" --force
|
git push origin "$TAG" --force
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user