1
0
Fork 0
mirror of https://github.com/aevea/action-kaniko.git synced 2025-05-05 23:38:15 +02:00

add support for skaffold build args

This commit is contained in:
Karl Francis 2022-03-16 19:54:30 -04:00
parent dcbacefa08
commit a8280d2cc5
2 changed files with 6 additions and 2 deletions

View file

@ -9,6 +9,8 @@ image filesystem.
This allows for a quite efficient caching, that can be pushed to another docker registry and downloaded on-demand, and a noticeably easier and This allows for a quite efficient caching, that can be pushed to another docker registry and downloaded on-demand, and a noticeably easier and
more secure secret passing to the build context, as it happens in the user space itself. more secure secret passing to the build context, as it happens in the user space itself.
**Note**: skaffold buildArgs that use golang template syntax are **not** supported.
## Usage ## Usage
## Example pipeline ## Example pipeline

View file

@ -75,8 +75,10 @@ do
INPUT_IMAGE=$(trim ${INPUT_IMAGE}) INPUT_IMAGE=$(trim ${INPUT_IMAGE})
INPUT_TAG=$(trim ${INPUT_TAG}) INPUT_TAG=$(trim ${INPUT_TAG})
INPUT_DOCKERFILE=$(trim ${INPUT_DOCKERFILE}) INPUT_DOCKERFILE=$(trim ${INPUT_DOCKERFILE})
SKAFFOLD_BUILD_ARGS=$(yq eval '.images[] | select(.imageName = env(INPUT_IMAGE)) | .docker.buildArgs[] | key + "=" + . | "--build-arg " + .' ais-build.yaml | tr '\n' ' ')
echo "Processing: context: [${INPUT_PATH}] image: [${INPUT_IMAGE}] tag: [${INPUT_TAG}] dockerfile: [${INPUT_DOCKERFILE}]"
echo "Processing: context: [${INPUT_PATH}] image: [${INPUT_IMAGE}] tag: [${INPUT_TAG}] dockerfile: [${INPUT_DOCKERFILE}] skaffold buildArgs: [${SKAFFOLD_BUILD_ARGS}]"
export IMAGE=${INPUT_IMAGE} export IMAGE=${INPUT_IMAGE}
export TAG=${INPUT_TAG:-$([ "$BRANCH" == "master" ] && echo latest || echo $BRANCH)} export TAG=${INPUT_TAG:-$([ "$BRANCH" == "master" ] && echo latest || echo $BRANCH)}
@ -128,7 +130,7 @@ do
fi fi
fi fi
export ARGS="$CACHE $CONTEXT $DOCKERFILE $TARGET $DESTINATION $INPUT_EXTRA_ARGS" export ARGS="$CACHE $CONTEXT $DOCKERFILE $TARGET $DESTINATION $INPUT_EXTRA_ARGS ${SKAFFOLD_BUILD_ARGS}"
cat <<EOF >/kaniko/.docker/config.json cat <<EOF >/kaniko/.docker/config.json
{ {