Skip to content

Upstream Diff

Upstream Diff #299

Workflow file for this run

name: Upstream Diff
on:
pull_request:
push:
schedule:
- cron: 0 0 * * 0
defaults:
run:
shell: 'bash -Eeuo pipefail -x {0}'
jobs:
generate:
name: Generate Matrix
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.generate.outputs.versions }}
steps:
- uses: actions/checkout@v3
- id: generate
name: Generate Matrix
run: |
versions=( */ )
versions=( "${versions[@]%/}" )
IFS=$'\n'
versionsJson="$(IFS=$'\n'; jq <<<"${versions[*]}" -csR 'rtrimstr("\n") | split("\n")')"
echo "::set-output name=versions::$versionsJson"
diff:
needs: generate
strategy:
matrix:
version: ${{ fromJson(needs.generate.outputs.versions) }}
fail-fast: false
name: ${{ matrix.version }}
runs-on: ubuntu-latest
env:
version: ${{ matrix.version }}
steps:
- uses: actions/checkout@v3
- name: Gather Data
run: |
upstreamImage="$(awk '$1 == "FROM" { print $2; exit }' "$version/Dockerfile")"
[ -n "$upstreamImage" ] # sanity check
echo "upstreamImage=$upstreamImage" >> "$GITHUB_ENV"
buildImage="$GITHUB_REPOSITORY:$version"
echo "buildImage=$buildImage" >> "$GITHUB_ENV"
dockerBuild="$(gawk '$1 == "#" && $2 == "docker" && $3 == "build" { gsub(/^#[[:space:]]+/, ""); print }' "$version/Dockerfile")"
[ -n "$dockerBuild" ] # sanity check
dockerBuild+=" --pull --tag '$buildImage'"
echo "dockerBuild=$dockerBuild" >> "$GITHUB_ENV"
- name: Pull
run: |
docker pull "$upstreamImage"
- name: Build
run: |
eval "$dockerBuild"
- name: Diff
run: |
diff -u <(.github/workflows/history.sh "$upstreamImage") <(.github/workflows/history.sh "$buildImage")
- name: Overall Size
run: |
docker image ls "${upstreamImage%%:*}"
docker image ls "${buildImage%%:*}"
- name: Full History
run: |
docker image history "$upstreamImage"
docker image history "$buildImage"