From 9650740fd19ce89f4fa296bad2c3baf8836b6564 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Thu, 24 Aug 2023 10:01:57 +0200 Subject: Add Argo Workflows --- .../resources/workflow-templates/fetch-git.yaml | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 data.d/k3s-master/manifests.d/tyilnet/cicd-system/resources/workflow-templates/fetch-git.yaml (limited to 'data.d/k3s-master/manifests.d/tyilnet/cicd-system/resources/workflow-templates/fetch-git.yaml') 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}}" +... -- cgit v1.1