refactor: sign multiple images instead of only one
Some checks failed
ci/woodpecker/push/release Pipeline failed

Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
This commit is contained in:
Vojtěch Mareš 2025-09-08 15:21:52 +02:00
parent 0b5f53fe41
commit a93217ce90
Signed by: vojtech.mares
GPG key ID: C6827B976F17240D
4 changed files with 14 additions and 10 deletions

View file

@ -51,7 +51,7 @@ steps:
commands:
- echo $COSIGN_KEY > ./cosign.key
check-cosign-key:
image: alpine
commands:
- ls
sign-next:
image: registry.mareshq.com/woodpecker-plugins/cosign-sign:next
settings:
image: registry.mareshq.com/woodpecker-plugins/cosign-sign:next

View file

@ -1,6 +1,6 @@
FROM alpine:3.22
RUN apk add --no-cache ca-certificates cosign
RUN apk add --no-cache ca-certificates cosign jq
COPY entrypoint.sh /entrypoint.sh

View file

@ -18,12 +18,14 @@ steps:
prettier:
image: registry.mareshq.com/woodpecker-plugins/cosign-sign
settings:
image: registry.example.com/app:latest
images:
- registry.example.com/app:latest
- registry.example.com/app:v1
```
## Settings
| Settings Name | Type | Default | Description |
| ------------- | ------- | ------- | --------------------------------------------------------------------------- |
| `image` | string | empty | Image name including tag. |
| `images` | string | empty | List of image names including tag. |
| `key_path` | string | `./cosign.key` | Path to signing key |

View file

@ -1,8 +1,10 @@
#! /bin/sh
if [ -z ${PLUGIN_IMAGE+x} ]; then
echo "ERROR: image setting is required."
if [ -z ${PLUGIN_IMAGES+x} ]; then
echo "ERROR: images setting is required."
exit 1
fi
cosign sign --key "${PLUGIN_KEY_PATH:-"./cosign.key"}" "${PLUGIN_IMAGE}"
echo "${PLUGIN_IMAGES}" | jq '.[]' | while read -r image; do
cosign sign --key "${PLUGIN_KEY_PATH:-"./cosign.key"}" "${image}"
done