diff --git a/deployment/codefresh-test.yaml b/deployment/codefresh-test.yaml index 2315355e1..0a0dc365e 100644 --- a/deployment/codefresh-test.yaml +++ b/deployment/codefresh-test.yaml @@ -1,3 +1,4 @@ +# Generated with: harness-deployment . -d '${{DOMAIN}}' -n 'test-${{NAMESPACE_BASENAME}}' -r reg -t 1 -e test --write-env --cache-url '${{IMAGE_CACHE_URL}}' -i samples version: '1.0' stages: - prepare @@ -13,13 +14,26 @@ steps: repo: ${{CF_REPO_OWNER}}/${{CF_REPO_NAME}} revision: ${{CF_BRANCH}} git: github + post_main_clone: + title: Post main clone + type: parallel + stage: prepare + steps: + clone_cloud_harness: + title: Cloning cloud-harness repository... + type: git-clone + stage: prepare + repo: https://github.com/MetaCell/cloud-harness.git + revision: ${{CLOUDHARNESS_BRANCH}} + working_directory: . + git: github prepare_deployment: title: Prepare helm chart image: python:3.12 stage: prepare working_directory: . commands: - - bash install.sh + - bash cloud-harness/install.sh - export HELM_NAME_ARG="$( [ -n "${{CHART_NAME}}" ] && printf -- "--name %s" "${{CHART_NAME}}" )" - export HELM_CHART_VERSION_ARG="$( [ -n "${{CHART_VERSION}}" ] && printf -- "--chart-version @@ -48,25 +62,23 @@ steps: stage: build steps: accounts: + title: Building accounts type: build stage: build - dockerfile: Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/accounts + working_directory: applications/accounts + dockerfile: Dockerfile + tag: ${{ACCOUNTS_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/accounts - title: Accounts - working_directory: ./applications/accounts - tags: - - ${{ACCOUNTS_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -75,25 +87,23 @@ steps: forceNoCache: includes('${{ACCOUNTS_TAG_FORCE_BUILD}}', '{{ACCOUNTS_TAG_FORCE_BUILD}}') == false cloudharness-base: + title: Building cloudharness-base type: build stage: build - dockerfile: infrastructure/base-images/cloudharness-base/Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/cloudharness-base + working_directory: . + dockerfile: infrastructure/base-images/cloudharness-base/Dockerfile + tag: ${{CLOUDHARNESS_BASE_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/cloudharness-base - title: Cloudharness base - working_directory: ./. - tags: - - ${{CLOUDHARNESS_BASE_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -102,25 +112,23 @@ steps: forceNoCache: includes('${{CLOUDHARNESS_BASE_TAG_FORCE_BUILD}}', '{{CLOUDHARNESS_BASE_TAG_FORCE_BUILD}}') == false cloudharness-frontend-build: + title: Building cloudharness-frontend-build type: build stage: build - dockerfile: infrastructure/base-images/cloudharness-frontend-build/Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/cloudharness-frontend-build + working_directory: . + dockerfile: infrastructure/base-images/cloudharness-frontend-build/Dockerfile + tag: ${{CLOUDHARNESS_FRONTEND_BUILD_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/cloudharness-frontend-build - title: Cloudharness frontend build - working_directory: ./. - tags: - - ${{CLOUDHARNESS_FRONTEND_BUILD_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -129,25 +137,23 @@ steps: forceNoCache: includes('${{CLOUDHARNESS_FRONTEND_BUILD_TAG_FORCE_BUILD}}', '{{CLOUDHARNESS_FRONTEND_BUILD_TAG_FORCE_BUILD}}') == false nfsserver: + title: Building nfsserver type: build stage: build - dockerfile: Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/nfsserver + working_directory: applications/nfsserver + dockerfile: Dockerfile + tag: ${{NFSSERVER_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/nfsserver - title: Nfsserver - working_directory: ./applications/nfsserver - tags: - - ${{NFSSERVER_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -156,26 +162,23 @@ steps: forceNoCache: includes('${{NFSSERVER_TAG_FORCE_BUILD}}', '{{NFSSERVER_TAG_FORCE_BUILD}}') == false test-e2e: + title: Building test-e2e type: build stage: build - dockerfile: Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/test-e2e + working_directory: test/test-e2e + dockerfile: Dockerfile + tag: ${{TEST_E2E_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/test-e2e - title: Test e2e - working_directory: ./test/test-e2e - tags: - - ${{TEST_E2E_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} - - latest + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -189,26 +192,24 @@ steps: stage: build steps: cloudharness-django: + title: Building cloudharness-django type: build stage: build - dockerfile: Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/cloudharness-django + working_directory: infrastructure/common-images/cloudharness-django + dockerfile: Dockerfile + tag: ${{CLOUDHARNESS_DJANGO_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} - CLOUDHARNESS_BASE=${{REGISTRY}}/cloud-harness/cloudharness-base:${{CLOUDHARNESS_BASE_TAG}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/cloudharness-django - title: Cloudharness django - working_directory: ./infrastructure/common-images/cloudharness-django - tags: - - ${{CLOUDHARNESS_DJANGO_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -217,26 +218,24 @@ steps: forceNoCache: includes('${{CLOUDHARNESS_DJANGO_TAG_FORCE_BUILD}}', '{{CLOUDHARNESS_DJANGO_TAG_FORCE_BUILD}}') == false cloudharness-flask: + title: Building cloudharness-flask type: build stage: build - dockerfile: Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/cloudharness-flask + working_directory: infrastructure/common-images/cloudharness-flask + dockerfile: Dockerfile + tag: ${{CLOUDHARNESS_FLASK_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} - CLOUDHARNESS_BASE=${{REGISTRY}}/cloud-harness/cloudharness-base:${{CLOUDHARNESS_BASE_TAG}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/cloudharness-flask - title: Cloudharness flask - working_directory: ./infrastructure/common-images/cloudharness-flask - tags: - - ${{CLOUDHARNESS_FLASK_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -245,26 +244,24 @@ steps: forceNoCache: includes('${{CLOUDHARNESS_FLASK_TAG_FORCE_BUILD}}', '{{CLOUDHARNESS_FLASK_TAG_FORCE_BUILD}}') == false jupyterhub: + title: Building jupyterhub type: build stage: build - dockerfile: Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/jupyterhub + working_directory: applications/jupyterhub + dockerfile: Dockerfile + tag: ${{JUPYTERHUB_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} - CLOUDHARNESS_BASE=${{REGISTRY}}/cloud-harness/cloudharness-base:${{CLOUDHARNESS_BASE_TAG}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/jupyterhub - title: Jupyterhub - working_directory: ./applications/jupyterhub - tags: - - ${{JUPYTERHUB_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -273,26 +270,24 @@ steps: forceNoCache: includes('${{JUPYTERHUB_TAG_FORCE_BUILD}}', '{{JUPYTERHUB_TAG_FORCE_BUILD}}') == false samples-print-file: + title: Building samples-print-file type: build stage: build - dockerfile: Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/sampleapp-print-file + working_directory: applications/samples/tasks/print-file + dockerfile: Dockerfile + tag: ${{SAMPLES_PRINT_FILE_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} - CLOUDHARNESS_BASE=${{REGISTRY}}/cloud-harness/cloudharness-base:${{CLOUDHARNESS_BASE_TAG}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/sampleapp-print-file - title: Samples print file - working_directory: ./applications/samples/tasks/print-file - tags: - - ${{SAMPLES_PRINT_FILE_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -301,26 +296,24 @@ steps: forceNoCache: includes('${{SAMPLES_PRINT_FILE_TAG_FORCE_BUILD}}', '{{SAMPLES_PRINT_FILE_TAG_FORCE_BUILD}}') == false samples-secret: + title: Building samples-secret type: build stage: build - dockerfile: Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/sampleapp-secret + working_directory: applications/samples/tasks/secret + dockerfile: Dockerfile + tag: ${{SAMPLES_SECRET_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} - CLOUDHARNESS_BASE=${{REGISTRY}}/cloud-harness/cloudharness-base:${{CLOUDHARNESS_BASE_TAG}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/sampleapp-secret - title: Samples secret - working_directory: ./applications/samples/tasks/secret - tags: - - ${{SAMPLES_SECRET_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -329,27 +322,24 @@ steps: forceNoCache: includes('${{SAMPLES_SECRET_TAG_FORCE_BUILD}}', '{{SAMPLES_SECRET_TAG_FORCE_BUILD}}') == false test-api: + title: Building test-api type: build stage: build - dockerfile: test/test-api/Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/test-api + working_directory: . + dockerfile: test/test-api/Dockerfile + tag: ${{TEST_API_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} - CLOUDHARNESS_BASE=${{REGISTRY}}/cloud-harness/cloudharness-base:${{CLOUDHARNESS_BASE_TAG}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/test-api - title: Test api - working_directory: ./. - tags: - - ${{TEST_API_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} - - latest + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -358,26 +348,24 @@ steps: forceNoCache: includes('${{TEST_API_TAG_FORCE_BUILD}}', '{{TEST_API_TAG_FORCE_BUILD}}') == false workflows-extract-download: + title: Building workflows-extract-download type: build stage: build - dockerfile: Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/workflows-extract-download + working_directory: applications/workflows/tasks/extract-download + dockerfile: Dockerfile + tag: ${{WORKFLOWS_EXTRACT_DOWNLOAD_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} - CLOUDHARNESS_BASE=${{REGISTRY}}/cloud-harness/cloudharness-base:${{CLOUDHARNESS_BASE_TAG}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/workflows-extract-download - title: Workflows extract download - working_directory: ./applications/workflows/tasks/extract-download - tags: - - ${{WORKFLOWS_EXTRACT_DOWNLOAD_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -386,26 +374,24 @@ steps: forceNoCache: includes('${{WORKFLOWS_EXTRACT_DOWNLOAD_TAG_FORCE_BUILD}}', '{{WORKFLOWS_EXTRACT_DOWNLOAD_TAG_FORCE_BUILD}}') == false workflows-notify-queue: + title: Building workflows-notify-queue type: build stage: build - dockerfile: Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/workflows-notify-queue + working_directory: applications/workflows/tasks/notify-queue + dockerfile: Dockerfile + tag: ${{WORKFLOWS_NOTIFY_QUEUE_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} - CLOUDHARNESS_BASE=${{REGISTRY}}/cloud-harness/cloudharness-base:${{CLOUDHARNESS_BASE_TAG}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/workflows-notify-queue - title: Workflows notify queue - working_directory: ./applications/workflows/tasks/notify-queue - tags: - - ${{WORKFLOWS_NOTIFY_QUEUE_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -414,26 +400,24 @@ steps: forceNoCache: includes('${{WORKFLOWS_NOTIFY_QUEUE_TAG_FORCE_BUILD}}', '{{WORKFLOWS_NOTIFY_QUEUE_TAG_FORCE_BUILD}}') == false workflows-send-result-event: + title: Building workflows-send-result-event type: build stage: build - dockerfile: Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/workflows-send-result-event + working_directory: applications/workflows/tasks/send-result-event + dockerfile: Dockerfile + tag: ${{WORKFLOWS_SEND_RESULT_EVENT_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} - CLOUDHARNESS_BASE=${{REGISTRY}}/cloud-harness/cloudharness-base:${{CLOUDHARNESS_BASE_TAG}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/workflows-send-result-event - title: Workflows send result event - working_directory: ./applications/workflows/tasks/send-result-event - tags: - - ${{WORKFLOWS_SEND_RESULT_EVENT_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -447,26 +431,24 @@ steps: stage: build steps: common: + title: Building common type: build stage: build - dockerfile: Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/common + working_directory: applications/common/server + dockerfile: Dockerfile + tag: ${{COMMON_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} - CLOUDHARNESS_FLASK=${{REGISTRY}}/cloud-harness/cloudharness-flask:${{CLOUDHARNESS_FLASK_TAG}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/common - title: Common - working_directory: ./applications/common/server - tags: - - ${{COMMON_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -475,27 +457,26 @@ steps: forceNoCache: includes('${{COMMON_TAG_FORCE_BUILD}}', '{{COMMON_TAG_FORCE_BUILD}}') == false samples: + title: Building samples type: build stage: build - dockerfile: test.Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/sampleapp + working_directory: applications/samples + dockerfile: test.Dockerfile + tag: ${{SAMPLES_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} - - CLOUDHARNESS_FRONTEND_BUILD=${{REGISTRY}}/cloud-harness/cloudharness-frontend-build:${{CLOUDHARNESS_FRONTEND_BUILD_TAG}} - CLOUDHARNESS_FLASK=${{REGISTRY}}/cloud-harness/cloudharness-flask:${{CLOUDHARNESS_FLASK_TAG}} + - CLOUDHARNESS_FRONTEND_BUILD=${{REGISTRY}}/cloud-harness/cloudharness-frontend-build:${{CLOUDHARNESS_FRONTEND_BUILD_TAG}} + - CLOUDHARNESS_DJANGO=${{REGISTRY}}/cloud-harness/cloudharness-django:${{CLOUDHARNESS_DJANGO_TAG}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/sampleapp - title: Samples - working_directory: ./applications/samples - tags: - - ${{SAMPLES_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -504,26 +485,24 @@ steps: forceNoCache: includes('${{SAMPLES_TAG_FORCE_BUILD}}', '{{SAMPLES_TAG_FORCE_BUILD}}') == false volumemanager: + title: Building volumemanager type: build stage: build - dockerfile: Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/volumemanager + working_directory: applications/volumemanager/server + dockerfile: Dockerfile + tag: ${{VOLUMEMANAGER_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} - CLOUDHARNESS_FLASK=${{REGISTRY}}/cloud-harness/cloudharness-flask:${{CLOUDHARNESS_FLASK_TAG}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/volumemanager - title: Volumemanager - working_directory: ./applications/volumemanager/server - tags: - - ${{VOLUMEMANAGER_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -532,26 +511,24 @@ steps: forceNoCache: includes('${{VOLUMEMANAGER_TAG_FORCE_BUILD}}', '{{VOLUMEMANAGER_TAG_FORCE_BUILD}}') == false workflows: + title: Building workflows type: build stage: build - dockerfile: Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/workflows + working_directory: applications/workflows/server + dockerfile: Dockerfile + tag: ${{WORKFLOWS_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} - CLOUDHARNESS_FLASK=${{REGISTRY}}/cloud-harness/cloudharness-flask:${{CLOUDHARNESS_FLASK_TAG}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/workflows - title: Workflows - working_directory: ./applications/workflows/server - tags: - - ${{WORKFLOWS_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -565,26 +542,24 @@ steps: stage: build steps: samples-sum: + title: Building samples-sum type: build stage: build - dockerfile: Dockerfile registry: ${{CODEFRESH_REGISTRY}} buildkit: true + image_name: cloud-harness/sampleapp-sum + working_directory: applications/samples/tasks/sum + dockerfile: Dockerfile + tag: ${{SAMPLES_SUM_TAG}} build_arguments: - NOCACHE=${{CF_BUILD_ID}} - SAMPLES=${{REGISTRY}}/cloud-harness/sampleapp:${{SAMPLES_TAG}} + - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - GOLANG=golang:1.26 - ROCKYLINUX=rockylinux/rockylinux:10.1-minimal - - KEYCLOAK=quay.io/keycloak/keycloak:26.5 - - NODE=node:22-alpine - PYTHON=python:3.12-slim-trixie - image_name: cloud-harness/sampleapp-sum - title: Samples sum - working_directory: ./applications/samples/tasks/sum - tags: - - ${{SAMPLES_SUM_TAG}} - - ${{DEPLOYMENT_PUBLISH_TAG}}-dev - - ${{CF_BRANCH_TAG_NORMALIZED_LOWER_CASE}} + - NODE=node:22-alpine + - GATEKEEPER=quay.io/gogatekeeper/gatekeeper:4.6.0 when: condition: any: @@ -618,8 +593,8 @@ steps: custom_value_files: - ./deployment/helm/values.yaml custom_values: - - 'apps_samples-instance1_harness_secrets_asecret="${{ASECRET}}"' - - 'apps_samples_harness_secrets_asecret="${{ASECRET}}"' + - apps_samples_harness_secrets_asecret="${{ASECRET}}" + - apps_samples-instance1_harness_secrets_asecret="${{ASECRET}}" wait_deployment: stage: qa title: Wait deployment to be ready @@ -628,11 +603,14 @@ steps: commands: - kubectl config use-context ${{CLUSTER_NAME}} - kubectl config set-context --current --namespace=test-${{NAMESPACE_BASENAME}} - - kubectl rollout status deployment/volumemanager - - kubectl rollout status deployment/samples-instance1 - kubectl rollout status deployment/accounts - - kubectl rollout status statefulset/samples + - kubectl rollout status deployment/argo-gk - kubectl rollout status deployment/common + - kubectl rollout status statefulset/samples + - kubectl rollout status deployment/www-gk + - kubectl rollout status deployment/samples-instance1 + - kubectl rollout status deployment/samples1-gk + - kubectl rollout status deployment/volumemanager - kubectl rollout status deployment/workflows - sleep 60 tests_nfs_failover: @@ -675,16 +653,6 @@ steps: commands: - echo $APP_NAME scale: - workflows_api_test: - title: workflows api test - volumes: - - ${{CF_REPO_NAME}}/applications/workflows:/home/test - - ${{CF_REPO_NAME}}/deployment/helm/values.yaml:/opt/cloudharness/resources/allvalues.yaml - environment: - - APP_URL=https://workflows.${{DOMAIN}}/api - commands: - - st --pre-run cloudharness_test.apitest_init run api/openapi.yaml --base-url - https://workflows.${{DOMAIN}}/api -c all common_api_test: title: common api test volumes: @@ -711,6 +679,16 @@ steps: --hypothesis-suppress-health-check=too_slow --hypothesis-deadline=180000 --request-timeout=180000 --hypothesis-max-examples=2 --show-trace --exclude-checks=ignored_auth - pytest -v test/api + workflows_api_test: + title: workflows api test + volumes: + - ${{CF_REPO_NAME}}/applications/workflows:/home/test + - ${{CF_REPO_NAME}}/deployment/helm/values.yaml:/opt/cloudharness/resources/allvalues.yaml + environment: + - APP_URL=https://workflows.${{DOMAIN}}/api + commands: + - st --pre-run cloudharness_test.apitest_init run api/openapi.yaml --base-url + https://workflows.${{DOMAIN}}/api -c all hooks: on_fail: exec: diff --git a/tools/deployment-cli-tools/ch_cli_tools/codefresh.py b/tools/deployment-cli-tools/ch_cli_tools/codefresh.py index 1f85151f5..5f62bd108 100644 --- a/tools/deployment-cli-tools/ch_cli_tools/codefresh.py +++ b/tools/deployment-cli-tools/ch_cli_tools/codefresh.py @@ -272,7 +272,7 @@ def _collect_build_step(self, entity): "stage": "build", "registry": "${{CODEFRESH_REGISTRY}}", "buildkit": True, - "image_name": self.qualify(entity.image_name), + "image_name": entity.image_name, "working_directory": self._working_directory_for(context), "dockerfile": str(context.dockerfile.path), "tag": _tag_reference(entity.name), @@ -352,8 +352,9 @@ def _collect_task_build_steps(self, app): def _collect_base_image_build_steps(self, project): build_steps, publish_steps = {}, {} - for base_image in project.base_images.values(): - if not base_image.dockerfile.exists(): + needed = project.all_task_images() + for name, base_image in project.base_images.items(): + if name not in needed or not base_image.dockerfile.exists(): continue key, step = self._collect_build_step(base_image) build_steps[key] = step @@ -416,7 +417,7 @@ def _collect_deployment_secret_values(self, project) -> list[str]: ) values.append( 'apps_%s_harness_secrets_%s="${{%s}}"' - % (app_key, value_path, secret_name.upper()) + % (app_key, value_path, secret_name.replace("-", "_").upper()) ) if app.database.get("connect_string") == "": var_name = f"{_env_key(app.name)}_DB_CONNECT_STRING" diff --git a/tools/deployment-cli-tools/ch_cli_tools/model.py b/tools/deployment-cli-tools/ch_cli_tools/model.py index 0c538be17..821e26b67 100644 --- a/tools/deployment-cli-tools/ch_cli_tools/model.py +++ b/tools/deployment-cli-tools/ch_cli_tools/model.py @@ -277,7 +277,7 @@ def dockerfile(self) -> "CHDockerfile": @property def build_context(self) -> Path: - return self.path + return self.dockerfile.path.parent def __getitem__(self, key) -> "CHAppTask": try: @@ -819,6 +819,20 @@ class CHTestImage(CHBaseImage): def _lower_registry(self, lower: "CHProject") -> dict: return lower.test_images + @property + def build_context(self) -> Path: + # FIXME: test-api's Dockerfile COPYs library/tool sources from outside + # test/test-api, so it needs the project root as its build context, unlike + # test-e2e or any other test image. Legacy hardcoded this exact exception by + # name (old/codefresh.py, codefresh_steps_from_base_path(..., fixed_context=...) + # only for name == "test-api") instead of deriving it from the Dockerfile's own + # COPY instructions - ported as-is rather than introduced here, but still a + # hardcoded special case: a new test image with the same need won't get this + # automatically. + if self.name != "test-api": + return self.path + return self.containing_project.root + class CHAppTask: """A buildable task owned by an app or base image.""" diff --git a/tools/deployment-cli-tools/tests/test_codefresh.py b/tools/deployment-cli-tools/tests/test_codefresh.py index d230a0361..bb2995b57 100644 --- a/tools/deployment-cli-tools/tests/test_codefresh.py +++ b/tools/deployment-cli-tools/tests/test_codefresh.py @@ -106,6 +106,12 @@ def test_create_codefresh_configuration_build_steps(tmp_path): assert myapp_step["buildkit"] is True assert myapp_step["build_arguments"][0] == "NOCACHE=${{CF_BUILD_ID}}" + # image_name must stay bare, no "${{REGISTRY}}/" prefix: the build step + # auto-pushes through the registry integration named by CODEFRESH_REGISTRY, + # which adds its own host. Qualifying image_name here doubles it + # (observed in production as a rejected "us.gcr.io/us.gcr.io/..." push). + assert not myapp_step["image_name"].startswith("${{REGISTRY}}") + # cloudharness-base: overridden by RESOURCES, so it must build from the merged # .overrides directory, not straight from CLOUDHARNESS_ROOT's own tree - same # cross-layer merge CHSkaffold already relies on for its own artifacts. @@ -129,6 +135,27 @@ def test_create_codefresh_configuration_build_steps(tmp_path): assert "myapp-mytask" in steps +def test_create_codefresh_configuration_excludes_base_images_nothing_depends_on( + tmp_path, +): + # Legacy regression: legacy scoped base/common-image build-step generation + # to include=task_images.keys() (same set write_env_file exports pipeline + # tag variables for); ng's rewrite iterated project.base_images + # unconditionally instead, scheduling a build step for every base image in + # the whole chain regardless of whether anything included actually + # depends on it. write_env_file stays correctly scoped, so such a step's + # tag reference is never exported - it fails at build time with an + # unsubstituted "${{..._TAG}}" placeholder. + cf, _ = _generate_cf(tmp_path, ["myapp"]) + steps = _build_steps(cf) + + # myapp's real build dependency must still get a build step. + assert "cloudharness-flask" in steps + # cloudharness-frontend-build: a real base image nothing included here + # depends on - must not get a build step with no tag variable behind it. + assert "cloudharness-frontend-build" not in steps + + def test_create_codefresh_configuration_app_without_build_dependency_still_builds( tmp_path, ): @@ -631,6 +658,50 @@ def test_create_codefresh_configuration_secret_value_containing_quotes(tmp_path) ) +def test_create_codefresh_configuration_secret_name_with_hyphen(tmp_path): + # A hyphen is valid in a Helm --set key but not in a Codefresh pipeline + # variable name, so the reference must substitute it with an underscore - + # ${{EMAIL-PASSWORD}} is left unresolved by Codefresh and then breaks the + # shell ("bad substitution") when the deployment step actually runs. + override_root = write_tree_from_yaml( + tmp_path / "override", + """ + applications: + myapp: + deploy: + values.yaml: | + harness: + secrets: + email-password: null + """, + ) + + roots = [CLOUDHARNESS_ROOT, RESOURCES, override_root] + values = create_helm_chart( + roots, + output_path=tmp_path, + include=["myapp"], + exclude=["events"], + domain="my.local", + namespace="test", + env="dev", + local=False, + tag="1", + registry="reg", + ) + cf = create_codefresh_deployment_scripts( + roots, envs=["dev"], helm_values=values, save=False + ) + + custom_values = cf["steps"]["deployment"]["arguments"]["custom_values"] + entry = next( + v + for v in custom_values + if v.startswith("apps_myapp_harness_secrets_email-password=") + ) + assert entry == 'apps_myapp_harness_secrets_email-password="${{EMAIL_PASSWORD}}"' + + def test_create_codefresh_configuration_api_and_e2e_test_steps(tmp_path): # real cloud-harness samples app: subdomain=www, test.api/test.e2e both # enabled, a real api/openapi.yaml (servers: [{url: /api}]), and both a @@ -659,7 +730,7 @@ def test_create_codefresh_configuration_api_and_e2e_test_steps(tmp_path): # every other image reference embedded in codefresh.yaml. assert ( cf["steps"]["tests_api"]["image"] == - build_steps["test-api"]["image_name"] + ":${{TEST_API_TAG}}" + "${{REGISTRY}}/%s:${{TEST_API_TAG}}" % build_steps["test-api"]["image_name"] ) e2e_steps = cf["steps"]["tests_e2e"]["scale"] @@ -671,7 +742,7 @@ def test_create_codefresh_configuration_api_and_e2e_test_steps(tmp_path): ) assert ( cf["steps"]["tests_e2e"]["image"] == - build_steps["test-e2e"]["image_name"] + ":${{TEST_E2E_TAG}}" + "${{REGISTRY}}/%s:${{TEST_E2E_TAG}}" % build_steps["test-e2e"]["image_name"] ) diff --git a/tools/deployment-cli-tools/tests/test_model.py b/tools/deployment-cli-tools/tests/test_model.py index 765267963..73b0d0fcf 100644 --- a/tools/deployment-cli-tools/tests/test_model.py +++ b/tools/deployment-cli-tools/tests/test_model.py @@ -258,6 +258,10 @@ def test_app_dockerfile_found_under_a_conventional_subdirectory(tmp_path): assert app.dockerfile.exists() assert app.dockerfile.path == app_dir / "server" / "Dockerfile" + # The build context must be the Dockerfile's own directory, not the app + # root: COPY instructions in every such Dockerfile (workflows, common, + # notifications, volumemanager) are written relative to that subdirectory. + assert app.build_context == app_dir / "server" def test_app_dockerfile_prefers_top_level_over_a_conventional_subdirectory(tmp_path): @@ -1151,6 +1155,31 @@ def test_test_image_gets_a_content_hash_tag_that_follows_its_content(tmp_path): assert after != before +def test_test_api_builds_from_project_root_unlike_other_test_images(tmp_path): + # test-api's Dockerfile COPYs libraries/tools from outside test/test-api + # (it needs the whole repo as context); test-e2e's doesn't, same as any + # other test image - test-api is a hardcoded, legacy-matching exception. + write_tree_from_yaml( + tmp_path, + """ + deployment-configuration: + values-template.yaml: | + name: testproj + test: + test-api: + Dockerfile: | + FROM scratch + test-e2e: + Dockerfile: | + FROM scratch + """, + ) + project = chain(tmp_path, config=CHDeployConfig()) + + assert project.test_images["test-api"].build_context == tmp_path + assert project.test_images["test-e2e"].build_context == tmp_path / "test" / "test-e2e" + + def test_deploy_runs_helm_dependency_update_then_upgrade(tmp_path, monkeypatch): calls = [] monkeypatch.setattr(