Skip to content

Commit

Permalink
Resolve TI values for Mattermost installation
Browse files Browse the repository at this point in the history
  • Loading branch information
pkosiec committed Apr 8, 2022
1 parent b8a4f56 commit c8fd995
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 23 deletions.
44 changes: 28 additions & 16 deletions manifests/implementation/bitnami/postgresql/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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-resolver: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}}"

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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}}"

0 comments on commit c8fd995

Please sign in to comment.