diff --git a/.github/compare-images.sh b/.github/compare-images.sh index b0d8990d..64bbfe52 100755 --- a/.github/compare-images.sh +++ b/.github/compare-images.sh @@ -1,88 +1,38 @@ #!/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 +# Check if a tag is provided +if [ -z "$1" ]; then + echo "Error: No tag provided. Usage: ./compare-image.sh " + exit 1 +fi - # Output the Composer version - echo "" - echo "Composer" - echo "====================" - composer -V +# Set the Docker image tag +IMAGE_TAG=$1 - # List installed system packages - echo "" - echo "Installed system packages" - echo "==========================" - apk info -vv | sort -EOF - -docker run -i --rm "$PREVIOUS_TAG" sh -s <<'EOF' > previous-output.txt - # Output installed PHP extensions +# Run the Docker image and output the required information +docker run -i --rm "$IMAGE_TAG" sh -s <<'EOF' + echo "=== 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 "====================" + echo "=== Disabled PHP Extensions ===" 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 "====================" + echo "=== PECL Extensions ===" pear list -c pecl - # Output the Composer version echo "" - echo "Composer" - echo "====================" + echo "=== Composer Version ===" composer -V - # List installed system packages echo "" - echo "Installed system packages" - echo "==========================" + echo "=== Installed System Packages ===" 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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90bcbd5f..b89a76a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,39 +72,45 @@ jobs: tags: ${{ join(matrix.tags) }} platforms: ${{ join(matrix.platforms) }} - - name: Compare images and capture diff + - name: Output image report run: | CURRENT_TAG=${{ matrix.tags[0] }} - PREVIOUS_TAG="${{ matrix.tags[0] }}-${{ env.PREV_COMMIT_HASH }}" - bash .github/compare-images.sh $CURRENT_TAG $PREVIOUS_TAG > image-diff.txt || true + bash .github/compare-images.sh > image-report.txt || true + cat image-report.txt - - name: Read diff output - id: read_diff - run: | - DIFF_OUTPUT=$(cat image-diff.txt) - echo "DIFF_OUTPUT<> $GITHUB_ENV - echo "$DIFF_OUTPUT" >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - - - name: Send Slack Notification - uses: slackapi/slack-github-action@v1.24.0 - with: - payload: | - { - "attachments": [ - { - "pretext": "Release changes for *spryker/php:${{ matrix.tags[0] }}*", - "color": "good", - "fields": [ - { - "title": "Image diff:", - "value": "${{ env.DIFF_OUTPUT }}", - "short": false - } - ] - } - ] - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK +# - name: Compare images and capture diff +# run: | +# CURRENT_TAG=${{ matrix.tags[0] }} +# PREVIOUS_TAG="${{ matrix.tags[0] }}-${{ env.PREV_COMMIT_HASH }}" +# bash .github/compare-images.sh $CURRENT_TAG $PREVIOUS_TAG > image-diff.txt || true +# +# - name: Read diff output +# id: read_diff +# run: | +# DIFF_OUTPUT=$(cat image-diff.txt) +# echo "DIFF_OUTPUT<> $GITHUB_ENV +# echo "$DIFF_OUTPUT" >> $GITHUB_ENV +# echo "EOF" >> $GITHUB_ENV +# +# - name: Send Slack Notification +# uses: slackapi/slack-github-action@v1.24.0 +# with: +# payload: | +# { +# "attachments": [ +# { +# "pretext": "Release changes for *spryker/php:${{ matrix.tags[0] }}*", +# "color": "good", +# "fields": [ +# { +# "title": "Image diff:", +# "value": "${{ env.DIFF_OUTPUT }}", +# "short": false +# } +# ] +# } +# ] +# } +# env: +# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} +# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK