Fix ssh usage for bake builds
This commit is contained in:
8
.github/workflows/docker-build-publish.yml
vendored
8
.github/workflows/docker-build-publish.yml
vendored
@@ -107,6 +107,10 @@ jobs:
|
|||||||
if [ -n "${SSH_AUTH_SOCK:-}" ]; then
|
if [ -n "${SSH_AUTH_SOCK:-}" ]; then
|
||||||
SSH_FLAGS+=(--ssh default)
|
SSH_FLAGS+=(--ssh default)
|
||||||
fi
|
fi
|
||||||
|
SSH_BAKE_JSON="null"
|
||||||
|
if [ -n "${SSH_AUTH_SOCK:-}" ]; then
|
||||||
|
SSH_BAKE_JSON='["default"]'
|
||||||
|
fi
|
||||||
|
|
||||||
RAW_REF="${{ github.ref }}"
|
RAW_REF="${{ github.ref }}"
|
||||||
SHA_FULL="${{ github.sha }}"
|
SHA_FULL="${{ github.sha }}"
|
||||||
@@ -187,6 +191,7 @@ jobs:
|
|||||||
--arg target "$TARGET" \
|
--arg target "$TARGET" \
|
||||||
--argjson tags "$TAGS_JSON" \
|
--argjson tags "$TAGS_JSON" \
|
||||||
--argjson args "$BUILD_ARGS_JSON" \
|
--argjson args "$BUILD_ARGS_JSON" \
|
||||||
|
--argjson ssh "$SSH_BAKE_JSON" \
|
||||||
--arg cache_ref "$CACHE_REF" \
|
--arg cache_ref "$CACHE_REF" \
|
||||||
'{
|
'{
|
||||||
context: $context,
|
context: $context,
|
||||||
@@ -194,6 +199,7 @@ jobs:
|
|||||||
tags: $tags,
|
tags: $tags,
|
||||||
args: $args
|
args: $args
|
||||||
}
|
}
|
||||||
|
+ (if ($ssh != null) then {ssh: $ssh} else {} end)
|
||||||
+ (if ($target != "" and $target != "null") then {target: $target} else {} end)
|
+ (if ($target != "" and $target != "null") then {target: $target} else {} end)
|
||||||
+ (if ($cache_ref != "") then {"cache-from": ["type=registry,ref=" + $cache_ref], "cache-to": ["type=registry,ref=" + $cache_ref + ",mode=max"]} else {} end)')
|
+ (if ($cache_ref != "") then {"cache-from": ["type=registry,ref=" + $cache_ref], "cache-to": ["type=registry,ref=" + $cache_ref + ",mode=max"]} else {} end)')
|
||||||
|
|
||||||
@@ -205,7 +211,7 @@ jobs:
|
|||||||
BAKE_FILE=$(mktemp)
|
BAKE_FILE=$(mktemp)
|
||||||
echo "$BAKE_JSON" > "$BAKE_FILE"
|
echo "$BAKE_JSON" > "$BAKE_FILE"
|
||||||
|
|
||||||
docker buildx bake --file "$BAKE_FILE" --push "${SSH_FLAGS[@]}"
|
docker buildx bake --file "$BAKE_FILE" --push
|
||||||
rm -f "$BAKE_FILE"
|
rm -f "$BAKE_FILE"
|
||||||
|
|
||||||
while read -r img; do
|
while read -r img; do
|
||||||
|
|||||||
Reference in New Issue
Block a user