Skip to content

Commit

Permalink
update package check logic
Browse files Browse the repository at this point in the history
  • Loading branch information
thelamer committed Apr 13, 2024
1 parent 61be60e commit b06d820
Showing 1 changed file with 16 additions and 25 deletions.
41 changes: 16 additions & 25 deletions ci-scripts/update-packages.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
#! /bin/bash
set -e

cd apps
IMAGES=$(ls -1)
IFS=$'\n'
IMAGE=$1

# Loop through images and update package versions if needed
for IMAGE in $IMAGES; do
cd $IMAGE
docker build --build-arg REPO=${GITHUB_REPOSITORY} -t $IMAGE:latest .
docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v $(pwd):/tmp \
ghcr.io/anchore/syft:latest \
$IMAGE:latest -o table=/tmp/package_versions_check.txt
if [ ! -f 'package_versions.txt' ]; then
mv package_versions_check.txt package_versions.txt
elif ! diff -q package_versions_check.txt package_versions.txt; then
mv package_versions_check.txt package_versions.txt
else
rm -f package_versions_check.txt
fi
docker rmi $IMAGE:latest
docker system prune -af
cd ..
done

cd ..
cd apps/$IMAGE
docker build --build-arg REPO=${GITHUB_REPOSITORY} -t $IMAGE:latest .
docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v $(pwd):/tmp \
ghcr.io/anchore/syft:latest \
$IMAGE:latest -o table=/tmp/package_versions_check.txt
if [ ! -f 'package_versions.txt' ]; then
mv package_versions_check.txt package_versions.txt
elif ! diff -q package_versions_check.txt package_versions.txt; then
mv package_versions_check.txt package_versions.txt
else
rm -f package_versions_check.txt
fi

0 comments on commit b06d820

Please sign in to comment.