This commit is contained in:
Stephan Schnabel 2025-06-11 21:42:48 +02:00
parent c4d6f3872f
commit 8d00ca9e7b
Signed by: stephan.schnabel
SSH key fingerprint: SHA256:99zuzxNGFb5/5P+E/O7ONU2qhUojUe/D8rIPTW+9Xp0
2 changed files with 19 additions and 26 deletions

View file

@ -1,19 +0,0 @@
{
"auths": [
{
"docker.io": {
"auth": "c3NjaG5hYmU6ZGNrcl9wYXRfZ3RnZ1k4RFdzUjJmZlRLTU1yWVI2cFR5Y1VF"
}
},
{
"ghcr.io": {
"auth": "a29rdXdhaW8tYm90OmdocF9SS2tmTXludk5SemJ6b0hCUnR3dGZmYUhqNUxPQ0wweGhRVkw="
}
},
{
"registry.kokuwa.io": {
"auth": "d29vZHBlY2tlcjp6YWtfY2QyNGZmODg2MTFhNDQxODkyM2ZhNDEyYTQ1OGQ0YzI="
}
}
]
}

View file

@ -1,5 +1,17 @@
#!/usr/bin/env bash
set -eu;
CI_PIPELINE_NUMBER=1
CI_REPO_URL=CI_REPO_URL
CI_COMMIT_SHA=123
CI_REPO_CLONE_URL=CI_REPO_CLONE_URL
PLUGIN_ANNOTATION='{"org.opencontainers.image.description":"A Woodpecker CI plugin for yamllint to lint yaml files.","org.opencontainers.image.documentation":"$CI_REPO_URL/README.md","org.opencontainers.image.licenses":"EUPL-1.2","org.opencontainers.image.ref.name":"kokuwaio/buildctl","org.opencontainers.image.revision":"$CI_COMMIT_SHA","org.opencontainers.image.source":"$CI_REPO_CLONE_URL","org.opencontainers.image.title":"Buildctl Plugin","org.opencontainers.image.url":"$CI_REPO_URL","org.opencontainers.image.vendor":"kokuwa.io","org.opencontainers.image.version":"v0.21.0"}'
PLUGIN_NAME=kokuwaio/buildctl
PLUGIN_PLATFORM=linux/amd64,linux/arm64
#PLUGIN_AUTH='{"auths":{"registry.kokuwa.io":{"auth":"d29vZHBlY2tlcjo5cVRrVlpXSW1ITndXWXVMZ1pMajVST0FuYmZlOTEyUjlLWFFIVW51MG1iOGx5UWl5Z3hFUEZxVTN0REo5VzdE"},"ghcr.io":{"auth":"c3NjaG5hYmU6Z2hwX0lHVEswWkk0YTBqN2EzTjNIMlBmOEc2UFl1eGpEYjRmUlk0Yw=="},"https://index.docker.io/v1/":{"auth":"c3NjaG5hYmU6ZGNrcl9wYXRfZ3RnZ1k4RFdzUjJmZlRLTU1yWVI2cFR5Y1VF=="}}}'
#PLUGIN_AUTH='{"index.docker.io":{"password":"dckr_pat_gtggY8DWsR2ffTKMMrYR6pTycUE","username":"sschnabe"},"ghcr.io":{"password":"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","username":"kokuwaio-bot"},"registry.kokuwa.io":{"password":"6u9ij2qtqJiGbvnsgVuUyHc2OSHmtX6mC1wbmR253GwJN8IpbawyybYHIxu0hbRw","username":"woodpecker"}}'
DOCKER_CONFIG=.
#echo $PLUGIN_AUTH | base64 -w0
##
## check input
@ -21,10 +33,9 @@ fi
SOURCE_DATE_EPOCH=${PLUGIN_SOURCE_DATE_EPOCH:-0}
if [[ -n "${PLUGIN_AUTH:-}" ]]; then
DOCKER_CONFIG=${DOCKER_CONFIG:-$PWD}
mkdir -p "$DOCKER_CONFIG"
echo "$PLUGIN_AUTH" | jq -r 'to_entries|map({(.key):{"auth":(.value.username+":"+.value.password)|@base64}})|{"auths":.}' > "$DOCKER_CONFIG/config.json"
echo Stored credentials at "$DOCKER_CONFIG/config.json"
mkdir -p "$HOME/.docker"
echo "$PLUGIN_AUTH" | jq -r 'to_entries|map({(.key):{"auth":(.value.username+":"+.value.password)|@base64}})|add|{"auths":.}' > "$HOME/.docker/config.json"
echo "Stored credentials at $HOME/.docker/config.json"
echo
fi
@ -79,7 +90,8 @@ echo
echo -e "SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH ${COMMAND// --/\\n --}"
echo
echo "$DOCKER_CONFIG/config.json"
cat "$DOCKER_CONFIG/config.json" | base64 -w0
cat "$DOCKER_CONFIG/config.json" | jq
echo "$HOME/.docker/config.json"
cat "$HOME/.docker/config.json" | base64 -w0
cat "$HOME/.docker/config.json" | jq
eval "$COMMAND"