Replies: 3 comments 1 reply
-
|
In case you use a apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
[...]
resources:
- git@gitlab.company.com:path/to/project.git/path/to/resource?ref=masterI use this mechanic in several workflow projects. I'm not 100% sure though, that this is what you wanted. |
Beta Was this translation helpful? Give feedback.
-
|
I have exactly the same problem as of today. |
Beta Was this translation helpful? Give feedback.
-
|
@fguendling I ended up reinventing the wheel. I tried multiple ways to pass parameters from the invoking workflow to the invoked workflow, but nothing seemed to work, so I ended up using a 3 steps workaround.
Here is a redacted for brevity version of a plausible config (I use Helm to generate my workflow templates): ---
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: submit-workflow-from-git
spec:
entrypoint: main
arguments:
parameters:
{{- $workflowParameters := list "repository" "branch" "file" -}}
{{- range $workflowParameters }}
- name: {{ . }}
{{- end }}
templates:
- name: main
steps:
- - name: get-workflow-from-git
templateRef:
name: git-tools
template: shallow-clone-repository
arguments:
parameters:
- {name: repository, value: "{{`{{workflow.parameters.repository}}`}}"}
- {name: branch, value: "{{`{{workflow.parameters.branch}}`}}"}
- - name: patch-workflow
inline:
outputs:
artifacts:
- name: workflow-manifest
path: ".argo-workflows/{{`{{workflow.parameters.file}}`}}.yaml"
archive:
none: {}
script:
image: busybox
workingDir: /workspace
env:
- name: FILE
value: ".argo-workflows/{{`{{workflow.parameters.file}}`}}.yaml"
command: [ash, -euo, pipefail]
source: |
echo ===== Generating Workflow global parameters ...
cat << 'EOF' > $FILE.tmp
{{- range $workflowParameters }}
- name: {{ . }}
value: "{{`{{workflow.parameters.`}}{{ . }}{{`}}`}}"
{{- end }}
EOF
echo ===== Injecting generated global parameters into Workflow manifest ...
sed -i "/__PARAMETERS_PLACEHOLDER__/ r $FILE.tmp" $FILE
cat $FILE
volumeMounts:
- name: workspace
mountPath: /workspace
- - name: submit-workflow
arguments:
artifacts:
- name: workflow-manifest
from: "{{`{{steps.patch-workflow.outputs.artifacts.workflow-manifest}}`}}"
#parameters: (Disabled because it does not seem to work with `manifestFrom`)
inline:
inputs:
artifacts:
- name: workflow-manifest
path: /tmp/manifest.yaml # Not customizable since `resource.manifestFrom.manifestFrom` has this path hardcoded
resource:
action: create
manifestFrom:
artifact:
name: workflow-manifest
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
My goal is to submit a workflow whose YAML manifest is in a remote Git repository.
Of course I could reinvent the wheel and use multiple steps with custom 'container' templates (one to clone the repo, another to submit the fetched workflow manifest), but to keep things lean instead I would like to leverage Argo Workflows built-in features as much as possible. Namely:
However I cannot find any example of how to use both features combined. Reading the CRDs specs this is the best I've come up with to submit https://github.com/argoproj/argo-workflows/blob/main/examples/hello-world.yaml in a single step:
Unfortunately, the above config fails with
read /src: is a directoryerror message.So my question is, how can I make a 'resource' template to get its manifest from a hard-wired Git input artifact?
Beta Was this translation helpful? Give feedback.
All reactions