From a45918dcda425f3a406529b9e947fe95c549b878 Mon Sep 17 00:00:00 2001 From: Nick Schuch Date: Fri, 26 Sep 2025 15:44:56 +1000 Subject: [PATCH 1/2] PoC: goss --- Dockerfile | 7 ++++++- goss.yml | 18 ++++++++++++++++++ tests.yml | 20 -------------------- 3 files changed, 24 insertions(+), 21 deletions(-) create mode 100644 goss.yml delete mode 100644 tests.yml diff --git a/Dockerfile b/Dockerfile index eb3f9a6..ec5d668 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM base +FROM node:20-alpine # Libuv 1.45.0 is affected by a kernel bug on certain kernels. # This leads to errors where Garden tool downloading errors with ETXTBSY @@ -49,3 +49,8 @@ RUN npm install -g pnpm@10 USER skpr ENV PATH /data/node_modules/.bin:$PATH + +# Run the tests. +COPY --from=ghcr.io/goss-org/goss:latest /usr/bin/goss /usr/bin/goss +ADD goss.yml /etc/goss/goss.yml +RUN goss --gossfile=/etc/goss/goss.yml validate diff --git a/goss.yml b/goss.yml new file mode 100644 index 0000000..23ae89f --- /dev/null +++ b/goss.yml @@ -0,0 +1,18 @@ +command: + npm: + exec: "npm --help" + exit-status: 1 + stdout: + - DISCLAIMER + + yarn: + exec: "yarn --help" + exit-status: 0 + stdout: + - DISCLAIMER + + pnpm: + exec: "pnpm --help" + exit-status: 0 + stdout: + - "compiled to binary" diff --git a/tests.yml b/tests.yml deleted file mode 100644 index 4b6856f..0000000 --- a/tests.yml +++ /dev/null @@ -1,20 +0,0 @@ -schemaVersion: '2.0.0' - -commandTests: - - name: "npm" - command: "npm" - args: ["--help"] - expectedOutput: ["DISCLAIMER"] - exitCode: 1 - - - name: "yarn" - command: "yarn" - args: ["--help"] - expectedOutput: ["DISCLAIMER"] - exitCode: 0 - - - name: "pnpm" - command: "pnpm" - args: ["--help"] - expectedOutput: ["compiled to binary"] - exitCode: 0 From 2f58355170d6c0cd6c46ace9d676287932e86267 Mon Sep 17 00:00:00 2001 From: Nick Schuch Date: Fri, 26 Sep 2025 15:50:49 +1000 Subject: [PATCH 2/2] Test image stage --- Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ec5d668..36e827c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:20-alpine +FROM base AS run # Libuv 1.45.0 is affected by a kernel bug on certain kernels. # This leads to errors where Garden tool downloading errors with ETXTBSY @@ -50,7 +50,11 @@ USER skpr ENV PATH /data/node_modules/.bin:$PATH -# Run the tests. +# Temporary build stage where we can run the test suite. +FROM run AS test COPY --from=ghcr.io/goss-org/goss:latest /usr/bin/goss /usr/bin/goss ADD goss.yml /etc/goss/goss.yml RUN goss --gossfile=/etc/goss/goss.yml validate + +# Swap back to the run stage. +FROM run