Skip to content

Commit d7626a1

Browse files
committed
Automatically update the Dockerfiles to use newly built images
1 parent de47fad commit d7626a1

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
version.json
3333
__lbheartbeat__
3434
.perl-version
35+
*.bak
3536

3637
/skins/contrib/Dusk/admin.css
3738
/skins/contrib/Dusk/bug.css

docker/gen-docker-image.sh

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,27 @@ select IMAGE in $FILES; do
7878
$DOCKER build $CACHE -t bugzilla/${IMAGE}:${DATE}.${ITER} -f docker/images/Dockerfile.${IMAGE} .
7979
if [ $? == 0 ]; then
8080
echo
81-
echo "The build appears to have succeeded. Don't forget to change the FROM line"
82-
echo "at the top of Dockerfile and each of docker/Dockerfile.* to use:"
83-
echo " bugzilla/${IMAGE}:${DATE}.${ITER}"
84-
echo "to make use of this image."
81+
echo "The build appears to have succeeded."
82+
echo "Updating FROM lines in Dockerfiles to use bugzilla/${IMAGE}:${DATE}.${ITER}..."
8583
echo
84+
85+
# Update all Dockerfiles that reference this image
86+
for dockerfile in Dockerfile docker/images/Dockerfile.*; do
87+
if [ -f "$dockerfile" ]; then
88+
# Check for both direct references and BZDB variable references
89+
if grep -q "FROM bugzilla/${IMAGE}:" "$dockerfile" || grep -q "FROM bugzilla/${IMAGE}\${BZDB}:" "$dockerfile"; then
90+
# Create a backup
91+
cp "$dockerfile" "${dockerfile}.bak"
92+
# Update the FROM line - handle both direct and BZDB variable patterns
93+
sed -i.tmp "s|FROM bugzilla/${IMAGE}:[^ ]*|FROM bugzilla/${IMAGE}:${DATE}.${ITER}|g" "$dockerfile"
94+
sed -i.tmp "s|FROM bugzilla/${IMAGE}\${BZDB}:[^ ]*|FROM bugzilla/${IMAGE}\${BZDB}:${DATE}.${ITER}|g" "$dockerfile"
95+
rm -f "${dockerfile}.tmp"
96+
echo " Updated: $dockerfile"
97+
fi
98+
fi
99+
done
100+
echo
101+
86102
# check if the user is logged in
87103
if [ -z "$PYTHON" ]; then
88104
PYTHON=`which python`

0 commit comments

Comments
 (0)