Update .gitea/workflows/file.txt
Some checks failed
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / build-rootfs-per-version (push) Failing after 1m14s
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / generate-changelogs (push) Has been skipped
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / build-and-push-docker-images (push) Successful in 24s
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / generate-build-info (push) Successful in 24s
Some checks failed
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / build-rootfs-per-version (push) Failing after 1m14s
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / generate-changelogs (push) Has been skipped
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / build-and-push-docker-images (push) Successful in 24s
Build, Upload RootFS, and Push Docker Images, update changelog, update build info. / generate-build-info (push) Successful in 24s
This commit is contained in:
@@ -4,40 +4,94 @@ VERSIONS: "buster bullseye bookworm"
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
build-and-push-rootfs-archives:
|
||||||
|
runs-on: vm-docker-build2
|
||||||
|
outputs:
|
||||||
|
archives_changed: ${{ steps.commit_archives.outputs.archives_changed }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout source
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Create output directory
|
||||||
|
run: mkdir -p ./output
|
||||||
|
|
||||||
|
- name: Build all Debian rootfs versions into volumes and extract
|
||||||
|
run: |
|
||||||
|
versions=($VERSIONS)
|
||||||
|
for version in "${versions[@]}"; do
|
||||||
|
echo "[INFO] Building $version..."
|
||||||
|
volume_name="build_output_$version"
|
||||||
|
docker volume create "$volume_name"
|
||||||
|
|
||||||
|
docker build --build-arg VERSION=$version -t fithwum/debian-$version-base .
|
||||||
|
|
||||||
# docker run --rm --privileged \
|
docker run --rm --privileged \
|
||||||
# -v "$(pwd)":/output \
|
-v "$volume_name:/output" \
|
||||||
# fithwum/debian-$version-base \
|
-e VERSION="$version" \
|
||||||
# bash base-image-script/debian-${version}-pt1.sh
|
fithwum/debian-$version-base \
|
||||||
|
bash -c "/scripts/bootstrap-rootfs.sh \"$version\""
|
||||||
|
|
||||||
# TARBALL="debian-${version}.tar.bz2"
|
# Extract the output file from the volume
|
||||||
# if [ -f "$TARBALL" ]; then
|
container_id=$(docker create -v "$volume_name:/output" debian)
|
||||||
# mkdir -p "./$version"
|
mkdir -p ./output/$version
|
||||||
# mv "$TARBALL" "./$version/"
|
docker cp "$container_id:/output/$version/debian-$version.tar.bz2" ./output/$version/
|
||||||
# echo "[INFO] Moved $TARBALL to $version/"
|
docker rm "$container_id"
|
||||||
# else
|
done
|
||||||
# echo "[ERROR] Expected tarball not found at ./$TARBALL"
|
|
||||||
# exit 1
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# echo "[DEBUG] Checking host output dir: ./$version"
|
- name: Validate that archives exist for each version
|
||||||
# ls -lh "./$version" || echo "[WARN] No folder or files in ./$version"
|
run: |
|
||||||
# done
|
IFS=' ' read -r -a versions <<< "$VERSIONS"
|
||||||
|
for version in "${versions[@]}"; do
|
||||||
|
path="./output/$version/debian-$version.tar.bz2"
|
||||||
|
if [[ ! -f "$path" ]]; then
|
||||||
|
echo "[ERROR] Missing archive: $path"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "[OK] Found: $path"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# for version in "${versions[@]}"; do
|
- name: Clone upload repo
|
||||||
# docker build --build-arg VERSION=$version -t fithwum/debian-$version-base .
|
run: |
|
||||||
|
GIT_CREDENTIAL="${{ secrets.GIT_TOKEN || secrets.GIT_PASSWORD }}"
|
||||||
# docker run --rm --privileged \
|
git clone --depth=1 "https://${{ env.GIT_USERNAME }}:${GIT_CREDENTIAL}@gitea.fithwum.tech/fithwum/debian-base.git" upload-repo
|
||||||
# -v "$(pwd)":/output \
|
|
||||||
# fithwum/debian-$version-base \
|
|
||||||
# bash base-image-script/debian-${version}_pt1.sh
|
|
||||||
|
|
||||||
# echo "[DEBUG] Checking host output dir: ./$version"
|
- name: Clean old archives in upload-repo
|
||||||
# ls -lh "./$version" || echo "[WARN] No folder or files in ./$version"
|
run: rm -rfv upload-repo/*/*.tar.bz2
|
||||||
# done
|
|
||||||
|
|
||||||
|
- name: Copy new archives to upload-repo
|
||||||
|
run: |
|
||||||
|
for filepath in ./output/*/debian-*.tar.bz2; do
|
||||||
|
version_dir=$(basename "$(dirname "$filepath")")
|
||||||
|
mkdir -p "upload-repo/$version_dir"
|
||||||
|
cp "$filepath" "upload-repo/$version_dir/"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Calculate and store sha256sums in upload-repo
|
||||||
|
run: |
|
||||||
|
cd upload-repo
|
||||||
|
rm -f sha256sums.txt
|
||||||
|
for tarball in */debian-*.tar.bz2; do
|
||||||
|
echo "[INFO] Processing: $tarball"
|
||||||
|
checksum=$(sha256sum "$tarball" | awk '{print $1}')
|
||||||
|
echo "$checksum $tarball" >> sha256sums.txt
|
||||||
|
done
|
||||||
|
echo "[INFO] SHA256 contents:"
|
||||||
|
cat sha256sums.txt
|
||||||
|
|
||||||
|
- name: Commit and push files if changed
|
||||||
|
id: commit_archives
|
||||||
|
run: |
|
||||||
|
cd upload-repo
|
||||||
|
git config --global user.name "${{ env.GIT_USERNAME }}"
|
||||||
|
git config --global user.email "${{ env.GIT_EMAIL }}"
|
||||||
|
|
||||||
|
if git status --porcelain | grep .; then
|
||||||
|
git add **/*.tar.bz2 sha256sums.txt || true
|
||||||
|
git commit -m "Update base images and checksum on $(date -u +'%Y-%m-%dT%H:%M:%SZ') [skip ci]"
|
||||||
|
git push
|
||||||
|
echo "archives_changed=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "[INFO] No changes to commit."
|
||||||
|
echo "archives_changed=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user