This repository has been archived by the owner on Dec 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add image_aliases and hook script support (#9)
- Loading branch information
Showing
11 changed files
with
83 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
pipeline: | ||
build: | ||
image: quay.io/testcontainers/dind-drone-plugin | ||
build_image: openjdk:8-jdk | ||
cmd: java -v | ||
build_image: alpine:fake | ||
cmd: cat /etc/issue | ||
image_aliases: | ||
alpine:3.5: alpine:fake | ||
alpine:3.6: alpine:fake2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
FROM docker:19.03.0-dind | ||
|
||
RUN apk add --no-cache bash | ||
RUN apk add --no-cache bash jq | ||
|
||
#### Script that starts docker in docker | ||
ADD command.sh /command.sh | ||
RUN chmod +x /command.sh | ||
ADD command.sh /dind-drone-plugin/command.sh | ||
RUN chmod +x /dind-drone-plugin/command.sh | ||
|
||
ENTRYPOINT ["/command.sh"] | ||
#### Hook scripts | ||
ADD hooks /dind-drone-plugin/hooks | ||
|
||
ENTRYPOINT ["/dind-drone-plugin/command.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
if [[ "${PLUGIN_DOCKER_LOGIN_COMMAND:-}" != "" ]]; then | ||
echo "🛠 Executing Docker login command" | ||
sh -c "${PLUGIN_DOCKER_LOGIN_COMMAND}" 2>&1 | sed "s/^/ /g" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
echo $PLUGIN_IMAGE_ALIASES | jq -r 'to_entries[] | [.key, .value] | @tsv' | while read ORIGINAL NEW; do | ||
echo "🐑 Pulling image $ORIGINAL and retagging as $NEW" | ||
docker pull $ORIGINAL 2>&1 | sed 's/^/ /g' | ||
docker tag $ORIGINAL $NEW 2>&1 | sed 's/^/ /g' | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
pull_if_absent() { | ||
if [[ $(docker images ${1} | wc -l) < 2 ]]; then | ||
echo "🚚 Pulling image: ${1}" | ||
docker pull ${1} 2>&1 | sed 's/^/ /g' | ||
fi | ||
} | ||
|
||
if [[ "${PLUGIN_PREFETCH_IMAGES:-}" != "" ]]; then | ||
echo "🚚 Prefetching images in background:" | ||
for IMG in $(echo ${PLUGIN_PREFETCH_IMAGES} | sed "s/,/ /g"); do | ||
echo " $IMG" | ||
pull_if_absent "$IMG" > /dev/null & | ||
done | ||
fi | ||
|
||
pull_if_absent ${PLUGIN_BUILD_IMAGE} |
Empty file.
Empty file.
Empty file.