From 6a550e73e27b6cefc375ad06a8f459e107f30a21 Mon Sep 17 00:00:00 2001 From: Jake Conkerton-Darby Date: Mon, 12 Aug 2024 16:13:47 +0100 Subject: [PATCH] CH-142 Added testing of dockerfile configuration --- applications/samples/Dockerfile | 3 +++ applications/samples/deploy/values-minimal.yaml | 4 +++- applications/samples/deploy/values.yaml | 4 ++++ tools/deployment-cli-tools/tests/test_skaffold.py | 2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/applications/samples/Dockerfile b/applications/samples/Dockerfile index 2925caf5a..522de3c9e 100644 --- a/applications/samples/Dockerfile +++ b/applications/samples/Dockerfile @@ -3,6 +3,9 @@ ARG CLOUDHARNESS_FLASK FROM $CLOUDHARNESS_FRONTEND_BUILD as frontend +ARG TEST_ARGUMENT=default +RUN echo $TEST_ARGUMENT + ENV APP_DIR=/app WORKDIR ${APP_DIR} diff --git a/applications/samples/deploy/values-minimal.yaml b/applications/samples/deploy/values-minimal.yaml index 1312b943a..c6fb239a8 100644 --- a/applications/samples/deploy/values-minimal.yaml +++ b/applications/samples/deploy/values-minimal.yaml @@ -4,4 +4,6 @@ harness: soft: [] hard: [] use_services: [] - + dockerfile: + buildArgs: + TEST_ARGUMENT: 'minimal value' diff --git a/applications/samples/deploy/values.yaml b/applications/samples/deploy/values.yaml index 7dd5e2936..3d1717ec8 100644 --- a/applications/samples/deploy/values.yaml +++ b/applications/samples/deploy/values.yaml @@ -84,3 +84,7 @@ harness: - "--request-timeout=180000" - "--hypothesis-max-examples=2" - "--show-errors-tracebacks" + + dockerfile: + buildArgs: + TEST_ARGUMENT: example value \ No newline at end of file diff --git a/tools/deployment-cli-tools/tests/test_skaffold.py b/tools/deployment-cli-tools/tests/test_skaffold.py index 981aefa58..17c0832d3 100644 --- a/tools/deployment-cli-tools/tests/test_skaffold.py +++ b/tools/deployment-cli-tools/tests/test_skaffold.py @@ -81,6 +81,8 @@ def test_create_skaffold_configuration(): a for a in sk['build']['artifacts'] if a['image'] == 'reg/cloudharness/samples' ) assert os.path.samefile(samples_artifact['context'], join(CLOUDHARNESS_ROOT, 'applications/samples')) + assert 'TEST_ARGUMENT' in samples_artifact['docker']['buildArgs'] + assert samples_artifact['docker']['buildArgs']['TEST_ARGUMENT'] == 'example value' myapp_artifact = next( a for a in sk['build']['artifacts'] if a['image'] == 'reg/cloudharness/myapp')