diff options
author | Patrick Spek <p.spek@tyil.nl> | 2023-08-24 10:01:57 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2023-08-24 10:01:57 +0200 |
commit | 9650740fd19ce89f4fa296bad2c3baf8836b6564 (patch) | |
tree | f1e4f6cd4a4ec9b44dd40c9564328810852da978 /data.d/k3s-master/manifests.d/tyilnet/cicd-system/resources/workflow-templates/fetch-git.yaml | |
parent | c765930403eaa140a2ff2cd05f8a9daea00eb10d (diff) |
Add Argo Workflows
Diffstat (limited to 'data.d/k3s-master/manifests.d/tyilnet/cicd-system/resources/workflow-templates/fetch-git.yaml')
-rw-r--r-- | data.d/k3s-master/manifests.d/tyilnet/cicd-system/resources/workflow-templates/fetch-git.yaml | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/data.d/k3s-master/manifests.d/tyilnet/cicd-system/resources/workflow-templates/fetch-git.yaml b/data.d/k3s-master/manifests.d/tyilnet/cicd-system/resources/workflow-templates/fetch-git.yaml new file mode 100644 index 0000000..785028d --- /dev/null +++ b/data.d/k3s-master/manifests.d/tyilnet/cicd-system/resources/workflow-templates/fetch-git.yaml @@ -0,0 +1,46 @@ +--- +apiVersion: argoproj.io/v1alpha1 +kind: WorkflowTemplate +metadata: + name: fetch-git + namespace: cicd-system +spec: + arguments: + parameters: + - name: repo + value: "" + - name: ref + value: master + - name: path + value: "/usr/src" + templates: + - name: main + inputs: + parameters: + - name: repo + value: "{{workflow.parameters.repo}}" + - name: ref + value: "{{workflow.parameters.ref}}" + - name: path + value: "{{workflow.parameters.path}}" + outputs: + artifacts: + - name: src + path: "{{inputs.parameters.path}}" + script: + image: debian + command: + - dash + source: | + export DEBIAN_FRONTEND=noninteractive + export GIT_WORK_TREE="{{inputs.parameters.path}}" + export GIT_DIR="$(mktemp -d)" + mkdir -pv -- "$GIT_WORK_TREE" + + apt update && apt install -y git + + git init + git remote add origin "{{inputs.parameters.repo}}" + git fetch origin -a + git reset --hard "origin/{{inputs.parameters.ref}}" +... |