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 \
|
||||
# -v "$(pwd)":/output \
|
||||
# fithwum/debian-$version-base \
|
||||
# bash base-image-script/debian-${version}-pt1.sh
|
||||
docker run --rm --privileged \
|
||||
-v "$volume_name:/output" \
|
||||
-e VERSION="$version" \
|
||||
fithwum/debian-$version-base \
|
||||
bash -c "/scripts/bootstrap-rootfs.sh \"$version\""
|
||||
|
||||
# TARBALL="debian-${version}.tar.bz2"
|
||||
# if [ -f "$TARBALL" ]; then
|
||||
# mkdir -p "./$version"
|
||||
# mv "$TARBALL" "./$version/"
|
||||
# echo "[INFO] Moved $TARBALL to $version/"
|
||||
# else
|
||||
# echo "[ERROR] Expected tarball not found at ./$TARBALL"
|
||||
# exit 1
|
||||
# fi
|
||||
# Extract the output file from the volume
|
||||
container_id=$(docker create -v "$volume_name:/output" debian)
|
||||
mkdir -p ./output/$version
|
||||
docker cp "$container_id:/output/$version/debian-$version.tar.bz2" ./output/$version/
|
||||
docker rm "$container_id"
|
||||
done
|
||||
|
||||
# echo "[DEBUG] Checking host output dir: ./$version"
|
||||
# ls -lh "./$version" || echo "[WARN] No folder or files in ./$version"
|
||||
# done
|
||||
- name: Validate that archives exist for each version
|
||||
run: |
|
||||
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
|
||||
# docker build --build-arg VERSION=$version -t fithwum/debian-$version-base .
|
||||
- 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
|
||||
|
||||
# docker run --rm --privileged \
|
||||
# -v "$(pwd)":/output \
|
||||
# fithwum/debian-$version-base \
|
||||
# bash base-image-script/debian-${version}_pt1.sh
|
||||
- name: Clean old archives in upload-repo
|
||||
run: rm -rfv upload-repo/*/*.tar.bz2
|
||||
|
||||
# echo "[DEBUG] Checking host output dir: ./$version"
|
||||
# ls -lh "./$version" || echo "[WARN] No folder or files in ./$version"
|
||||
# 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