Skip to content

Commit

Permalink
Notification + diff
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderM91 committed Oct 17, 2024
1 parent ac91c30 commit eb7f371
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 1 deletion.
91 changes: 91 additions & 0 deletions .github/compare-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/bin/bash

# Set variables
CURRENT_TAG=$1
PREVIOUS_TAG=$2

# Run the current image and capture output
docker run -i --rm "$CURRENT_TAG" sh -s <<'EOF' > current-output.txt
# Output installed PHP extensions
docker-php-source extract
echo "Installed extensions"
echo "===================="
for ext in `ls /usr/src/php/ext`; do
echo ' ' `php -r "if (extension_loaded('$ext' !== 'opcache' ? '$ext' : 'Zend OPcache')) { echo '[x] $ext'; } else { echo '[ ] $ext'; }"`;
done
# Output disabled PHP extensions
echo ""
echo "Disabled extensions"
echo "===================="
for f in /usr/local/etc/php/disabled/*.ini; do
disabled=$(basename $f | sed -e 's/\.ini$//');
echo " [ ] ${disabled} $(PHP_INI_SCAN_DIR=:/usr/local/etc/php/disabled php -r "echo phpversion('${disabled}');")";
done
# List installed PECL extensions
echo ""
echo "PECL extensions"
echo "===================="
pear list -c pecl
# Output the Composer version
echo ""
echo "Composer"
echo "===================="
composer -V
# List installed system packages
echo ""
echo "Installed system packages"
echo "=========================="
apk info -vv | sort
EOF

# Pull the previous image if it exists and capture output
docker pull "$PREVIOUS_TAG" || { echo "Previous image not found."; exit 0; }

docker run -i --rm "$PREVIOUS_TAG" sh -s <<'EOF' > previous-output.txt
# Output installed PHP extensions
docker-php-source extract
echo "Installed extensions"
echo "===================="
for ext in `ls /usr/src/php/ext`; do
echo ' ' `php -r "if (extension_loaded('$ext' !== 'opcache' ? '$ext' : 'Zend OPcache')) { echo '[x] $ext'; } else { echo '[ ] $ext'; }"`;
done
# Output disabled PHP extensions
echo ""
echo "Disabled extensions"
echo "===================="
for f in /usr/local/etc/php/disabled/*.ini; do
disabled=$(basename $f | sed -e 's/\.ini$//');
echo " [ ] ${disabled} $(PHP_INI_SCAN_DIR=:/usr/local/etc/php/disabled php -r "echo phpversion('${disabled}');")";
done
# List installed PECL extensions
echo ""
echo "PECL extensions"
echo "===================="
pear list -c pecl
# Output the Composer version
echo ""
echo "Composer"
echo "===================="
composer -V
# List installed system packages
echo ""
echo "Installed system packages"
echo "=========================="
apk info -vv | sort
EOF

# Compare the outputs
if [ -f previous-output.txt ]; then
echo "Comparing current and previous outputs..."
diff previous-output.txt current-output.txt || true
else
echo "No previous output to compare."
fi
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
run: |
CURRENT_TAG=${{ matrix.tags[0] }}
PREVIOUS_TAG="${{ matrix.tags[0] }}-${{ env.PREV_COMMIT_HASH }}"
bash compare-images.sh $CURRENT_TAG $PREVIOUS_TAG > image-diff.txt || true
bash .github/compare-images.sh $CURRENT_TAG $PREVIOUS_TAG > image-diff.txt || true
- name: Read diff output
id: read_diff
Expand Down

0 comments on commit eb7f371

Please sign in to comment.