Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1050a93015 | |||
| 18a82250d2 | |||
| d1cf9d3820 | |||
| f430edba60 | |||
| 42a1e2a366 | |||
| 93e41e7203 | |||
| 8c8c530d4e | |||
| a73015164e | |||
| 37c6659976 | |||
| a711f6e5cb | |||
| 2707de296c | |||
|
|
d8cf79d3bc | ||
|
|
ef9110c42e |
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -5,7 +5,7 @@ on:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [master]
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
test-always-true:
|
||||
|
||||
@@ -36,7 +36,7 @@ The action returns either `true` or `false`, indicating if the derived image dif
|
||||
```yaml
|
||||
- name: Run
|
||||
id: run
|
||||
uses: ClementTsang/docker-check-base-image-diff@v0.0.1-alpha
|
||||
uses: ClementTsang/docker-check-base-image-diff@v0.0.2
|
||||
with:
|
||||
base-image: docker://rust:slim-buster
|
||||
derived-image: docker://ghcr.io/clementtsang/cargo-deb-arm
|
||||
|
||||
13
action.yml
13
action.yml
@@ -6,16 +6,16 @@ branding:
|
||||
color: blue
|
||||
|
||||
inputs:
|
||||
base-image:
|
||||
image:
|
||||
description: "Base Docker image - follows skopeo format (e.g. docker://rust:slim-buster)"
|
||||
required: true
|
||||
derived-image:
|
||||
description: "Derived Docker image - follows skopeo format (e.g. docker://rust:slim-buster)"
|
||||
tags:
|
||||
description: "list of tags"
|
||||
required: true
|
||||
outputs:
|
||||
differs:
|
||||
exist:
|
||||
description: "Returns either true or false"
|
||||
value: ${{ steps.check.outputs.differs }}
|
||||
value: ${{ steps.check.outputs.exist }}
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
@@ -23,5 +23,4 @@ runs:
|
||||
- id: check
|
||||
shell: bash
|
||||
run: |
|
||||
RESULT=$(${{ github.action_path }}/check.sh ${{ inputs.base-image }} ${{ inputs.derived-image }})
|
||||
echo "differs=$RESULT" >> $GITHUB_OUTPUT
|
||||
${{ github.action_path }}/check.sh "${{ inputs.image }}" "${{ inputs.tags }}"
|
||||
|
||||
13
check.sh
13
check.sh
@@ -2,7 +2,14 @@
|
||||
|
||||
set -e
|
||||
|
||||
BASE_LAYERS="$(skopeo inspect $1 | jq '.Layers')"
|
||||
DERIVED_LAYERS="$(skopeo inspect $2 | jq '.Layers')"
|
||||
CHECK=$( echo -n "$2" | sed -e "s#$1:##g" | jq -R -s 'split("\n")' )
|
||||
EXISTING=$( skopeo list-tags docker://$1 || echo '{"Tags":[]}' )
|
||||
TAGS=$( jq '.check - .existing.Tags' <<< "{\"check\": $CHECK, \"existing\": $EXISTING}" )
|
||||
|
||||
jq '.base - .derived | .!=[]' <<< "{\"base\": $BASE_LAYERS, \"derived\": $DERIVED_LAYERS}"
|
||||
echo $TAGS | jq '"Tag not found: "+ .[]'
|
||||
RESULT=$(echo $TAGS | jq '.==[]')
|
||||
if "$RESULT" == "true"
|
||||
then
|
||||
echo "All tags found"
|
||||
fi
|
||||
echo exist=$RESULT >> $GITHUB_OUTPUT
|
||||
|
||||
Reference in New Issue
Block a user