mirror of
https://github.com/nextcloud/docker.git
synced 2025-04-21 03:06:08 +02:00
Add PHP Version Audit to notifiy when the PHP version needs to be bumped
Signed-off-by: Daniel <daniel@developerdan.com>
This commit is contained in:
parent
f49b1edcaa
commit
2005902ac7
2 changed files with 34 additions and 0 deletions
15
.github/workflows/php-version-audit.yml
vendored
Normal file
15
.github/workflows/php-version-audit.yml
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
name: PHP Version Audit
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [ opened, synchronize, reopened ]
|
||||
schedule:
|
||||
- cron: '0 0 16 * *' # run arbitrarily once a month
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
php-version-audit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: ./php-version-audit.sh
|
19
php-version-audit.sh
Executable file
19
php-version-audit.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
# Run PHP Version Audit against all the base docker images to alert if they are EOL or have CVEs
|
||||
# See https://www.github.developerdan.com/php-version-audit/
|
||||
|
||||
# Parse out the "FROM php:" tags from the Dockerfiles
|
||||
php_tags=$(find . -type f -name Dockerfile -not -path '*/.*' | xargs cat | grep "FROM php:" | sort -u | sed 's/.*://')
|
||||
|
||||
# For each image, get the full php version
|
||||
php_versions=$(echo "${php_tags}" | while read -r tag; do
|
||||
docker run --pull always --rm --entrypoint=php "php:${tag}" -r 'echo phpversion()."\n";';
|
||||
done | sort -u)
|
||||
|
||||
# Run all the php version through php-version-audit with the '--fail-security' flag
|
||||
# to generate an exit code if a CVE is found or the support is EOL
|
||||
echo "${php_versions}" | while read -r version; do
|
||||
docker run --rm lightswitch05/php-version-audit:latest --fail-security --version="${version}";
|
||||
done
|
Loading…
Add table
Reference in a new issue