File tree 4 files changed +18
-1
lines changed 4 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -260,6 +260,11 @@ version is the image's digest.
260
260
* `pull_tag`: *Optional.* **DEPRECATED. Use `get` and `load` instead.** Default
261
261
` latest` . The tag of the repository to pull down via `pull_repository`.
262
262
263
+ * `ssh_identity`: *Optional.* Only applies when `docker_buildkit` is set to `1`.
264
+ Set to an openssh private SSH key (i.e. -----BEGIN OPENSSH PRIVATE KEY----- ...),
265
+ this identity will be passed to `docker build` via the `--ssh default` argument
266
+ through a temporary `ssh-agent` instance.
267
+
263
268
* `tag`: **DEPRECATED - Use `tag_file` instead**
264
269
* `tag_file`: *Optional.* The value should be a path to a file containing the name
265
270
of the tag. When not set, the Docker build will be pushed with tag value set by
Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ import_file=$(jq -r '.params.import_file // ""' < $payload)
113
113
114
114
pull_repository=$( jq -r ' .params.pull_repository // ""' < $payload )
115
115
pull_tag=$( jq -r ' .params.pull_tag // "latest"' < $payload )
116
+ ssh_identity=$( jq -r ' .params.ssh_identity // ""' < $payload )
116
117
target_name=$( jq -r ' .params.target_name // ""' < $payload )
117
118
118
119
if [ -n " $load " ]; then
@@ -224,6 +225,15 @@ elif [ -n "$build" ]; then
224
225
fi
225
226
fi
226
227
228
+ ssh_args=()
229
+ if [ -n " $ssh_identity " ] && [ " $DOCKER_BUILDKIT " -eq 1 ]; then
230
+ eval " $( ssh-agent) "
231
+ trap " ssh-agent -k; $( trap -p EXIT | cut -f2 -d \' ) " EXIT
232
+ ssh-add <( echo " $ssh_identity " )
233
+ ssh_args+=(" --ssh" )
234
+ ssh_args+=(" default" )
235
+ fi
236
+
227
237
target=()
228
238
if [ -n " ${target_name} " ]; then
229
239
target+=(" --target" )
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ RUN apk --no-cache add \
30
30
xz \
31
31
util-linux \
32
32
tar \
33
+ openssh-client \
33
34
;
34
35
COPY --from=builder /assets /opt/resource
35
36
RUN ln -s /opt/resource/ecr-login /usr/local/bin/docker-credential-ecr-login
Original file line number Diff line number Diff line change @@ -30,7 +30,8 @@ RUN apt-get update; \
30
30
ca-certificates \
31
31
curl \
32
32
gnupg-agent \
33
- software-properties-common; \
33
+ software-properties-common \
34
+ openssh-client; \
34
35
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - ; \
35
36
add-apt-repository \
36
37
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
You can’t perform that action at this time.
0 commit comments