aboutsummaryrefslogtreecommitdiff
path: root/tasks/dgoss
diff options
context:
space:
mode:
Diffstat (limited to 'tasks/dgoss')
-rw-r--r--tasks/dgoss/task.yml47
1 files changed, 47 insertions, 0 deletions
diff --git a/tasks/dgoss/task.yml b/tasks/dgoss/task.yml
new file mode 100644
index 0000000..8727487
--- /dev/null
+++ b/tasks/dgoss/task.yml
@@ -0,0 +1,47 @@
+---
+platform: linux
+image_resource:
+ type: registry-image
+ source: {repository: debian}
+
+inputs:
+ - name: docker-repo
+ - name: image
+
+run:
+ path: /bin/bash
+ args:
+ - -eufo
+ - pipefail
+ - -c
+ - |
+ apt-get update
+ apt-get install --no-install-recommends -y \
+ ca-certificates \
+ curl \
+ fuse-overlayfs \
+ podman
+
+ curl -fsSL https://goss.rocks/install | sh
+
+ export GOSS_SLEEP=${GOSS_SLEEP:-5}
+ export CONTAINER_RUNTIME=${CONTAINER_RUNTIME:-podman}
+ export INPUT_TAR=${INPUT_TAR:-image/image.tar}
+
+ if [ -f docker-repo/goss.yaml ]; then
+ # The default 'mount' strategy uses 'sleep infinity' to keep
+ # the container alive. If there's an ENTRYPOINT or CMD, use 'cp'
+ # instead to prevent dgoss from overriding it.
+ if grep -qE '^(ENTRYPOINT|CMD)' docker-repo/Dockerfile; then
+ export GOSS_FILES_STRATEGY=cp
+ fi
+ goss --gossfile docker-repo/goss.yaml render > goss.yaml
+ dgoss run docker-archive:${INPUT_TAR}
+ else
+ echo "You're a naughty boy, no goss.yaml file found!" >&2
+ fi
+
+params:
+ CONTAINER_RUNTIME:
+ GOSS_SLEEP:
+ INPUT_TAR: