From 44c7c1a434e9a33dcdf29cccd01b7eaf309f1b3d Mon Sep 17 00:00:00 2001 From: Pawel Kosiec Date: Tue, 5 Apr 2022 19:47:39 +0200 Subject: [PATCH] Resolve TI values for Mattermost installation --- .../bitnami/postgresql/install.yaml | 44 +++++++++----- .../mattermost-team-edition/install.yaml | 58 ++++++++++++++++--- 2 files changed, 79 insertions(+), 23 deletions(-) diff --git a/manifests/implementation/bitnami/postgresql/install.yaml b/manifests/implementation/bitnami/postgresql/install.yaml index 5f42a2da..08ab85e9 100644 --- a/manifests/implementation/bitnami/postgresql/install.yaml +++ b/manifests/implementation/bitnami/postgresql/install.yaml @@ -87,7 +87,7 @@ spec: outputs: artifacts: - name: postgresql - from: "{{steps.resolve-ti-value.outputs.artifacts.ti-artifact}}" + from: "{{steps.resolve-psql-value.outputs.artifacts.ti-artifact}}" steps: - - name: create-helm-args capact-action: jinja2.template @@ -129,10 +129,6 @@ spec: - - name: helm-install capact-action: helm.install - capact-outputTypeInstances: # Defines which artifacts are output TypeInstances - - name: psql-helm-release - from: helm-release - backend: helm-release-storage arguments: artifacts: - name: input-parameters @@ -146,7 +142,8 @@ spec: from: "{{inputs.artifacts.kubeconfig}}" optional: true - - - name: resolve-ti-value + # allows reusing this workflow as a part of other umbrella workflows and read the artifact value + - - name: resolve-psql-value template: resolve-ti-art-value capact-outputTypeInstances: - name: postgresql @@ -159,7 +156,20 @@ spec: - name: backend from: "{{workflow.outputs.artifacts.helm-template-storage}}" - # TODO: PoC - create a proper container + # allows reusing this workflow as a part of other umbrella workflows and read the artifact value + - - name: resolve-helm-rel-value + template: resolve-ti-art-value + capact-outputTypeInstances: + - name: psql-helm-release + from: ti-artifact + backend: helm-release-storage + arguments: + artifacts: + - name: ti-artifact + from: "{{steps.helm-install.outputs.artifacts.helm-release}}" + - name: backend + from: "{{workflow.outputs.artifacts.helm-release-storage}}" + - name: resolve-ti-art-value inputs: artifacts: @@ -172,12 +182,14 @@ spec: - name: ti-artifact path: /ti.yaml container: - image: alpine:latest - command: [ "sh", "-c" ] - args: [ " - echo 'cat /ti.yaml' && - cat /ti.yaml || true && - echo 'cat /backend.yaml' && - cat /backend.yaml || true && - sleep 2 && echo 'value: foo' >> /ti.yaml && exit 0 - " ] + image: ghcr.io/capactio/pr/ti-value-fetcher:PR-697 + env: + - name: APP_LOGGER_DEV_MODE + value: "true" + - name: APP_INPUT_TI_ARTIFACT_FILE_PATH + value: "{{inputs.artifacts.ti-artifact.path}}" + - name: APP_INPUT_BACKEND_TI_FILE_PATH + value: "{{inputs.artifacts.backend.path}}" + - name: APP_OUTPUT_FILE_PATH + value: "{{outputs.artifacts.ti-artifact.path}}" + diff --git a/manifests/implementation/mattermost/mattermost-team-edition/install.yaml b/manifests/implementation/mattermost/mattermost-team-edition/install.yaml index 4e977eb2..e496e1e4 100644 --- a/manifests/implementation/mattermost/mattermost-team-edition/install.yaml +++ b/manifests/implementation/mattermost/mattermost-team-edition/install.yaml @@ -100,7 +100,7 @@ spec: outputs: artifacts: - name: mattermost-config - from: "{{steps.helm-install.outputs.artifacts.additional}}" + from: "{{steps.resolve-ti-value.outputs.artifacts.ti-artifact}}" steps: # Install DB - - name: install-db @@ -463,19 +463,40 @@ spec: - - name: helm-install capact-action: helm.install + arguments: + artifacts: + - name: input-parameters + from: "{{steps.create-helm-args.outputs.artifacts.render}}" + - name: runner-context + from: "{{workflow.outputs.artifacts.runner-context}}" + + # allows reusing this workflow as a part of other umbrella workflows and read the artifact value + - - name: resolve-ti-value + template: resolve-ti-art-value capact-outputTypeInstances: - name: mattermost-config - from: additional + from: ti-artifact backend: helm-template-storage + arguments: + artifacts: + - name: ti-artifact + from: "{{steps.helm-install.outputs.artifacts.additional}}" + - name: backend + from: "{{workflow.outputs.artifacts.helm-template-storage}}" + + # allows reusing this workflow as a part of other umbrella workflows and read the artifact value + - - name: resolve-helm-rel-value + template: resolve-ti-art-value + capact-outputTypeInstances: - name: mattermost-helm-release - from: helm-release + from: ti-artifact backend: helm-release-storage arguments: artifacts: - - name: input-parameters - from: "{{steps.create-helm-args.outputs.artifacts.render}}" - - name: runner-context - from: "{{workflow.outputs.artifacts.runner-context}}" + - name: ti-artifact + from: "{{steps.helm-install.outputs.artifacts.helm-release}}" + - name: backend + from: "{{workflow.outputs.artifacts.helm-release-storage}}" - name: prepare-parameters inputs: @@ -497,3 +518,26 @@ spec: artifacts: - name: merged path: /merged.yaml + + - name: resolve-ti-art-value + inputs: + artifacts: + - name: ti-artifact + path: /ti.yaml + - name: backend + path: /backend.yaml + outputs: + artifacts: + - name: ti-artifact + path: /ti.yaml + container: + image: ghcr.io/capactio/pr/ti-value-fetcher:PR-697 + env: + - name: APP_LOGGER_DEV_MODE + value: "true" + - name: APP_INPUT_TI_ARTIFACT_FILE_PATH + value: "{{inputs.artifacts.ti-artifact.path}}" + - name: APP_INPUT_BACKEND_TI_FILE_PATH + value: "{{inputs.artifacts.backend.path}}" + - name: APP_OUTPUT_FILE_PATH + value: "{{outputs.artifacts.ti-artifact.path}}"