From 86466010ef6cf63fb1f576bd51bae41119776520 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Tue, 20 Jul 2021 18:38:46 +0100 Subject: [PATCH 001/132] no message --- templates/workflow-template/workflow-template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index 7967b3c..0ff1994 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -1,5 +1,5 @@ apiVersion: argoproj.io/v1alpha1 -kind: Workflow +kind: WorkflowTemplate metadata: name: push-to-registry-template spec: From dc9a526bf9af84bfe09301c3bf4dccb05993384a Mon Sep 17 00:00:00 2001 From: itmwiw Date: Tue, 20 Jul 2021 18:55:42 +0100 Subject: [PATCH 002/132] no message --- Chart.yaml | 17 +++++++++++++++++ values.yaml | 28 ++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 Chart.yaml create mode 100644 values.yaml diff --git a/Chart.yaml b/Chart.yaml new file mode 100644 index 0000000..23abe36 --- /dev/null +++ b/Chart.yaml @@ -0,0 +1,17 @@ +apiVersion: v2 +name: helm-pipelines +description: Install argo-workflow and argo-events on Openshift clusters +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 \ No newline at end of file diff --git a/values.yaml b/values.yaml new file mode 100644 index 0000000..b17c138 --- /dev/null +++ b/values.yaml @@ -0,0 +1,28 @@ +argoWorkflow: + repository: + version: 0.2.7 + config: + singleNamespace: false + workflow: + serviceAccount: + create: true + name: "argo-workflow" + rbac: + create: true + controller: + containerRuntimeExecutor: k8sapi # otherwise, if the default value 'docker' kept instead, the serviceAccount won't work with restricted scc + +argoEvent: + repository: + version: 1.6.4 + config: + securityContext: + runAsNonRoot: true + runAsUser: null + + +argocdConfig: + generators: [] + project: + create: false + name: default From 63019451926cf9b402fcd09789c4ae051074a7ba Mon Sep 17 00:00:00 2001 From: itmwiw Date: Tue, 20 Jul 2021 18:57:20 +0100 Subject: [PATCH 003/132] no message --- Chart.yaml => Chart | 0 values.yaml => values | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename Chart.yaml => Chart (100%) rename values.yaml => values (100%) diff --git a/Chart.yaml b/Chart similarity index 100% rename from Chart.yaml rename to Chart diff --git a/values.yaml b/values similarity index 100% rename from values.yaml rename to values From 061a2e954f35fb0bc019e78adcaa763f1379a54b Mon Sep 17 00:00:00 2001 From: itmwiw Date: Wed, 21 Jul 2021 23:33:16 +0100 Subject: [PATCH 004/132] no message --- templates/event-source/github.yaml | 103 ++++++++++++++++++ .../secrets/chartmuseum-secret.yaml | 9 ++ .../workflow-template/workflow-template.yaml | 11 +- 3 files changed, 119 insertions(+), 4 deletions(-) create mode 100644 templates/event-source/github.yaml create mode 100644 templates/workflow-template/secrets/chartmuseum-secret.yaml diff --git a/templates/event-source/github.yaml b/templates/event-source/github.yaml new file mode 100644 index 0000000..a013632 --- /dev/null +++ b/templates/event-source/github.yaml @@ -0,0 +1,103 @@ +# Info on GitHub Webhook: https://developer.github.com/v3/repos/hooks/#create-a-hook +apiVersion: argoproj.io/v1alpha1 +kind: EventSource +metadata: + name: github +spec: + service: + ports: + - port: 12000 + targetPort: 12000 + github: + example: + repositories: + - owner: itmwiw + names: + - advatys + # Github will send events to following port and endpoint + webhook: + # endpoint to listen to events on + endpoint: /push + # port to run internal HTTP server on + port: "12000" + # HTTP request method to allow. In this case, only POST requests are accepted + method: POST + # url the event-source will use to register at Github. + # This url must be reachable from outside the cluster. + # The name for the service is in `-eventsource-svc` format. + # You will need to create an Ingress or Openshift Route for the event-source service so that it can be reached from GitHub. + url: http://github-event.apps.advatys.thadvatys.com + # type of events to listen to. + # following listens to everything, hence * + # You can find more info on https://developer.github.com/v3/activity/events/types/ + events: + - "push" + # apiToken refers to K8s secret that stores the github api token + # if apiToken is provided controller will create webhook on GitHub repo + # +optional + apiToken: + # Name of the K8s secret that contains the access token + name: git-secret + # Key within the K8s secret whose corresponding value (must be base64 encoded) is access token + key: git_token + +# # webhookSecret refers to K8s secret that stores the github hook secret +# # +optional +# webhookSecret: +# # Name of the K8s secret that contains the hook secret +# name: github-access +# # Key within the K8s secret whose corresponding value (must be base64 encoded) is hook secret +# key: secret + + # type of the connection between event-source and Github. + # You should set it to false to avoid man-in-the-middle and other attacks. + insecure: true + # Determines if notifications are sent when the webhook is triggered + active: true + # The media type used to serialize the payloads + contentType: json + +# example-without-api-credentials: +# owner: "argoproj" +# repository: "argo" +# webhook: +# endpoint: "/push" +# port: "13000" +# method: "POST" +# events: +# - "*" +# webhookSecret: +# name: github-access +# key: secret +# insecure: true +# active: true +# contentType: "json" + +# example-with-secure-connection: +# owner: "argoproj" +# repository: "argo" +# webhook: +# endpoint: "/push" +# port: "13000" +# method: "POST" +# url: "http://myargofakeurl.fake" +# # k8s secret that contains the cert +# serverCertSecret: +# name: my-secret +# key: cert-key +# # k8s secret that contains the private key +# serverKeySecret: +# name: my-secret +# key: pk-key +# events: +# - "push" +# - "delete" +# apiToken: +# name: github-access +# key: token +# webhookSecret: +# name: github-access +# key: secret +# insecure: true +# active: true +# contentType: "json" \ No newline at end of file diff --git a/templates/workflow-template/secrets/chartmuseum-secret.yaml b/templates/workflow-template/secrets/chartmuseum-secret.yaml new file mode 100644 index 0000000..035b11d --- /dev/null +++ b/templates/workflow-template/secrets/chartmuseum-secret.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Secret +metadata: + name: charmuseum-secret +type: Opaque +stringData: + CHARTMUSEUM_USERNAME: "chartmuseum_username" + CHARTMUSEUM_PASSWORD: "chartmuseum_password" + CHARTMUSEUM_TOKEN: "charmuseum_token" diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index 0ff1994..fe7572f 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -141,11 +141,14 @@ spec: imagePullPolicy: IfNotPresent command: [sh] source: | - export HELM_EXPERIMENTAL_OCI=1 - helm registry login {{ workflow.parameters.registry }} --username $registry_username --password $registry_password cd /mnt/vol/git-local-dir - helm chart save . {{ workflow.parameters.chartname }} - helm chart push {{ workflow.parameters.chartname }} + helm package . + curl --data-binary "@$(grep -A0 'name:' ./Chart.yaml | awk '{ print $2}')-$(grep -A0 'version:' ./Chart.yaml | awk '{ print $2}').tgz" {{ workflow.parameters.registry }}/api/charts +# export HELM_EXPERIMENTAL_OCI=1 +# helm registry login {{ workflow.parameters.registry }} --username $registry_username --password $registry_password +# cd /mnt/vol/git-local-dir +# helm chart save . {{ workflow.parameters.chartname }} +# helm chart push {{ workflow.parameters.chartname }} env: - name: registry_username From b6a3752d3f8b148c1a26d2e1b48408a965f8ec1d Mon Sep 17 00:00:00 2001 From: itmwiw Date: Wed, 21 Jul 2021 23:37:03 +0100 Subject: [PATCH 005/132] add eventsource --- templates/event-source/github.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/event-source/github.yaml b/templates/event-source/github.yaml index a013632..247a9f1 100644 --- a/templates/event-source/github.yaml +++ b/templates/event-source/github.yaml @@ -4,12 +4,13 @@ kind: EventSource metadata: name: github spec: + eventBusName: argo-configuration-default service: ports: - port: 12000 targetPort: 12000 github: - example: + push: repositories: - owner: itmwiw names: From c9b9d3ca5507252f30032b3c6ce82607838efaa6 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Wed, 21 Jul 2021 23:51:04 +0100 Subject: [PATCH 006/132] no message --- templates/event-source/github.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/event-source/github.yaml b/templates/event-source/github.yaml index 247a9f1..7ecb3a1 100644 --- a/templates/event-source/github.yaml +++ b/templates/event-source/github.yaml @@ -40,7 +40,7 @@ spec: # Name of the K8s secret that contains the access token name: git-secret # Key within the K8s secret whose corresponding value (must be base64 encoded) is access token - key: git_token + key: GIT_TOKEN # # webhookSecret refers to K8s secret that stores the github hook secret # # +optional From 4805b65fbdc0da7a1802fa7959fee007f8093d91 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Thu, 22 Jul 2021 11:23:00 +0100 Subject: [PATCH 007/132] no message --- templates/event-source/github-route.yaml | 21 +++++++++++ templates/sensor/github-push.yaml | 47 ++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 templates/event-source/github-route.yaml create mode 100644 templates/sensor/github-push.yaml diff --git a/templates/event-source/github-route.yaml b/templates/event-source/github-route.yaml new file mode 100644 index 0000000..aa394ef --- /dev/null +++ b/templates/event-source/github-route.yaml @@ -0,0 +1,21 @@ +kind: Route +apiVersion: route.openshift.io/v1 +metadata: + name: github-event + namespace: argo-events + labels: + app.kubernetes.io/instance: helm-pipeline + controller: eventsource-controller + eventsource-name: github + owner-name: github + +spec: + host: github-event.apps.advatys.thadvatys.com + to: + kind: Service + name: github-eventsource-svc + weight: 100 + port: + targetPort: 12000 + wildcardPolicy: None + diff --git a/templates/sensor/github-push.yaml b/templates/sensor/github-push.yaml new file mode 100644 index 0000000..2bfdb8e --- /dev/null +++ b/templates/sensor/github-push.yaml @@ -0,0 +1,47 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Sensor +metadata: + name: github-push +spec: + eventBusName: argo-configuration-default + template: + serviceAccountName: argo-configuration-operate-workflow-sa + dependencies: + - name: github-push-event + eventSourceName: github + eventName: push + triggers: + - template: + name: webhook-workflow-trigger + k8s: + group: argoproj.io + version: v1alpha1 + resource: workflows + operation: create + source: + resource: + apiVersion: argoproj.io/v1alpha1 + kind: Workflow + metadata: + generateName: webhook- + #namespace: argo + spec: + entrypoint: whalesay + arguments: + parameters: + - name: message + # the value will get overridden by event payload from github-push-event + value: hello world + templates: + - name: whalesay + inputs: + parameters: + - name: message + container: + image: docker/whalesay:latest + command: [cowsay] + args: ["{{inputs.parameters.message}}"] + parameters: + - src: + dependencyName: github-push-event + dest: spec.arguments.parameters.0.value \ No newline at end of file From b7b50a61ce602a11fc601f1deef89c0916d59628 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Thu, 22 Jul 2021 12:16:14 +0100 Subject: [PATCH 008/132] no message --- templates/sensor/github-push.yaml | 72 ++++++++++++++++++++++++------- 1 file changed, 57 insertions(+), 15 deletions(-) diff --git a/templates/sensor/github-push.yaml b/templates/sensor/github-push.yaml index 2bfdb8e..b307cac 100644 --- a/templates/sensor/github-push.yaml +++ b/templates/sensor/github-push.yaml @@ -10,9 +10,33 @@ spec: - name: github-push-event eventSourceName: github eventName: push +# filters: +# data: +# # Name of the event that triggered the delivery: [pull_request, push, yadayadayada] +# # https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads +# - path: body.X-GitHub-Event +# type: string +# value: +# - pull_request +# - path: body.action +# type: string +# value: +# - opened +# - edited +# - reopened +# - synchronize +# - path: body.pull_request.state +# type: string +# value: +# - open +# - path: body.pull_request.base.ref +# type: string +# value: +# - master + triggers: - template: - name: webhook-workflow-trigger + name: github-workflow-trigger k8s: group: argoproj.io version: v1alpha1 @@ -23,25 +47,43 @@ spec: apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: - generateName: webhook- - #namespace: argo + name: github- spec: entrypoint: whalesay arguments: parameters: - - name: message - # the value will get overridden by event payload from github-push-event - value: hello world + - name: git-owner + - name: git-repository + - name: git-ref templates: - - name: whalesay - inputs: - parameters: - - name: message - container: - image: docker/whalesay:latest - command: [cowsay] - args: ["{{inputs.parameters.message}}"] + - name: whalesay + inputs: + parameters: + - name: git-owner + - name: git-repository + - name: git-ref + container: + image: docker/whalesay:latest + command: [cowsay] + args: ["{{inputs.parameters.git-repository}}"] parameters: - src: dependencyName: github-push-event - dest: spec.arguments.parameters.0.value \ No newline at end of file + dataKey: body.repository.owner.name + dest: spec.arguments.parameters.0.value + - src: + dependencyName: github-push-event + dataKey: body.repository.name + dest: spec.arguments.parameters.1.value + - src: + dependencyName: github-push-event + dataTemplate: "{{ .Input.body.ref | substr 0 7 }}" + dest: spec.arguments.parameters.2.value + # Append pull request number and short sha to dynamically assign worklfow name + # - src: + # dependencyName: github-push-event + # dataTemplate: "{{ .Input.body.pull_request.number }}-{{ .Input.body.pull_request.head.sha | substr 0 7 }}" + # dest: metadata.name + # operation: append + retryStrategy: + steps: 3 \ No newline at end of file From e3990c0b1059503604e24402e92a66da5e8bbb2e Mon Sep 17 00:00:00 2001 From: itmwiw Date: Thu, 22 Jul 2021 12:31:21 +0100 Subject: [PATCH 009/132] no message --- templates/sensor/github-push.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/sensor/github-push.yaml b/templates/sensor/github-push.yaml index b307cac..04becdf 100644 --- a/templates/sensor/github-push.yaml +++ b/templates/sensor/github-push.yaml @@ -75,10 +75,10 @@ spec: dependencyName: github-push-event dataKey: body.repository.name dest: spec.arguments.parameters.1.value - - src: - dependencyName: github-push-event - dataTemplate: "{{ .Input.body.ref | substr 0 7 }}" - dest: spec.arguments.parameters.2.value +# - src: +# dependencyName: github-push-event +# dataTemplate: "{{ .Input.body.ref | substr 0 7 }}" +# dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name # - src: # dependencyName: github-push-event From 85ff8b816f212828e5ef29ce3b7a0a11fe820ebb Mon Sep 17 00:00:00 2001 From: itmwiw Date: Thu, 22 Jul 2021 12:44:24 +0100 Subject: [PATCH 010/132] no message --- templates/sensor/github-push.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/sensor/github-push.yaml b/templates/sensor/github-push.yaml index 04becdf..3a7e548 100644 --- a/templates/sensor/github-push.yaml +++ b/templates/sensor/github-push.yaml @@ -85,5 +85,5 @@ spec: # dataTemplate: "{{ .Input.body.pull_request.number }}-{{ .Input.body.pull_request.head.sha | substr 0 7 }}" # dest: metadata.name # operation: append - retryStrategy: - steps: 3 \ No newline at end of file +# retryStrategy: +# steps: 3 \ No newline at end of file From c76d9f6762d726627a2c0cc43b72dbb013f9186f Mon Sep 17 00:00:00 2001 From: itmwiw Date: Thu, 22 Jul 2021 22:07:51 +0100 Subject: [PATCH 011/132] no message --- templates/sensor/github-push.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/sensor/github-push.yaml b/templates/sensor/github-push.yaml index 3a7e548..aabcc60 100644 --- a/templates/sensor/github-push.yaml +++ b/templates/sensor/github-push.yaml @@ -65,7 +65,7 @@ spec: container: image: docker/whalesay:latest command: [cowsay] - args: ["{{inputs.parameters.git-repository}}"] + args: ["{{inputs.parameters.git-ref}}"] parameters: - src: dependencyName: github-push-event @@ -75,10 +75,10 @@ spec: dependencyName: github-push-event dataKey: body.repository.name dest: spec.arguments.parameters.1.value -# - src: -# dependencyName: github-push-event + - src: + dependencyName: github-push-event # dataTemplate: "{{ .Input.body.ref | substr 0 7 }}" -# dest: spec.arguments.parameters.2.value + dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name # - src: # dependencyName: github-push-event From 74319a9c3fdfbdf5e79cba5efcde9d5293b150e7 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Thu, 22 Jul 2021 22:13:38 +0100 Subject: [PATCH 012/132] no message --- templates/sensor/github-push.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/sensor/github-push.yaml b/templates/sensor/github-push.yaml index aabcc60..96a6812 100644 --- a/templates/sensor/github-push.yaml +++ b/templates/sensor/github-push.yaml @@ -69,11 +69,11 @@ spec: parameters: - src: dependencyName: github-push-event - dataKey: body.repository.owner.name +# dataKey: body.repository.owner.name dest: spec.arguments.parameters.0.value - src: dependencyName: github-push-event - dataKey: body.repository.name +# dataKey: body.repository.name dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event From 32559a50c68f650fa12d5ef2c08851e9d70b759b Mon Sep 17 00:00:00 2001 From: itmwiw Date: Thu, 22 Jul 2021 22:21:15 +0100 Subject: [PATCH 013/132] no message --- templates/sensor/github-push.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/sensor/github-push.yaml b/templates/sensor/github-push.yaml index 96a6812..62cf006 100644 --- a/templates/sensor/github-push.yaml +++ b/templates/sensor/github-push.yaml @@ -47,7 +47,8 @@ spec: apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: - name: github- +# name: github- + generateName: github- spec: entrypoint: whalesay arguments: From 9b6789547cc22018e31367ac9541b38bf353a07f Mon Sep 17 00:00:00 2001 From: itmwiw Date: Thu, 22 Jul 2021 22:25:03 +0100 Subject: [PATCH 014/132] no message --- templates/sensor/github-push.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/sensor/github-push.yaml b/templates/sensor/github-push.yaml index 62cf006..504f041 100644 --- a/templates/sensor/github-push.yaml +++ b/templates/sensor/github-push.yaml @@ -66,19 +66,19 @@ spec: container: image: docker/whalesay:latest command: [cowsay] - args: ["{{inputs.parameters.git-ref}}"] + args: ["{{inputs.parameters.git-repository}}"] parameters: - src: dependencyName: github-push-event -# dataKey: body.repository.owner.name + dataKey: body.repository.owner.name dest: spec.arguments.parameters.0.value - src: dependencyName: github-push-event -# dataKey: body.repository.name + dataKey: body.repository.name dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event -# dataTemplate: "{{ .Input.body.ref | substr 0 7 }}" + dataTemplate: "{{ .Input.body.ref | substr 0 7 }}" dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name # - src: From 90d13bf4be07ea711b4523f0122242434b1dfe4f Mon Sep 17 00:00:00 2001 From: itmwiw Date: Thu, 22 Jul 2021 22:58:54 +0100 Subject: [PATCH 015/132] no message --- .../workflow-template/workflow-template.yaml | 40 ++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index fe7572f..dbdaec0 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -10,6 +10,9 @@ spec: - name: git-url value: "git_url" + + - name: git-path + value: "git_path" - name: registry-type value: "private_registry" # Can be "aws" or "private_registry" @@ -59,6 +62,10 @@ spec: - - name: private-registry template: private-registry when: "{{ workflow.parameters.registry-type }} == private_registry" + + - - name: chartmuseum-registry + template: private-registry + when: "{{ workflow.parameters.registry-type }} == chartmuseum" - name: pull-repo script: @@ -136,19 +143,42 @@ spec: mountPath: /mnt/vol - name: private-registry + script: + image: alpine/helm:3.5.4 + imagePullPolicy: IfNotPresent + command: [sh] + source: | + export HELM_EXPERIMENTAL_OCI=1 + helm registry login {{ workflow.parameters.registry }} --username $registry_username --password $registry_password + cd /mnt/vol/git-local-dir + helm chart save . {{ workflow.parameters.chartname }} + helm chart push {{ workflow.parameters.chartname }} + + env: + - name: registry_username + valueFrom: + secretKeyRef: + name: password + key: USERNAME + - name: registry_password + valueFrom: + secretKeyRef: + name: aws-secret + key: password + volumeMounts: + - name: workdir + mountPath: /mnt/vol + + - name: chartmuseum-registry script: image: alpine/helm:3.5.4 imagePullPolicy: IfNotPresent command: [sh] source: | cd /mnt/vol/git-local-dir + cd {{ workflow.parameters.git-path }} helm package . curl --data-binary "@$(grep -A0 'name:' ./Chart.yaml | awk '{ print $2}')-$(grep -A0 'version:' ./Chart.yaml | awk '{ print $2}').tgz" {{ workflow.parameters.registry }}/api/charts -# export HELM_EXPERIMENTAL_OCI=1 -# helm registry login {{ workflow.parameters.registry }} --username $registry_username --password $registry_password -# cd /mnt/vol/git-local-dir -# helm chart save . {{ workflow.parameters.chartname }} -# helm chart push {{ workflow.parameters.chartname }} env: - name: registry_username From bf5f322769354e34d4212845bd643f2814cacd63 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Thu, 22 Jul 2021 23:08:44 +0100 Subject: [PATCH 016/132] no message --- templates/workflow-template/workflow-template.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index dbdaec0..ee834e4 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -184,13 +184,13 @@ spec: - name: registry_username valueFrom: secretKeyRef: - name: password - key: USERNAME + name: charmuseum-secret + key: CHARTMUSEUM_USERNAME - name: registry_password valueFrom: secretKeyRef: - name: aws-secret - key: password + name: charmuseum-secret + key: CHARTMUSEUM_PASSWORD volumeMounts: - name: workdir mountPath: /mnt/vol From 844166eed47a1d24e463ded82004acb357b6c0a0 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Thu, 22 Jul 2021 23:20:50 +0100 Subject: [PATCH 017/132] no message --- templates/workflow-template/workflow-template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index ee834e4..a0b60fd 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -64,7 +64,7 @@ spec: when: "{{ workflow.parameters.registry-type }} == private_registry" - - name: chartmuseum-registry - template: private-registry + template: chartmuseum-registry when: "{{ workflow.parameters.registry-type }} == chartmuseum" - name: pull-repo From 19249cf850f174369fc5b1ce519ea611d3fc7cc0 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Thu, 22 Jul 2021 23:52:08 +0100 Subject: [PATCH 018/132] no message --- .../workflow-template/workflow-template.yaml | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index a0b60fd..cb6a88f 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -62,9 +62,13 @@ spec: - - name: private-registry template: private-registry when: "{{ workflow.parameters.registry-type }} == private_registry" + + - - name: helm-package + template: helm-package + when: "{{ workflow.parameters.registry-type }} == chartmuseum" - - - name: chartmuseum-registry - template: chartmuseum-registry + - - name: push-to-chartmuseum + template: push-to-chartmuseum when: "{{ workflow.parameters.registry-type }} == chartmuseum" - name: pull-repo @@ -169,7 +173,7 @@ spec: - name: workdir mountPath: /mnt/vol - - name: chartmuseum-registry + - name: helm-package script: image: alpine/helm:3.5.4 imagePullPolicy: IfNotPresent @@ -178,6 +182,17 @@ spec: cd /mnt/vol/git-local-dir cd {{ workflow.parameters.git-path }} helm package . + + volumeMounts: + - name: workdir + mountPath: /mnt/vol + + - name: push-to-chartmuseum + script: + image: curlimages/curl + imagePullPolicy: IfNotPresent + command: [sh] + source: | curl --data-binary "@$(grep -A0 'name:' ./Chart.yaml | awk '{ print $2}')-$(grep -A0 'version:' ./Chart.yaml | awk '{ print $2}').tgz" {{ workflow.parameters.registry }}/api/charts env: From 263467e94a6a25882b4cb331d9822c60117ae039 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Thu, 22 Jul 2021 23:58:37 +0100 Subject: [PATCH 019/132] no message --- templates/workflow-template/workflow-template.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index cb6a88f..2b6d8d8 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -193,6 +193,8 @@ spec: imagePullPolicy: IfNotPresent command: [sh] source: | + cd /mnt/vol/git-local-dir + cd {{ workflow.parameters.git-path }} curl --data-binary "@$(grep -A0 'name:' ./Chart.yaml | awk '{ print $2}')-$(grep -A0 'version:' ./Chart.yaml | awk '{ print $2}').tgz" {{ workflow.parameters.registry }}/api/charts env: From 18e1163639a2a3f00153139f0be5f204cceb8c2b Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 23 Jul 2021 12:32:54 +0100 Subject: [PATCH 020/132] no message --- templates/workflow-template/workflow-template.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index 2b6d8d8..6043897 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -195,6 +195,8 @@ spec: source: | cd /mnt/vol/git-local-dir cd {{ workflow.parameters.git-path }} + echo $(grep -A0 'name:' ./Chart.yaml | awk '{ print $2}') + echo $(grep -A0 'version:' ./Chart.yaml | awk '{ print $2}') curl --data-binary "@$(grep -A0 'name:' ./Chart.yaml | awk '{ print $2}')-$(grep -A0 'version:' ./Chart.yaml | awk '{ print $2}').tgz" {{ workflow.parameters.registry }}/api/charts env: From bf8c9f1b66354e6d1c2161d68250eb09ec5c1f3c Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 23 Jul 2021 12:41:21 +0100 Subject: [PATCH 021/132] no message --- templates/workflow-template/workflow-template.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index 6043897..c5c786e 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -12,16 +12,16 @@ spec: value: "git_url" - name: git-path - value: "git_path" + value: "data-cloud-infra" - name: registry-type - value: "private_registry" # Can be "aws" or "private_registry" + value: "chartmuseum" # Can be "aws" or "private_registry" - name: region # Set when registry type is aws value: "region_name" - name: registry - value: "registry_name" + value: "http://chartmuseum.apps.advatys.thadvatys.com" - name: chartname value: "chart_name" From c2d9dbbcb6966557e57c4f8136f15990c421caea Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 23 Jul 2021 12:44:21 +0100 Subject: [PATCH 022/132] no message --- templates/workflow-template/workflow-template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index c5c786e..786ad45 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -12,7 +12,7 @@ spec: value: "git_url" - name: git-path - value: "data-cloud-infra" + value: "database-cloud-infra" - name: registry-type value: "chartmuseum" # Can be "aws" or "private_registry" From e206bdcf2a704cea51a0350fb61575d8680fe5df Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 23 Jul 2021 12:55:03 +0100 Subject: [PATCH 023/132] no message --- templates/workflow-template/workflow-template.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index 786ad45..d2cd8ea 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -195,9 +195,7 @@ spec: source: | cd /mnt/vol/git-local-dir cd {{ workflow.parameters.git-path }} - echo $(grep -A0 'name:' ./Chart.yaml | awk '{ print $2}') - echo $(grep -A0 'version:' ./Chart.yaml | awk '{ print $2}') - curl --data-binary "@$(grep -A0 'name:' ./Chart.yaml | awk '{ print $2}')-$(grep -A0 'version:' ./Chart.yaml | awk '{ print $2}').tgz" {{ workflow.parameters.registry }}/api/charts + curl --data-binary "@$(grep -A0 '^name:' ./Chart.yaml | awk '{ print $2}')-$(grep -A0 '^version:' ./Chart.yaml | awk '{ print $2}').tgz" {{ workflow.parameters.registry }}/api/charts env: - name: registry_username From 3fe76fa1c45e3bd940b827dbc26a8889605ce6f3 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 23 Jul 2021 13:34:14 +0100 Subject: [PATCH 024/132] no message --- templates/workflow-template/secrets/chartmuseum-secret.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/workflow-template/secrets/chartmuseum-secret.yaml b/templates/workflow-template/secrets/chartmuseum-secret.yaml index 035b11d..b8dd728 100644 --- a/templates/workflow-template/secrets/chartmuseum-secret.yaml +++ b/templates/workflow-template/secrets/chartmuseum-secret.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: Secret metadata: - name: charmuseum-secret + name: chartmuseum-secret type: Opaque stringData: CHARTMUSEUM_USERNAME: "chartmuseum_username" From f8db7487b8996c545540388c98d7ee9b110d3691 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 23 Jul 2021 13:55:25 +0100 Subject: [PATCH 025/132] no message --- templates/workflow-template/workflow-template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index d2cd8ea..f4076dc 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -195,7 +195,7 @@ spec: source: | cd /mnt/vol/git-local-dir cd {{ workflow.parameters.git-path }} - curl --data-binary "@$(grep -A0 '^name:' ./Chart.yaml | awk '{ print $2}')-$(grep -A0 '^version:' ./Chart.yaml | awk '{ print $2}').tgz" {{ workflow.parameters.registry }}/api/charts + curl -H 'Authorization:Basic $(echo $registry_username:$registry_password | base64)' --data-binary "@$(grep -A0 '^name:' ./Chart.yaml | awk '{ print $2}')-$(grep -A0 '^version:' ./Chart.yaml | awk '{ print $2}').tgz" {{ workflow.parameters.registry }}/api/charts env: - name: registry_username From 767d83715953075983bdd4a93ca018b67be3a8c0 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 23 Jul 2021 14:00:29 +0100 Subject: [PATCH 026/132] no message --- templates/workflow-template/workflow-template.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index f4076dc..1648cfd 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -201,12 +201,12 @@ spec: - name: registry_username valueFrom: secretKeyRef: - name: charmuseum-secret + name: chartmuseum-secret key: CHARTMUSEUM_USERNAME - name: registry_password valueFrom: secretKeyRef: - name: charmuseum-secret + name: chartmuseum-secret key: CHARTMUSEUM_PASSWORD volumeMounts: - name: workdir From efee3ac87d6d83ba906f15bd28fcbf824131e28e Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 23 Jul 2021 14:46:59 +0100 Subject: [PATCH 027/132] no message --- templates/workflow-template/workflow-template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index 1648cfd..8491934 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -195,7 +195,7 @@ spec: source: | cd /mnt/vol/git-local-dir cd {{ workflow.parameters.git-path }} - curl -H 'Authorization:Basic $(echo $registry_username:$registry_password | base64)' --data-binary "@$(grep -A0 '^name:' ./Chart.yaml | awk '{ print $2}')-$(grep -A0 '^version:' ./Chart.yaml | awk '{ print $2}').tgz" {{ workflow.parameters.registry }}/api/charts + curl --user $registry_username:$registry_password --data-binary "@$(grep -A0 '^name:' ./Chart.yaml | awk '{ print $2}')-$(grep -A0 '^version:' ./Chart.yaml | awk '{ print $2}').tgz" {{ workflow.parameters.registry }}/api/charts env: - name: registry_username From 787e474efb7ed28153e86830e9e1388a4260cc0a Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 23 Jul 2021 19:16:09 +0100 Subject: [PATCH 028/132] no message --- templates/sensor/github-push.yaml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/templates/sensor/github-push.yaml b/templates/sensor/github-push.yaml index 504f041..2fd21ea 100644 --- a/templates/sensor/github-push.yaml +++ b/templates/sensor/github-push.yaml @@ -57,16 +57,28 @@ spec: - name: git-repository - name: git-ref templates: + - name: call-push-to-registry-template + dag: + tasks: + - name: call-push-to-registry-template + templateRef: + name: push-to-registry-template + template: generate-token +# arguments: +# parameters: +# - name: message +# value: "hello world" + - name: whalesay inputs: parameters: - name: git-owner - name: git-repository - - name: git-ref + - name: git-commits container: image: docker/whalesay:latest command: [cowsay] - args: ["{{inputs.parameters.git-repository}}"] + args: ["{{inputs.parameters.git-commits}}"] parameters: - src: dependencyName: github-push-event @@ -78,7 +90,7 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: "{{ .Input.body.ref | substr 0 7 }}" + dataTemplate: "{{ .Input.body.commits | first }}" dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name # - src: From 80c4179a8399a26d787b794dab6bf5843f3cd131 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 23 Jul 2021 20:02:44 +0100 Subject: [PATCH 029/132] no message --- templates/sensor/github-push.yaml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/templates/sensor/github-push.yaml b/templates/sensor/github-push.yaml index 2fd21ea..1f00034 100644 --- a/templates/sensor/github-push.yaml +++ b/templates/sensor/github-push.yaml @@ -50,12 +50,26 @@ spec: # name: github- generateName: github- spec: - entrypoint: whalesay + entrypoint: call-push-to-registry-template + volumeClaimTemplates: + - metadata: + name: workdir + spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: 1Gi + + volumes: + - name: aws-secrets + secret: + secretName: aws-secret + arguments: parameters: - name: git-owner - name: git-repository - - name: git-ref + - name: git-commits templates: - name: call-push-to-registry-template dag: From c80057ef68d4d13ac3ac13fa8b48fd0033714591 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 23 Jul 2021 20:04:02 +0100 Subject: [PATCH 030/132] no message --- templates/sensor/github-push.yaml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/templates/sensor/github-push.yaml b/templates/sensor/github-push.yaml index 1f00034..24e6947 100644 --- a/templates/sensor/github-push.yaml +++ b/templates/sensor/github-push.yaml @@ -51,19 +51,19 @@ spec: generateName: github- spec: entrypoint: call-push-to-registry-template - volumeClaimTemplates: - - metadata: - name: workdir - spec: - accessModes: [ "ReadWriteOnce" ] - resources: - requests: - storage: 1Gi - - volumes: - - name: aws-secrets - secret: - secretName: aws-secret + volumeClaimTemplates: + - metadata: + name: workdir + spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: 1Gi + + volumes: + - name: aws-secrets + secret: + secretName: aws-secret arguments: parameters: From 34155f2d8d34c3b7cf22f919ba4fce9ce877e98d Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 23 Jul 2021 20:09:54 +0100 Subject: [PATCH 031/132] no message --- templates/sensor/github-push.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/templates/sensor/github-push.yaml b/templates/sensor/github-push.yaml index 24e6947..7fb0fa2 100644 --- a/templates/sensor/github-push.yaml +++ b/templates/sensor/github-push.yaml @@ -51,6 +51,7 @@ spec: generateName: github- spec: entrypoint: call-push-to-registry-template + volumeClaimTemplates: - metadata: name: workdir @@ -70,6 +71,28 @@ spec: - name: git-owner - name: git-repository - name: git-commits + + - name: git-repository-type + value: "private" # Can be private or public accordingly, private creds to be stored in a secret + + - name: git-url + value: "git_url" + + - name: git-path + value: "memcached-cloud" + + - name: registry-type + value: "chartmuseum" # Can be "aws" or "private_registry" + + - name: region # Set when registry type is aws + value: "region_name" + + - name: registry + value: "http://chartmuseum.apps.advatys.thadvatys.com" + + - name: chartname + value: "chart_name" + templates: - name: call-push-to-registry-template dag: From 90739a0cb908e2f26b40ea387b6308af92e2933e Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 23 Jul 2021 20:28:12 +0100 Subject: [PATCH 032/132] no message --- templates/workflow-template/workflow-template.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index 8491934..9c6ad16 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -83,6 +83,13 @@ spec: else cd /mnt/vol && git clone {{ workflow.parameters.git-url }} git-local-dir fi + echo -n helm-minio-crd > /mnt/vol/git-path.txt + outputs: + parameters: + - name: git-path + valueFrom: +# default: "Foobar" # Default value to use if retrieving valueFrom fails. If not provided workflow will fail instead + path: /tmp/git-path.txt env: - name: git_username From f319048b8e82a49c7e272b398ebe9803e3faba90 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 23 Jul 2021 23:33:47 +0100 Subject: [PATCH 033/132] no message --- templates/workflow-template/workflow-template.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index 9c6ad16..43d1a0c 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -83,13 +83,13 @@ spec: else cd /mnt/vol && git clone {{ workflow.parameters.git-url }} git-local-dir fi - echo -n helm-minio-crd > /mnt/vol/git-path.txt - outputs: - parameters: - - name: git-path - valueFrom: -# default: "Foobar" # Default value to use if retrieving valueFrom fails. If not provided workflow will fail instead - path: /tmp/git-path.txt + echo -n helm-minio-crd > git-path.txt + if [[ -s git-path.txt ]] + then + echo 'ok' + else + echo 'ko' + fi env: - name: git_username From d950470a23da82e8af53ac26f75df1f7b63589a9 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 23 Jul 2021 23:52:24 +0100 Subject: [PATCH 034/132] no message --- .../workflow-template/workflow-template.yaml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index 43d1a0c..4744a7e 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -5,6 +5,9 @@ metadata: spec: arguments: parameters: + - name: git-commits + value: "no_commit" + - name: git-repository-type value: "private" # Can be private or public accordingly, private creds to be stored in a secret @@ -83,14 +86,13 @@ spec: else cd /mnt/vol && git clone {{ workflow.parameters.git-url }} git-local-dir fi - echo -n helm-minio-crd > git-path.txt - if [[ -s git-path.txt ]] - then - echo 'ok' + if [[ workflow.parameters.git-commits == "no_commit" ]] + echo -n helm-minio-crd > git-path.txt else - echo 'ko' + echo {{ workflow.parameters.git-path }} > git-path.txt fi + env: - name: git_username valueFrom: @@ -187,7 +189,7 @@ spec: command: [sh] source: | cd /mnt/vol/git-local-dir - cd {{ workflow.parameters.git-path }} + cd $(cat git-path.txt) helm package . volumeMounts: @@ -201,7 +203,7 @@ spec: command: [sh] source: | cd /mnt/vol/git-local-dir - cd {{ workflow.parameters.git-path }} + cd $(cat git-path.txt) curl --user $registry_username:$registry_password --data-binary "@$(grep -A0 '^name:' ./Chart.yaml | awk '{ print $2}')-$(grep -A0 '^version:' ./Chart.yaml | awk '{ print $2}').tgz" {{ workflow.parameters.registry }}/api/charts env: From 47c70af04bc47004ff16ddaa7b578e2ba4480cc1 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 23 Jul 2021 23:59:13 +0100 Subject: [PATCH 035/132] no message --- templates/workflow-template/workflow-template.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index 4744a7e..faaa7ae 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -87,6 +87,7 @@ spec: cd /mnt/vol && git clone {{ workflow.parameters.git-url }} git-local-dir fi if [[ workflow.parameters.git-commits == "no_commit" ]] + then echo -n helm-minio-crd > git-path.txt else echo {{ workflow.parameters.git-path }} > git-path.txt From a06fa6a18649266aa5d8c4924c94f7b19acd5c79 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 24 Jul 2021 00:05:28 +0100 Subject: [PATCH 036/132] no message --- templates/workflow-template/workflow-template.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index faaa7ae..4e4bb45 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -190,7 +190,7 @@ spec: command: [sh] source: | cd /mnt/vol/git-local-dir - cd $(cat git-path.txt) + cd $(cat ../git-path.txt) helm package . volumeMounts: @@ -204,7 +204,7 @@ spec: command: [sh] source: | cd /mnt/vol/git-local-dir - cd $(cat git-path.txt) + cd $(cat ../git-path.txt) curl --user $registry_username:$registry_password --data-binary "@$(grep -A0 '^name:' ./Chart.yaml | awk '{ print $2}')-$(grep -A0 '^version:' ./Chart.yaml | awk '{ print $2}').tgz" {{ workflow.parameters.registry }}/api/charts env: From b53aed7578339b2e9e8694d6b1d25083f7a9428e Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 24 Jul 2021 00:13:03 +0100 Subject: [PATCH 037/132] no message --- templates/workflow-template/workflow-template.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/workflow-template/workflow-template.yaml b/templates/workflow-template/workflow-template.yaml index 4e4bb45..b452a7b 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/templates/workflow-template/workflow-template.yaml @@ -86,11 +86,11 @@ spec: else cd /mnt/vol && git clone {{ workflow.parameters.git-url }} git-local-dir fi - if [[ workflow.parameters.git-commits == "no_commit" ]] + if [[ {{ workflow.parameters.git-commits }} == "no_commit" ]] then - echo -n helm-minio-crd > git-path.txt - else echo {{ workflow.parameters.git-path }} > git-path.txt + else + echo -n helm-minio-crd > git-path.txt fi From f199515cad8b41b4406d42ce5b8fe8e9a8ddc655 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 24 Jul 2021 18:27:14 +0100 Subject: [PATCH 038/132] no message --- .../chartmuseum-secret.yaml | 4 +- Chart => chartmuseum/Chart.yaml | 4 +- chartmuseum/templates/chartmuseum.yaml | 37 +++++++++ chartmuseum/values.yaml | 43 ++++++++++ helm-pipelines/Chart.yaml | 17 ++++ README.md => helm-pipelines/README.md | 0 .../templates/event-source/github-route.yaml | 20 +++++ .../templates}/event-source/github.yaml | 12 +-- .../templates/eventbus/eventBus.yaml | 23 ++++++ .../templates}/events/event-bind.yaml | 0 .../templates/rbac/RBAC-default.yaml | 37 +++++++++ helm-pipelines/templates/rbac/sa-sensor.yaml | 35 ++++++++ .../templates}/secrets/aws-secret.yaml | 4 +- .../templates/secrets/chartmuseum-secret.yaml | 11 +++ .../templates}/secrets/git-secret.yaml | 4 +- .../secrets/secret-role-binding.yaml | 0 .../templates}/secrets/secret-svc.yaml | 0 .../templates}/secrets/secret.yaml | 0 .../templates}/sensor/github-push.yaml | 39 ++++----- .../workflow-template/workflow-template.yaml | 82 ++++++++++--------- helm-pipelines/values.yaml | 51 ++++++++++++ templates/event-source/github-route.yaml | 21 ----- values | 28 ------- 23 files changed, 348 insertions(+), 124 deletions(-) rename {templates/workflow-template/secrets => chartmuseum-config}/chartmuseum-secret.yaml (78%) rename Chart => chartmuseum/Chart.yaml (88%) create mode 100644 chartmuseum/templates/chartmuseum.yaml create mode 100644 chartmuseum/values.yaml create mode 100644 helm-pipelines/Chart.yaml rename README.md => helm-pipelines/README.md (100%) create mode 100644 helm-pipelines/templates/event-source/github-route.yaml rename {templates => helm-pipelines/templates}/event-source/github.yaml (89%) create mode 100644 helm-pipelines/templates/eventbus/eventBus.yaml rename {templates => helm-pipelines/templates}/events/event-bind.yaml (100%) create mode 100644 helm-pipelines/templates/rbac/RBAC-default.yaml create mode 100644 helm-pipelines/templates/rbac/sa-sensor.yaml rename {templates/workflow-template => helm-pipelines/templates}/secrets/aws-secret.yaml (66%) create mode 100644 helm-pipelines/templates/secrets/chartmuseum-secret.yaml rename {templates/workflow-template => helm-pipelines/templates}/secrets/git-secret.yaml (64%) rename {templates => helm-pipelines/templates}/secrets/secret-role-binding.yaml (100%) rename {templates => helm-pipelines/templates}/secrets/secret-svc.yaml (100%) rename {templates => helm-pipelines/templates}/secrets/secret.yaml (100%) rename {templates => helm-pipelines/templates}/sensor/github-push.yaml (74%) rename {templates => helm-pipelines/templates}/workflow-template/workflow-template.yaml (62%) create mode 100644 helm-pipelines/values.yaml delete mode 100644 templates/event-source/github-route.yaml delete mode 100644 values diff --git a/templates/workflow-template/secrets/chartmuseum-secret.yaml b/chartmuseum-config/chartmuseum-secret.yaml similarity index 78% rename from templates/workflow-template/secrets/chartmuseum-secret.yaml rename to chartmuseum-config/chartmuseum-secret.yaml index b8dd728..02a5d02 100644 --- a/templates/workflow-template/secrets/chartmuseum-secret.yaml +++ b/chartmuseum-config/chartmuseum-secret.yaml @@ -1,9 +1,11 @@ +#secret for basic auth apiVersion: v1 kind: Secret metadata: name: chartmuseum-secret + namespace: chartmuseum type: Opaque stringData: CHARTMUSEUM_USERNAME: "chartmuseum_username" CHARTMUSEUM_PASSWORD: "chartmuseum_password" - CHARTMUSEUM_TOKEN: "charmuseum_token" + diff --git a/Chart b/chartmuseum/Chart.yaml similarity index 88% rename from Chart rename to chartmuseum/Chart.yaml index 23abe36..7ce59a6 100644 --- a/Chart +++ b/chartmuseum/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 -name: helm-pipelines -description: Install argo-workflow and argo-events on Openshift clusters +name: chartmuseum +description: Install chartmuseum on Openshift clusters # A chart can be either an 'application' or a 'library' chart. # # Application charts are a collection of templates that can be packaged into versioned archives diff --git a/chartmuseum/templates/chartmuseum.yaml b/chartmuseum/templates/chartmuseum.yaml new file mode 100644 index 0000000..829994c --- /dev/null +++ b/chartmuseum/templates/chartmuseum.yaml @@ -0,0 +1,37 @@ +{{- $relname := .Release.Name -}} +{{- $targetNamespace := .Values.argocdConfig.targetNamespace -}} +{{- $project := .Values.argocdConfig.project.name -}} +{{- $repourl := .Values.chartmuseum.repository.url -}} +{{- $repoversion := .Values.chartmuseum.repository.version -}} +apiVersion: argoproj.io/v1alpha1 +kind: ApplicationSet +metadata: + name: "{{ $relname }}-chartmuseum" + +spec: + generators: +{{ toYaml .Values.argocdConfig.generators | nindent 4 }} + + template: + metadata: + name: 'chartmuseum-{{ "{{" }}name{{ "}}" }}' + spec: + destination: + namespace: 'chartmuseum' + server: '{{ "{{" }}server{{ "}}" }}' + project: '{{ $project }}' + source: + repoURL: 'https://chartmuseum.github.io/charts' #'{{ $repourl }}' + targetRevision: '{{ $repoversion }}' + chart: chartmuseum + + helm: + releaseName: 'chartmuseum' + values: | +{{ toYaml .Values.chartmuseum.config | indent 12 }} + + syncPolicy: + automated: + prune: true + syncOptions: + - CreateNamespace=true diff --git a/chartmuseum/values.yaml b/chartmuseum/values.yaml new file mode 100644 index 0000000..2947cd2 --- /dev/null +++ b/chartmuseum/values.yaml @@ -0,0 +1,43 @@ +chartmuseum: + repository: + version: 3.1.0 + config: + env: + open: + # storage backend, can be one of: local, alibaba, amazon, google, microsoft, oracle + STORAGE: local + DISABLE_API: false + # allow anonymous GET operations when auth is used + AUTH_ANONYMOUS_GET: false + # enable bearer auth + BEARER_AUTH: false + # auth realm used for bearer auth + AUTH_REALM: + # auth service used for bearer auth + AUTH_SERVICE: + existingSecret: chartmuseum-secret + existingSecretMappings: + # username for basic http authentication + BASIC_AUTH_USER: CHARTMUSEUM_USERNAME + # password for basic http authentication + BASIC_AUTH_PASS: CHARTMUSEUM_PASSWORD + bearerAuth: + secret: + enabled: false + publicKeySecret: chartmuseum-public-key + securityContext: + enabled: true + fsGroup: null + runAsNonRoot: true + persistence: + enabled: true + accessMode: ReadWriteOnce + size: 8Gi + storageClass: "gp2" + + +argocdConfig: + generators: [] + project: + create: false + name: default diff --git a/helm-pipelines/Chart.yaml b/helm-pipelines/Chart.yaml new file mode 100644 index 0000000..b9a3363 --- /dev/null +++ b/helm-pipelines/Chart.yaml @@ -0,0 +1,17 @@ +apiVersion: v2 +name: helm-pipelines +description: Install all the necessary ressources to automate helm charts pipeline on Openshift clusters +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 \ No newline at end of file diff --git a/README.md b/helm-pipelines/README.md similarity index 100% rename from README.md rename to helm-pipelines/README.md diff --git a/helm-pipelines/templates/event-source/github-route.yaml b/helm-pipelines/templates/event-source/github-route.yaml new file mode 100644 index 0000000..3a11f45 --- /dev/null +++ b/helm-pipelines/templates/event-source/github-route.yaml @@ -0,0 +1,20 @@ + {{- if eq .Values.github.webhook.route "true" }} +kind: Route +apiVersion: route.openshift.io/v1 +metadata: + name: {{ .Release.Name }}-github-event + labels: + app.kubernetes.io/instance: helm-pipeline + controller: eventsource-controller + eventsource-name: {{ .Release.Name }}-github-events + +spec: + host: {{ .Values.github.webhook.url }} + to: + kind: Service + name: {{ .Release.Name }}-github-events-eventsource-svc + weight: 100 + port: + targetPort: 12000 + wildcardPolicy: None + {{- end }} diff --git a/templates/event-source/github.yaml b/helm-pipelines/templates/event-source/github.yaml similarity index 89% rename from templates/event-source/github.yaml rename to helm-pipelines/templates/event-source/github.yaml index 7ecb3a1..a6eec2a 100644 --- a/templates/event-source/github.yaml +++ b/helm-pipelines/templates/event-source/github.yaml @@ -2,9 +2,9 @@ apiVersion: argoproj.io/v1alpha1 kind: EventSource metadata: - name: github + name: {{ .Release.Name }}-github-events spec: - eventBusName: argo-configuration-default + eventBusName: {{ if eq .Values.eventbus.enabled "true" }}{{ .Release.Name }}-default{{ else }}{{ .Values.eventbus.eventbusName }}{{ end }} service: ports: - port: 12000 @@ -12,9 +12,9 @@ spec: github: push: repositories: - - owner: itmwiw - names: - - advatys + - owner: {{ .Values.github.repository.owner }} + names: +{{ toYaml .Values.github.repository.names | indent 10 }} # Github will send events to following port and endpoint webhook: # endpoint to listen to events on @@ -27,7 +27,7 @@ spec: # This url must be reachable from outside the cluster. # The name for the service is in `-eventsource-svc` format. # You will need to create an Ingress or Openshift Route for the event-source service so that it can be reached from GitHub. - url: http://github-event.apps.advatys.thadvatys.com + url: http://{{ .Values.github.webhook.url }} # type of events to listen to. # following listens to everything, hence * # You can find more info on https://developer.github.com/v3/activity/events/types/ diff --git a/helm-pipelines/templates/eventbus/eventBus.yaml b/helm-pipelines/templates/eventbus/eventBus.yaml new file mode 100644 index 0000000..b4c9756 --- /dev/null +++ b/helm-pipelines/templates/eventbus/eventBus.yaml @@ -0,0 +1,23 @@ + {{- if eq .Values.eventbus.enabled "true" }} +apiVersion: argoproj.io/v1alpha1 +kind: EventBus +metadata: + name: {{ .Release.Name }}-default +spec: + nats: + native: + # Optional, defaults to 3. If it is < 3, set it to 3, that is the minimal requirement. + replicas: {{ .Values.eventbus.replicas }} + # Optional, authen strategy, "none" or "token", defaults to "none" + auth: token + containerTemplate: +{{ toYaml .Values.eventbus.containerTemplate | indent 8 }} + +# metricsContainerTemplate: +# resources: +# requests: +# cpu: "10m" +# antiAffinity: false + persistence: +{{ toYaml .Values.eventbus.persistence | indent 8 }} + {{- end }} \ No newline at end of file diff --git a/templates/events/event-bind.yaml b/helm-pipelines/templates/events/event-bind.yaml similarity index 100% rename from templates/events/event-bind.yaml rename to helm-pipelines/templates/events/event-bind.yaml diff --git a/helm-pipelines/templates/rbac/RBAC-default.yaml b/helm-pipelines/templates/rbac/RBAC-default.yaml new file mode 100644 index 0000000..20aad6f --- /dev/null +++ b/helm-pipelines/templates/rbac/RBAC-default.yaml @@ -0,0 +1,37 @@ + {{- if eq .Values.rbac.default "true" }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: {{ .Release.Name }}-workflow-role +rules: + # pod get/watch is used to identify the container IDs of the current pod + # pod patch is used to annotate the step's outputs back to controller (e.g. artifact location) + - apiGroups: + - "" + resources: + - pods + verbs: + - get + - watch + - patch + # logs get/watch are used to get the pods logs for script outputs, and for log archival + - apiGroups: + - "" + resources: + - pods/log + verbs: + - get + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: {{ .Release.Name }}-workflow-role-binding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: {{ .Release.Name }}-workflow-role +subjects: + - kind: ServiceAccount + name: default + {{- end }} \ No newline at end of file diff --git a/helm-pipelines/templates/rbac/sa-sensor.yaml b/helm-pipelines/templates/rbac/sa-sensor.yaml new file mode 100644 index 0000000..e4e7346 --- /dev/null +++ b/helm-pipelines/templates/rbac/sa-sensor.yaml @@ -0,0 +1,35 @@ + {{- if eq .Values.rbac.operateWorkflow "true" }} +#sa used by the sensor to create workflows +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Release.Name }}-operate-workflow-sa +--- +# Similarly you can use a ClusterRole and ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: {{ .Release.Name }}-operate-workflow-role +rules: + - apiGroups: + - argoproj.io + verbs: + - "*" + resources: + - workflows + - workflowtemplates + - cronworkflows + - clusterworkflowtemplates +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: {{ .Release.Name }}-operate-workflow-role-binding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: {{ .Release.Name }}-operate-workflow-role +subjects: + - kind: ServiceAccount + name: {{ .Release.Name }}-operate-workflow-sa + {{- end }} \ No newline at end of file diff --git a/templates/workflow-template/secrets/aws-secret.yaml b/helm-pipelines/templates/secrets/aws-secret.yaml similarity index 66% rename from templates/workflow-template/secrets/aws-secret.yaml rename to helm-pipelines/templates/secrets/aws-secret.yaml index 9959bac..8f98d1a 100644 --- a/templates/workflow-template/secrets/aws-secret.yaml +++ b/helm-pipelines/templates/secrets/aws-secret.yaml @@ -1,10 +1,12 @@ + {{- if eq .Values.secrets.aws.generate "true" }} apiVersion: v1 kind: Secret metadata: - name: aws-secret + name: {{ .Values.secrets.aws.name }} type: Opaque stringData: AWS_SECRET: "aws_secret_key" AWS_ACCESS: "aws_accesss_key" USERNAME: "registry_username" PASSWORD: "registry_password" + {{- end }} \ No newline at end of file diff --git a/helm-pipelines/templates/secrets/chartmuseum-secret.yaml b/helm-pipelines/templates/secrets/chartmuseum-secret.yaml new file mode 100644 index 0000000..cfe6657 --- /dev/null +++ b/helm-pipelines/templates/secrets/chartmuseum-secret.yaml @@ -0,0 +1,11 @@ + {{- if eq .Values.secrets.chartmuseum.generate "true" }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Values.secrets.chartmuseum.name }} +type: Opaque +stringData: + CHARTMUSEUM_USERNAME: "chartmuseum_username" + CHARTMUSEUM_PASSWORD: "chartmuseum_password" + CHARTMUSEUM_TOKEN: "charmuseum_token" + {{- end }} \ No newline at end of file diff --git a/templates/workflow-template/secrets/git-secret.yaml b/helm-pipelines/templates/secrets/git-secret.yaml similarity index 64% rename from templates/workflow-template/secrets/git-secret.yaml rename to helm-pipelines/templates/secrets/git-secret.yaml index ca9da12..b33a339 100644 --- a/templates/workflow-template/secrets/git-secret.yaml +++ b/helm-pipelines/templates/secrets/git-secret.yaml @@ -1,9 +1,11 @@ + {{- if eq .Values.secrets.git.generate "true" }} apiVersion: v1 kind: Secret metadata: - name: git-secret + name: {{ .Values.secrets.git.name }} type: Opaque stringData: GIT_USERNAME: "git_username" GIT_TOKEN: "git_token" REPO_NAME: "repo_name" # Provide only the name of the repo + {{- end }} \ No newline at end of file diff --git a/templates/secrets/secret-role-binding.yaml b/helm-pipelines/templates/secrets/secret-role-binding.yaml similarity index 100% rename from templates/secrets/secret-role-binding.yaml rename to helm-pipelines/templates/secrets/secret-role-binding.yaml diff --git a/templates/secrets/secret-svc.yaml b/helm-pipelines/templates/secrets/secret-svc.yaml similarity index 100% rename from templates/secrets/secret-svc.yaml rename to helm-pipelines/templates/secrets/secret-svc.yaml diff --git a/templates/secrets/secret.yaml b/helm-pipelines/templates/secrets/secret.yaml similarity index 100% rename from templates/secrets/secret.yaml rename to helm-pipelines/templates/secrets/secret.yaml diff --git a/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml similarity index 74% rename from templates/sensor/github-push.yaml rename to helm-pipelines/templates/sensor/github-push.yaml index 7fb0fa2..b24656c 100644 --- a/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -1,14 +1,14 @@ apiVersion: argoproj.io/v1alpha1 kind: Sensor metadata: - name: github-push + name: {{ .Release.Name }}-github-push spec: - eventBusName: argo-configuration-default + eventBusName: {{ if eq .Values.eventbus.enabled "true" }}{{ .Release.Name }}-default{{ else }}{{ .Values.eventbus.eventbusName }}{{ end }} template: - serviceAccountName: argo-configuration-operate-workflow-sa + serviceAccountName: {{ if eq .Values.rbac.operateWorkflow "true" }}{{ .Release.Name }}-operate-workflow-sa{{ else }}{{ .Values.rbac.operateWorkflowSaName }}{{ end }} dependencies: - name: github-push-event - eventSourceName: github + eventSourceName: {{ .Release.Name }}-github-events eventName: push # filters: # data: @@ -64,7 +64,7 @@ spec: volumes: - name: aws-secrets secret: - secretName: aws-secret + secretName: {{ .Values.secrets.aws.name }} arguments: parameters: @@ -73,22 +73,22 @@ spec: - name: git-commits - name: git-repository-type - value: "private" # Can be private or public accordingly, private creds to be stored in a secret + value: {{ .Values.github.repository.type }} - name: git-url value: "git_url" - name: git-path - value: "memcached-cloud" + value: {{ .Values.github.repository.path.default }} - name: registry-type - value: "chartmuseum" # Can be "aws" or "private_registry" + value: {{ .Values.registry.type }} - - name: region # Set when registry type is aws - value: "region_name" + - name: region + value: {{ .Values.registry.region }} - name: registry - value: "http://chartmuseum.apps.advatys.thadvatys.com" + value: {{ .Values.registry.url }} - name: chartname value: "chart_name" @@ -99,23 +99,14 @@ spec: tasks: - name: call-push-to-registry-template templateRef: - name: push-to-registry-template + name: {{ .Release.Name }}-push-to-registry-template template: generate-token # arguments: # parameters: # - name: message # value: "hello world" - - name: whalesay - inputs: - parameters: - - name: git-owner - - name: git-repository - - name: git-commits - container: - image: docker/whalesay:latest - command: [cowsay] - args: ["{{inputs.parameters.git-commits}}"] + parameters: - src: dependencyName: github-push-event @@ -127,12 +118,12 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: "{{ .Input.body.commits | first }}" + dataTemplate: '{{ "{{" }} .Input.body.commits | first {{ "}}" }}' dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name # - src: # dependencyName: github-push-event - # dataTemplate: "{{ .Input.body.pull_request.number }}-{{ .Input.body.pull_request.head.sha | substr 0 7 }}" + # dataTemplate: "{{ "{{" }} .Input.body.pull_request.number {{ "}}" }}-{{ "{{" }} .Input.body.pull_request.head.sha | substr 0 7 {{ "}}" }}" # dest: metadata.name # operation: append # retryStrategy: diff --git a/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml similarity index 62% rename from templates/workflow-template/workflow-template.yaml rename to helm-pipelines/templates/workflow-template/workflow-template.yaml index b452a7b..e06d54c 100644 --- a/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -1,33 +1,35 @@ apiVersion: argoproj.io/v1alpha1 kind: WorkflowTemplate metadata: - name: push-to-registry-template + name: {{ .Release.Name }}-push-to-registry-template spec: arguments: parameters: + - name: git-commits value: "no_commit" - + - name: git-repository-type - value: "private" # Can be private or public accordingly, private creds to be stored in a secret + value: {{ .Values.github.repository.type }} - name: git-url value: "git_url" - name: git-path - value: "database-cloud-infra" - + value: {{ .Values.github.repository.path.default }} + - name: registry-type - value: "chartmuseum" # Can be "aws" or "private_registry" - - - name: region # Set when registry type is aws - value: "region_name" - + value: {{ .Values.registry.type }} + + - name: region + value: {{ .Values.registry.region }} + - name: registry - value: "http://chartmuseum.apps.advatys.thadvatys.com" - + value: {{ .Values.registry.url }} + - name: chartname value: "chart_name" + entrypoint: generate-token volumeClaimTemplates: @@ -42,7 +44,7 @@ spec: volumes: - name: aws-secrets secret: - secretName: aws-secret + secretName: {{ .Values.secrets.aws.name }} templates: - name: generate-token @@ -52,27 +54,27 @@ spec: - - name: create-token template: gen-token-bash - when: "{{ workflow.parameters.registry-type }} == aws" + when: "{{ "{{" }} workflow.parameters.registry-type {{ "}}" }} == aws" - - name: aws-login template: login - when: "{{ workflow.parameters.registry-type }} == aws" + when: "{{ "{{" }} workflow.parameters.registry-type {{ "}}" }} == aws" arguments: parameters: - name: token - value: "{{steps.create-token.outputs.result}}" + value: "{{ "{{" }}steps.create-token.outputs.result{{ "}}" }}" - - name: private-registry template: private-registry - when: "{{ workflow.parameters.registry-type }} == private_registry" + when: "{{ "{{" }} workflow.parameters.registry-type {{ "}}" }} == private_registry" - - name: helm-package template: helm-package - when: "{{ workflow.parameters.registry-type }} == chartmuseum" + when: "{{ "{{" }} workflow.parameters.registry-type {{ "}}" }} == chartmuseum" - - name: push-to-chartmuseum template: push-to-chartmuseum - when: "{{ workflow.parameters.registry-type }} == chartmuseum" + when: "{{ "{{" }} workflow.parameters.registry-type {{ "}}" }} == chartmuseum" - name: pull-repo script: @@ -80,15 +82,15 @@ spec: imagePullPolicy: IfNotPresent command: [sh] source: | - if [[ {{ workflow.parameters.git-repository-type }} == "private" ]] + if [[ {{ "{{" }} workflow.parameters.git-repository-type {{ "}}" }} == "private" ]] then cd /mnt/vol && git clone https://$git_token:x-oauth-basic@github.com/$git_username/$repo_name.git git-local-dir else - cd /mnt/vol && git clone {{ workflow.parameters.git-url }} git-local-dir + cd /mnt/vol && git clone {{ "{{" }} workflow.parameters.git-url {{ "}}" }} git-local-dir fi - if [[ {{ workflow.parameters.git-commits }} == "no_commit" ]] + if [[ {{ "{{" }} workflow.parameters.git-commits {{ "}}" }} == "no_commit" ]] then - echo {{ workflow.parameters.git-path }} > git-path.txt + echo {{ "{{" }} workflow.parameters.git-path {{ "}}" }} > git-path.txt else echo -n helm-minio-crd > git-path.txt fi @@ -98,17 +100,17 @@ spec: - name: git_username valueFrom: secretKeyRef: - name: git-secret + name: {{ .Values.secrets.git.name }} key: GIT_USERNAME - name: git_token valueFrom: secretKeyRef: - name: git-secret + name: {{ .Values.secrets.git.name }} key: GIT_TOKEN - name: repo_name valueFrom: secretKeyRef: - name: git-secret + name: {{ .Values.secrets.git.name }} key: REPO_NAME volumeMounts: - name: workdir @@ -122,19 +124,19 @@ spec: source: | export AWS_ACCESS_KEY_ID=$access_key export AWS_SECRET_ACCESS_KEY=$secret_key - export AWS_DEFAULT_REGION={{ workflow.parameters.region }} - /usr/local/bin/aws ecr-public get-login-password --region {{ workflow.parameters.region }} + export AWS_DEFAULT_REGION={{ "{{" }} workflow.parameters.region {{ "}}" }} + /usr/local/bin/aws ecr-public get-login-password --region {{ "{{" }} workflow.parameters.region {{ "}}" }} env: - name: access_key valueFrom: secretKeyRef: - name: aws-secret + name: {{ .Values.secrets.aws.name }} key: AWS_ACCESS - name: secret_key valueFrom: secretKeyRef: - name: aws-secret + name: {{ .Values.secrets.aws.name }} key: AWS_SECRET - name: login @@ -147,10 +149,10 @@ spec: command: [sh] source: | export HELM_EXPERIMENTAL_OCI=1 - echo {{ inputs.parameters.token }} | helm registry login --username AWS --password-stdin {{ workflow.parameters.registry }} + echo {{ "{{" }} inputs.parameters.token {{ "}}" }} | helm registry login --username AWS --password-stdin {{ "{{" }} workflow.parameters.registry {{ "}}" }} cd /mnt/vol/git-local-dir - helm chart save . {{ workflow.parameters.chartname }} - helm chart push {{ workflow.parameters.chartname }} + helm chart save . {{ "{{" }} workflow.parameters.chartname {{ "}}" }} + helm chart push {{ "{{" }} workflow.parameters.chartname {{ "}}" }} volumeMounts: - name: workdir @@ -163,10 +165,10 @@ spec: command: [sh] source: | export HELM_EXPERIMENTAL_OCI=1 - helm registry login {{ workflow.parameters.registry }} --username $registry_username --password $registry_password + helm registry login {{ "{{" }} workflow.parameters.registry {{ "}}" }} --username $registry_username --password $registry_password cd /mnt/vol/git-local-dir - helm chart save . {{ workflow.parameters.chartname }} - helm chart push {{ workflow.parameters.chartname }} + helm chart save . {{ "{{" }} workflow.parameters.chartname {{ "}}" }} + helm chart push {{ "{{" }} workflow.parameters.chartname {{ "}}" }} env: - name: registry_username @@ -177,7 +179,7 @@ spec: - name: registry_password valueFrom: secretKeyRef: - name: aws-secret + name: {{ .Values.secrets.aws.name }} key: password volumeMounts: - name: workdir @@ -205,18 +207,18 @@ spec: source: | cd /mnt/vol/git-local-dir cd $(cat ../git-path.txt) - curl --user $registry_username:$registry_password --data-binary "@$(grep -A0 '^name:' ./Chart.yaml | awk '{ print $2}')-$(grep -A0 '^version:' ./Chart.yaml | awk '{ print $2}').tgz" {{ workflow.parameters.registry }}/api/charts + curl --user $registry_username:$registry_password --data-binary "@$(grep -A0 '^name:' ./Chart.yaml | awk '{ print $2}')-$(grep -A0 '^version:' ./Chart.yaml | awk '{ print $2}').tgz" {{ "{{" }} workflow.parameters.registry {{ "}}" }}/api/charts env: - name: registry_username valueFrom: secretKeyRef: - name: chartmuseum-secret + name: {{ .Values.secrets.chartmuseum.name }} key: CHARTMUSEUM_USERNAME - name: registry_password valueFrom: secretKeyRef: - name: chartmuseum-secret + name: {{ .Values.secrets.chartmuseum.name }} key: CHARTMUSEUM_PASSWORD volumeMounts: - name: workdir diff --git a/helm-pipelines/values.yaml b/helm-pipelines/values.yaml new file mode 100644 index 0000000..e1f518e --- /dev/null +++ b/helm-pipelines/values.yaml @@ -0,0 +1,51 @@ +github: + repository: + type: private # Can be private or public accordingly, private creds to be stored in a secret + owner: itmwiw + names: + - advatys + path: + # the path shall be automatically determined using github webhook's data. + # still a default path can be usefull when launching helm pipeline's workflow manually + default: default_path + webhook: + # url the event-source will use to register at Github. + # This url must be reachable from outside the cluster. + url: github-event.apps.advatys.thadvatys.com + route: "true" # if set to true, an openshift route will be created + +registry: + type: chartmuseum # Can be "aws", "private_registry" or "chartmuseum" + url: http://chartmuseum.apps.advatys.thadvatys.com + region: region_name # Set when registry type is aws + +secrets: + # when generate is set to true, this will generate a secret with required keys. + # those secrets' values should be replaced with real values (ex: git token, etc.) + git: + generate: "true" # when set to true, generate a secret with required keys. + name: git-secret + aws: + generate: "true" + name: aws-secret + chartmuseum: + generate: "true" + name: chartmuseum-secret + +eventbus: + enabled: "true" + replicas: 3 + persistence: + storageClassName: gp2 + accessMode: ReadWriteOnce + volumeSize: 2Gi + containerTemplate: + resources: + requests: + cpu: "10m" + eventbusName: # Required if eventbus.enabled is set to false. Ignored otherwise. + +rbac: + default: "true" # grant namespace's default sa the privileges required by argo-workflow to watch pods and get logs. Set to false if already granted + operateWorkflow: "true" # create the sa and RBACs used by argo-events' sensor to create workflows. Set to false if already created. + operateWorkflowSaName: # Required if operateWorkflow is set to false. Ignored otherwise. \ No newline at end of file diff --git a/templates/event-source/github-route.yaml b/templates/event-source/github-route.yaml deleted file mode 100644 index aa394ef..0000000 --- a/templates/event-source/github-route.yaml +++ /dev/null @@ -1,21 +0,0 @@ -kind: Route -apiVersion: route.openshift.io/v1 -metadata: - name: github-event - namespace: argo-events - labels: - app.kubernetes.io/instance: helm-pipeline - controller: eventsource-controller - eventsource-name: github - owner-name: github - -spec: - host: github-event.apps.advatys.thadvatys.com - to: - kind: Service - name: github-eventsource-svc - weight: 100 - port: - targetPort: 12000 - wildcardPolicy: None - diff --git a/values b/values deleted file mode 100644 index b17c138..0000000 --- a/values +++ /dev/null @@ -1,28 +0,0 @@ -argoWorkflow: - repository: - version: 0.2.7 - config: - singleNamespace: false - workflow: - serviceAccount: - create: true - name: "argo-workflow" - rbac: - create: true - controller: - containerRuntimeExecutor: k8sapi # otherwise, if the default value 'docker' kept instead, the serviceAccount won't work with restricted scc - -argoEvent: - repository: - version: 1.6.4 - config: - securityContext: - runAsNonRoot: true - runAsUser: null - - -argocdConfig: - generators: [] - project: - create: false - name: default From 4f5139ef512cf844d5497bdf5940d33125fa866e Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 24 Jul 2021 19:12:03 +0100 Subject: [PATCH 039/132] no message --- helm-pipelines/templates/secrets/aws-secret.yaml | 2 ++ helm-pipelines/templates/secrets/chartmuseum-secret.yaml | 2 ++ helm-pipelines/templates/secrets/git-secret.yaml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/helm-pipelines/templates/secrets/aws-secret.yaml b/helm-pipelines/templates/secrets/aws-secret.yaml index 8f98d1a..16f89bc 100644 --- a/helm-pipelines/templates/secrets/aws-secret.yaml +++ b/helm-pipelines/templates/secrets/aws-secret.yaml @@ -3,6 +3,8 @@ apiVersion: v1 kind: Secret metadata: name: {{ .Values.secrets.aws.name }} + annotations: + argocd.argoproj.io/sync-options: Prune=false type: Opaque stringData: AWS_SECRET: "aws_secret_key" diff --git a/helm-pipelines/templates/secrets/chartmuseum-secret.yaml b/helm-pipelines/templates/secrets/chartmuseum-secret.yaml index cfe6657..5b92965 100644 --- a/helm-pipelines/templates/secrets/chartmuseum-secret.yaml +++ b/helm-pipelines/templates/secrets/chartmuseum-secret.yaml @@ -3,6 +3,8 @@ apiVersion: v1 kind: Secret metadata: name: {{ .Values.secrets.chartmuseum.name }} + annotations: + argocd.argoproj.io/sync-options: Prune=false type: Opaque stringData: CHARTMUSEUM_USERNAME: "chartmuseum_username" diff --git a/helm-pipelines/templates/secrets/git-secret.yaml b/helm-pipelines/templates/secrets/git-secret.yaml index b33a339..74b9d84 100644 --- a/helm-pipelines/templates/secrets/git-secret.yaml +++ b/helm-pipelines/templates/secrets/git-secret.yaml @@ -3,6 +3,8 @@ apiVersion: v1 kind: Secret metadata: name: {{ .Values.secrets.git.name }} + annotations: + argocd.argoproj.io/sync-options: Prune=false type: Opaque stringData: GIT_USERNAME: "git_username" From 937ec710c11eb38f1ab29e46853a74a20649392f Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 24 Jul 2021 19:29:50 +0100 Subject: [PATCH 040/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index b24656c..1c5f30b 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -48,7 +48,7 @@ spec: kind: Workflow metadata: # name: github- - generateName: github- + generateName: helm-pipeline- spec: entrypoint: call-push-to-registry-template From bd3754b36ce68502e1145db5f7e6e0e5dc5618f1 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 24 Jul 2021 19:47:12 +0100 Subject: [PATCH 041/132] no message --- .../templates/workflow-template/workflow-template.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index e06d54c..5604983 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -92,7 +92,13 @@ spec: then echo {{ "{{" }} workflow.parameters.git-path {{ "}}" }} > git-path.txt else - echo -n helm-minio-crd > git-path.txt + if [[ -s Chart.yaml ]] + then + echo -n . > git-path.txt + else + echo -n helm-minio-crd > git-path.txt + echo {{ "{{" }} workflow.parameters.git-commits {{ "}}" }} + fi fi From 8414230ed69074953c9c30037825dc2768f49bb0 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 24 Jul 2021 23:25:14 +0100 Subject: [PATCH 042/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 1c5f30b..908c757 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -118,7 +118,7 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: '{{ "{{" }} .Input.body.commits | first {{ "}}" }}' + dataTemplate: '{{ "{{" }} .Input.body.commits.0.modified | append .Input.body.commits.0.added | append .Input.body.commits.0.removed {{ "}}" }}' dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name # - src: From 88bbdee24805a27d0f2c2368416f65eabe1a3552 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 24 Jul 2021 23:29:24 +0100 Subject: [PATCH 043/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 908c757..dbe7e87 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -118,7 +118,7 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: '{{ "{{" }} .Input.body.commits.0.modified | append .Input.body.commits.0.added | append .Input.body.commits.0.removed {{ "}}" }}' + dataTemplate: '{{ "{{" }} .Input.body.commits.0.modified {{ "}}" }}' dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name # - src: From beceb1646fd629e83505aaaeb9dc2b3bf41eedda Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 24 Jul 2021 23:39:55 +0100 Subject: [PATCH 044/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index dbe7e87..d6eaa12 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -118,7 +118,7 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: '{{ "{{" }} .Input.body.commits.0.modified {{ "}}" }}' + dataTemplate: '{{ "{{" }} .Input.body.commits | first | pick "modified" "added" "removed" {{ "}}" }}' dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name # - src: From ea48ef386ea00995c478c6a7e4bfe198a0752c25 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 24 Jul 2021 23:43:14 +0100 Subject: [PATCH 045/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index d6eaa12..1c5f30b 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -118,7 +118,7 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: '{{ "{{" }} .Input.body.commits | first | pick "modified" "added" "removed" {{ "}}" }}' + dataTemplate: '{{ "{{" }} .Input.body.commits | first {{ "}}" }}' dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name # - src: From 8e814f78e01b952e4f51ae67fda97362260c3334 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 24 Jul 2021 23:47:18 +0100 Subject: [PATCH 046/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 1c5f30b..b6e8187 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -118,7 +118,7 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: '{{ "{{" }} .Input.body.commits | first {{ "}}" }}' + dataTemplate: '{{ "{{" }} pick ( .Input.body.commits | first ) "modified" {{ "}}" }}' dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name # - src: From 7e503d83ee82c41c093c9955343a7ab5aa5f49aa Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 24 Jul 2021 23:52:01 +0100 Subject: [PATCH 047/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index b6e8187..1d5e4b3 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -118,7 +118,7 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: '{{ "{{" }} pick ( .Input.body.commits | first ) "modified" {{ "}}" }}' + dataTemplate: '{{ "{{" }} values ( pick ( .Input.body.commits | first ) "modified" "added" "removed" ) {{ "}}" }}' dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name # - src: From 9a1e904658a0c661b7e81b0203634c27655a5e5e Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 24 Jul 2021 23:58:25 +0100 Subject: [PATCH 048/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 1d5e4b3..83cdc90 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -118,7 +118,7 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: '{{ "{{" }} values ( pick ( .Input.body.commits | first ) "modified" "added" "removed" ) {{ "}}" }}' + dataTemplate: '{{ "{{" }} values ( pick ( .Input.body.commits | first ) "modified" "added" "removed" ) | concat | uniq {{ "}}" }}' dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name # - src: From c27f6db8025e468a9c16347e9032dc8c67615726 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 00:10:38 +0100 Subject: [PATCH 049/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 83cdc90..3f3ae8a 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -118,7 +118,7 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: '{{ "{{" }} values ( pick ( .Input.body.commits | first ) "modified" "added" "removed" ) | concat | uniq {{ "}}" }}' + dataTemplate: '{{ "{{" }} concat (values (pick (.Input.body.commits | first) "modified")) (values (pick (.Input.body.commits | first) "added")) (values (pick (.Input.body.commits | first) "removed")) | uniq {{ "}}" }}' dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name # - src: From 23d188c65f4662a02df1fde17301fe67037d97be Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 00:13:49 +0100 Subject: [PATCH 050/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 3f3ae8a..a5a783a 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -118,7 +118,8 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: '{{ "{{" }} concat (values (pick (.Input.body.commits | first) "modified")) (values (pick (.Input.body.commits | first) "added")) (values (pick (.Input.body.commits | first) "removed")) | uniq {{ "}}" }}' + #dataTemplate: '{{ "{{" }} concat (values (pick (.Input.body.commits | first) "modified")) (values (pick (.Input.body.commits | first) "added")) (values (pick (.Input.body.commits | first) "removed")) | uniq {{ "}}" }}' + dataTemplate: '{{ "{{" }} concat (pluck "modified" .Input.body.commits) (pluck "added" .Input.body.commits) (pluck "removed" .Input.body.commits) | uniq {{ "}}" }}' dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name # - src: From e5b60ebf6903e8e2fde2b8f7f623860efa9160da Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 00:16:02 +0100 Subject: [PATCH 051/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index a5a783a..86df4b6 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -118,8 +118,8 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - #dataTemplate: '{{ "{{" }} concat (values (pick (.Input.body.commits | first) "modified")) (values (pick (.Input.body.commits | first) "added")) (values (pick (.Input.body.commits | first) "removed")) | uniq {{ "}}" }}' - dataTemplate: '{{ "{{" }} concat (pluck "modified" .Input.body.commits) (pluck "added" .Input.body.commits) (pluck "removed" .Input.body.commits) | uniq {{ "}}" }}' + dataTemplate: '{{ "{{" }} concat (values (pick (.Input.body.commits | first) "modified")) (values (pick (.Input.body.commits | first) "added")) (values (pick (.Input.body.commits | first) "removed")) | uniq {{ "}}" }}' + #dataTemplate: '{{ "{{" }} concat (pluck "modified" .Input.body.commits) (pluck "added" .Input.body.commits) (pluck "removed" .Input.body.commits) | uniq {{ "}}" }}' dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name # - src: From d1365b43b9e1ac8fa4d30e6f2fdf4705c9d468c6 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 00:25:15 +0100 Subject: [PATCH 052/132] no message --- .../templates/workflow-template/workflow-template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index 5604983..e7c72f7 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -88,7 +88,7 @@ spec: else cd /mnt/vol && git clone {{ "{{" }} workflow.parameters.git-url {{ "}}" }} git-local-dir fi - if [[ {{ "{{" }} workflow.parameters.git-commits {{ "}}" }} == "no_commit" ]] + if [[ {{ "{{" }} "workflow.parameters.git-commits" {{ "}}" }} == "no_commit" ]] then echo {{ "{{" }} workflow.parameters.git-path {{ "}}" }} > git-path.txt else From 2aecbac16a32a506b58b9a415a5ee96aa63df257 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 00:25:52 +0100 Subject: [PATCH 053/132] no message --- .../templates/workflow-template/workflow-template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index e7c72f7..e4f2f34 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -97,7 +97,7 @@ spec: echo -n . > git-path.txt else echo -n helm-minio-crd > git-path.txt - echo {{ "{{" }} workflow.parameters.git-commits {{ "}}" }} + echo {{ "{{" }} "workflow.parameters.git-commits" {{ "}}" }} fi fi From ba88d63b85e09676d4f1d6fd19620dff9be0b747 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 00:30:42 +0100 Subject: [PATCH 054/132] no message --- .../templates/workflow-template/workflow-template.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index e4f2f34..5604983 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -88,7 +88,7 @@ spec: else cd /mnt/vol && git clone {{ "{{" }} workflow.parameters.git-url {{ "}}" }} git-local-dir fi - if [[ {{ "{{" }} "workflow.parameters.git-commits" {{ "}}" }} == "no_commit" ]] + if [[ {{ "{{" }} workflow.parameters.git-commits {{ "}}" }} == "no_commit" ]] then echo {{ "{{" }} workflow.parameters.git-path {{ "}}" }} > git-path.txt else @@ -97,7 +97,7 @@ spec: echo -n . > git-path.txt else echo -n helm-minio-crd > git-path.txt - echo {{ "{{" }} "workflow.parameters.git-commits" {{ "}}" }} + echo {{ "{{" }} workflow.parameters.git-commits {{ "}}" }} fi fi From d170d3d6bc0d15a77bc00e5a91fdcfb147070012 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 00:34:31 +0100 Subject: [PATCH 055/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 86df4b6..b581f38 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -118,7 +118,8 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: '{{ "{{" }} concat (values (pick (.Input.body.commits | first) "modified")) (values (pick (.Input.body.commits | first) "added")) (values (pick (.Input.body.commits | first) "removed")) | uniq {{ "}}" }}' + dataTemplate: '{{ "{{" }} pick (.Input.body.commits | first) "modified" "added" "removed" | toJson {{ "}}" }}' + #dataTemplate: '{{ "{{" }} concat (values (pick (.Input.body.commits | first) "modified")) (values (pick (.Input.body.commits | first) "added")) (values (pick (.Input.body.commits | first) "removed")) | uniq {{ "}}" }}' #dataTemplate: '{{ "{{" }} concat (pluck "modified" .Input.body.commits) (pluck "added" .Input.body.commits) (pluck "removed" .Input.body.commits) | uniq {{ "}}" }}' dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name From 48b88a63fcf987f7cd0dbf8d9192a59a2d03d7d2 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 00:41:24 +0100 Subject: [PATCH 056/132] no message --- .../templates/workflow-template/workflow-template.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index 5604983..3f487ec 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -98,6 +98,7 @@ spec: else echo -n helm-minio-crd > git-path.txt echo {{ "{{" }} workflow.parameters.git-commits {{ "}}" }} + jq fi fi From 1e34f0f0c295934e54134bc6fec55a610ef14ced Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 11:58:31 +0100 Subject: [PATCH 057/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index b581f38..5100643 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -118,7 +118,7 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: '{{ "{{" }} pick (.Input.body.commits | first) "modified" "added" "removed" | toJson {{ "}}" }}' + dataTemplate: '{{ "{{" }} values (pick (.Input.body.commits | first) "modified" "added" "removed") | replace "[" "" | replace "]" "" | quote {{ "}}" }}' #dataTemplate: '{{ "{{" }} concat (values (pick (.Input.body.commits | first) "modified")) (values (pick (.Input.body.commits | first) "added")) (values (pick (.Input.body.commits | first) "removed")) | uniq {{ "}}" }}' #dataTemplate: '{{ "{{" }} concat (pluck "modified" .Input.body.commits) (pluck "added" .Input.body.commits) (pluck "removed" .Input.body.commits) | uniq {{ "}}" }}' dest: spec.arguments.parameters.2.value From 90d685a17b08f13742f8e0d30ddd08309235014c Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 12:03:12 +0100 Subject: [PATCH 058/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- .../templates/workflow-template/workflow-template.yaml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 5100643..6f7a8d9 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -118,7 +118,7 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: '{{ "{{" }} values (pick (.Input.body.commits | first) "modified" "added" "removed") | replace "[" "" | replace "]" "" | quote {{ "}}" }}' + dataTemplate: '{{ "{{" }} values (pick (.Input.body.commits | first) "modified" "added" "removed") | quote {{ "}}" }}' #dataTemplate: '{{ "{{" }} concat (values (pick (.Input.body.commits | first) "modified")) (values (pick (.Input.body.commits | first) "added")) (values (pick (.Input.body.commits | first) "removed")) | uniq {{ "}}" }}' #dataTemplate: '{{ "{{" }} concat (pluck "modified" .Input.body.commits) (pluck "added" .Input.body.commits) (pluck "removed" .Input.body.commits) | uniq {{ "}}" }}' dest: spec.arguments.parameters.2.value diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index 3f487ec..5604983 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -98,7 +98,6 @@ spec: else echo -n helm-minio-crd > git-path.txt echo {{ "{{" }} workflow.parameters.git-commits {{ "}}" }} - jq fi fi From 53cee8df55b71e87cb8f22ec5f180b90ac254203 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 12:06:46 +0100 Subject: [PATCH 059/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 6f7a8d9..183a46c 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -118,7 +118,7 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: '{{ "{{" }} values (pick (.Input.body.commits | first) "modified" "added" "removed") | quote {{ "}}" }}' + dataTemplate: '{{ "{{" }} pick (.Input.body.commits | first) "modified" "added" "removed" | quote {{ "}}" }}' #dataTemplate: '{{ "{{" }} concat (values (pick (.Input.body.commits | first) "modified")) (values (pick (.Input.body.commits | first) "added")) (values (pick (.Input.body.commits | first) "removed")) | uniq {{ "}}" }}' #dataTemplate: '{{ "{{" }} concat (pluck "modified" .Input.body.commits) (pluck "added" .Input.body.commits) (pluck "removed" .Input.body.commits) | uniq {{ "}}" }}' dest: spec.arguments.parameters.2.value From 85f019742b2e466daeacb668cd8f865bf709b537 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 12:11:36 +0100 Subject: [PATCH 060/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 183a46c..361020b 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -118,7 +118,7 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: '{{ "{{" }} pick (.Input.body.commits | first) "modified" "added" "removed" | quote {{ "}}" }}' + dataTemplate: '{{ "{{" }} values (pick (.Input.body.commits | first) "modified" "added" "removed") | toJson | quote {{ "}}" }}' #dataTemplate: '{{ "{{" }} concat (values (pick (.Input.body.commits | first) "modified")) (values (pick (.Input.body.commits | first) "added")) (values (pick (.Input.body.commits | first) "removed")) | uniq {{ "}}" }}' #dataTemplate: '{{ "{{" }} concat (pluck "modified" .Input.body.commits) (pluck "added" .Input.body.commits) (pluck "removed" .Input.body.commits) | uniq {{ "}}" }}' dest: spec.arguments.parameters.2.value From b37b87a4707786749adbf2f9b005e9b699d559ff Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 12:35:23 +0100 Subject: [PATCH 061/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 361020b..09d07f9 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -118,7 +118,7 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: '{{ "{{" }} values (pick (.Input.body.commits | first) "modified" "added" "removed") | toJson | quote {{ "}}" }}' + dataTemplate: '{{ "{{" }} values (pick (.Input.body.commits | first) "modified" "added" "removed") | toJson | quote | replace "[" "" | replace "]" "" {{ "}}" }}' #dataTemplate: '{{ "{{" }} concat (values (pick (.Input.body.commits | first) "modified")) (values (pick (.Input.body.commits | first) "added")) (values (pick (.Input.body.commits | first) "removed")) | uniq {{ "}}" }}' #dataTemplate: '{{ "{{" }} concat (pluck "modified" .Input.body.commits) (pluck "added" .Input.body.commits) (pluck "removed" .Input.body.commits) | uniq {{ "}}" }}' dest: spec.arguments.parameters.2.value From 02e69f0381c3c299336b53ee2fe24163f398f64e Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 12:49:39 +0100 Subject: [PATCH 062/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 09d07f9..8037e12 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -118,7 +118,7 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: '{{ "{{" }} values (pick (.Input.body.commits | first) "modified" "added" "removed") | toJson | quote | replace "[" "" | replace "]" "" {{ "}}" }}' + dataTemplate: '{{ "{{" }} values (pick (.Input.body.commits | first) "modified" "added" "removed") | toJson | quote | replace "[" "" | replace "]" "" {{ "}}" | replace "," " " }}' #dataTemplate: '{{ "{{" }} concat (values (pick (.Input.body.commits | first) "modified")) (values (pick (.Input.body.commits | first) "added")) (values (pick (.Input.body.commits | first) "removed")) | uniq {{ "}}" }}' #dataTemplate: '{{ "{{" }} concat (pluck "modified" .Input.body.commits) (pluck "added" .Input.body.commits) (pluck "removed" .Input.body.commits) | uniq {{ "}}" }}' dest: spec.arguments.parameters.2.value From 4d23d57cf7c40ed3a17e69c58d4da31bba4d3904 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 12:54:37 +0100 Subject: [PATCH 063/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 8037e12..8a32f19 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -119,7 +119,6 @@ spec: - src: dependencyName: github-push-event dataTemplate: '{{ "{{" }} values (pick (.Input.body.commits | first) "modified" "added" "removed") | toJson | quote | replace "[" "" | replace "]" "" {{ "}}" | replace "," " " }}' - #dataTemplate: '{{ "{{" }} concat (values (pick (.Input.body.commits | first) "modified")) (values (pick (.Input.body.commits | first) "added")) (values (pick (.Input.body.commits | first) "removed")) | uniq {{ "}}" }}' #dataTemplate: '{{ "{{" }} concat (pluck "modified" .Input.body.commits) (pluck "added" .Input.body.commits) (pluck "removed" .Input.body.commits) | uniq {{ "}}" }}' dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name From f9bdc280a627f13b5af5180ac19133eff6f62acb Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 12:57:41 +0100 Subject: [PATCH 064/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 8a32f19..aa12795 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -118,7 +118,7 @@ spec: dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event - dataTemplate: '{{ "{{" }} values (pick (.Input.body.commits | first) "modified" "added" "removed") | toJson | quote | replace "[" "" | replace "]" "" {{ "}}" | replace "," " " }}' + dataTemplate: '{{ "{{" }} values (pick (.Input.body.commits | first) "modified" "added" "removed") | toJson | quote | replace "[" "" | replace "]" "" | replace "," " " {{ "}}" }}' #dataTemplate: '{{ "{{" }} concat (pluck "modified" .Input.body.commits) (pluck "added" .Input.body.commits) (pluck "removed" .Input.body.commits) | uniq {{ "}}" }}' dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name From a356432fa63f023da901309ea869619a54c21eaf Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 13:43:32 +0100 Subject: [PATCH 065/132] no message --- .../templates/workflow-template/workflow-template.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index 5604983..724cfcd 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -96,8 +96,10 @@ spec: then echo -n . > git-path.txt else + declare -a modified=({{ "{{" }} workflow.parameters.git-commits {{ "}}" }}) + printf '%s\n' "$(dirname "${modified[@]}")" | sort -u > list.txt + cat list.txt echo -n helm-minio-crd > git-path.txt - echo {{ "{{" }} workflow.parameters.git-commits {{ "}}" }} fi fi From b1182210d12b66e4559965d2a17dad7dcc9c3a42 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 13:50:06 +0100 Subject: [PATCH 066/132] no message --- .../templates/workflow-template/workflow-template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index 724cfcd..71e3c92 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -96,7 +96,7 @@ spec: then echo -n . > git-path.txt else - declare -a modified=({{ "{{" }} workflow.parameters.git-commits {{ "}}" }}) + declare -a modified="("{{ "{{" }} workflow.parameters.git-commits {{ "}}" }}")" printf '%s\n' "$(dirname "${modified[@]}")" | sort -u > list.txt cat list.txt echo -n helm-minio-crd > git-path.txt From 5c7b2a1470ec2e690925db95139e6ed262195092 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 13:54:22 +0100 Subject: [PATCH 067/132] no message --- .../templates/workflow-template/workflow-template.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index 71e3c92..350cbe9 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -96,7 +96,8 @@ spec: then echo -n . > git-path.txt else - declare -a modified="("{{ "{{" }} workflow.parameters.git-commits {{ "}}" }}")" + modified="("{{ "{{" }} workflow.parameters.git-commits {{ "}}" }}")" + echo "${modified[@]}")" printf '%s\n' "$(dirname "${modified[@]}")" | sort -u > list.txt cat list.txt echo -n helm-minio-crd > git-path.txt From b766a60531fabfef7bb7697b7e93cfead6f736c3 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 14:57:44 +0100 Subject: [PATCH 068/132] no message --- .../templates/workflow-template/workflow-template.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index 350cbe9..2b23517 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -78,9 +78,9 @@ spec: - name: pull-repo script: - image: alpine/git:v2.30.2 + image: bitnami/git:2.32.0 imagePullPolicy: IfNotPresent - command: [sh] + command: [bash] source: | if [[ {{ "{{" }} workflow.parameters.git-repository-type {{ "}}" }} == "private" ]] then @@ -97,7 +97,7 @@ spec: echo -n . > git-path.txt else modified="("{{ "{{" }} workflow.parameters.git-commits {{ "}}" }}")" - echo "${modified[@]}")" + echo "${modified[@]}" printf '%s\n' "$(dirname "${modified[@]}")" | sort -u > list.txt cat list.txt echo -n helm-minio-crd > git-path.txt From 54f421019ed490956aa17810cf12569f04b6266b Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 17:26:18 +0100 Subject: [PATCH 069/132] no message --- .../workflow-template/workflow-template.yaml | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index 2b23517..41a796c 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -92,16 +92,11 @@ spec: then echo {{ "{{" }} workflow.parameters.git-path {{ "}}" }} > git-path.txt else - if [[ -s Chart.yaml ]] - then - echo -n . > git-path.txt - else - modified="("{{ "{{" }} workflow.parameters.git-commits {{ "}}" }}")" - echo "${modified[@]}" - printf '%s\n' "$(dirname "${modified[@]}")" | sort -u > list.txt - cat list.txt - echo -n helm-minio-crd > git-path.txt - fi + modified="("{{ "{{" }} workflow.parameters.git-commits {{ "}}" }}")" + echo "${modified[@]}" + printf '%s\n' "$(dirname "${modified[@]}")" | sort -u | cut -d "/" -f2 > git-path.txt + cat list.txt + echo -n helm-minio-crd > git-path.txt fi @@ -200,9 +195,14 @@ spec: imagePullPolicy: IfNotPresent command: [sh] source: | - cd /mnt/vol/git-local-dir - cd $(cat ../git-path.txt) - helm package . + cd /mnt/vol/git-local-dir + for line in $(cat git-path.txt); do + if [[ -s "$line"/Chart.yaml ]]; then + cd "$line" + helm package . + cd .. + fi + done volumeMounts: - name: workdir @@ -214,9 +214,14 @@ spec: imagePullPolicy: IfNotPresent command: [sh] source: | - cd /mnt/vol/git-local-dir - cd $(cat ../git-path.txt) - curl --user $registry_username:$registry_password --data-binary "@$(grep -A0 '^name:' ./Chart.yaml | awk '{ print $2}')-$(grep -A0 '^version:' ./Chart.yaml | awk '{ print $2}').tgz" {{ "{{" }} workflow.parameters.registry {{ "}}" }}/api/charts + cd /mnt/vol/git-local-dir + for line in $(cat git-path.txt); do + if [[ -s "$line"/Chart.yaml ]]; then + cd "$line" + curl --user $registry_username:$registry_password --data-binary "@$(grep -A0 '^name:' ./Chart.yaml | awk '{ print $2}')-$(grep -A0 '^version:' ./Chart.yaml | awk '{ print $2}').tgz" {{ "{{" }} workflow.parameters.registry {{ "}}" }}/api/charts + cd .. + fi + done env: - name: registry_username From b64f29aa12de605c5045bf84c7de2368993ba773 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 17:33:34 +0100 Subject: [PATCH 070/132] no message --- .../templates/workflow-template/workflow-template.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index 41a796c..8a9e5bc 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -95,8 +95,6 @@ spec: modified="("{{ "{{" }} workflow.parameters.git-commits {{ "}}" }}")" echo "${modified[@]}" printf '%s\n' "$(dirname "${modified[@]}")" | sort -u | cut -d "/" -f2 > git-path.txt - cat list.txt - echo -n helm-minio-crd > git-path.txt fi @@ -196,7 +194,7 @@ spec: command: [sh] source: | cd /mnt/vol/git-local-dir - for line in $(cat git-path.txt); do + for line in $(cat ../git-path.txt); do if [[ -s "$line"/Chart.yaml ]]; then cd "$line" helm package . @@ -215,7 +213,7 @@ spec: command: [sh] source: | cd /mnt/vol/git-local-dir - for line in $(cat git-path.txt); do + for line in $(cat ../git-path.txt); do if [[ -s "$line"/Chart.yaml ]]; then cd "$line" curl --user $registry_username:$registry_password --data-binary "@$(grep -A0 '^name:' ./Chart.yaml | awk '{ print $2}')-$(grep -A0 '^version:' ./Chart.yaml | awk '{ print $2}').tgz" {{ "{{" }} workflow.parameters.registry {{ "}}" }}/api/charts From 82456fd29869f77dfe8a92471b7b80861a876c7a Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 17:49:02 +0100 Subject: [PATCH 071/132] no message --- .../templates/workflow-template/workflow-template.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index 8a9e5bc..f4eeb07 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -92,7 +92,7 @@ spec: then echo {{ "{{" }} workflow.parameters.git-path {{ "}}" }} > git-path.txt else - modified="("{{ "{{" }} workflow.parameters.git-commits {{ "}}" }}")" + declare -a modified="("{{ "{{" }} workflow.parameters.git-commits {{ "}}" }}")" echo "${modified[@]}" printf '%s\n' "$(dirname "${modified[@]}")" | sort -u | cut -d "/" -f2 > git-path.txt fi @@ -193,7 +193,8 @@ spec: imagePullPolicy: IfNotPresent command: [sh] source: | - cd /mnt/vol/git-local-dir + cd /mnt/vol/git-local-dir + cat ../git-path.txt for line in $(cat ../git-path.txt); do if [[ -s "$line"/Chart.yaml ]]; then cd "$line" From f98b319ddd9a9749c2bfff034e998ba7b2e12ffc Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 17:56:15 +0100 Subject: [PATCH 072/132] no message --- .../templates/workflow-template/workflow-template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index f4eeb07..ce5ff15 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -94,7 +94,7 @@ spec: else declare -a modified="("{{ "{{" }} workflow.parameters.git-commits {{ "}}" }}")" echo "${modified[@]}" - printf '%s\n' "$(dirname "${modified[@]}")" | sort -u | cut -d "/" -f2 > git-path.txt + printf '%s\n' "$(dirname "${modified[@]}")" | sort -u | cut -d "/" -f1 > git-path.txt fi From 25efadf0a5f456bcfe4396fb4d522c49c74b6804 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 18:02:12 +0100 Subject: [PATCH 073/132] no message --- .../templates/workflow-template/workflow-template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index ce5ff15..d645953 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -94,7 +94,7 @@ spec: else declare -a modified="("{{ "{{" }} workflow.parameters.git-commits {{ "}}" }}")" echo "${modified[@]}" - printf '%s\n' "$(dirname "${modified[@]}")" | sort -u | cut -d "/" -f1 > git-path.txt + printf '%s\n' "$(dirname "${modified[@]}")" | sort -u | cut -d "/" -f1 | uniq > git-path.txt fi From a09be486b4633168147ca5e00a2a25fc9cf32cdc Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 21:01:46 +0100 Subject: [PATCH 074/132] no message --- .../workflow-template/workflow-template.yaml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index d645953..bece95d 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -6,6 +6,8 @@ spec: arguments: parameters: + - name: git-repository + - name: git-commits value: "no_commit" @@ -82,9 +84,14 @@ spec: imagePullPolicy: IfNotPresent command: [bash] source: | - if [[ {{ "{{" }} workflow.parameters.git-repository-type {{ "}}" }} == "private" ]] - then - cd /mnt/vol && git clone https://$git_token:x-oauth-basic@github.com/$git_username/$repo_name.git git-local-dir + if [[ {{ "{{" }} workflow.parameters.git-repository-type {{ "}}" }} == "private" ]] + then + if [[ {{ "{{" }} workflow.parameters.git-commits {{ "}}" }} == "no_commit" ]] + then + cd /mnt/vol && git clone https://$git_token:x-oauth-basic@github.com/$git_username/$repo_name.git git-local-dir + else + cd /mnt/vol && git clone https://$git_token:x-oauth-basic@github.com/$git_username/{{ "{{" }} workflow.parameters.git-repository {{ "}}" }}.git git-local-dir + fi else cd /mnt/vol && git clone {{ "{{" }} workflow.parameters.git-url {{ "}}" }} git-local-dir fi From c8fbbf2f0028b57c2afb1260cf53e164b0d81f91 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 21:06:24 +0100 Subject: [PATCH 075/132] no message --- helm-pipelines/values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/helm-pipelines/values.yaml b/helm-pipelines/values.yaml index e1f518e..762da72 100644 --- a/helm-pipelines/values.yaml +++ b/helm-pipelines/values.yaml @@ -4,6 +4,7 @@ github: owner: itmwiw names: - advatys + - helm-pipelines path: # the path shall be automatically determined using github webhook's data. # still a default path can be usefull when launching helm pipeline's workflow manually From 78f1c302614fe2a1f5f7114dcbc390d10e2bdebb Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 21:16:12 +0100 Subject: [PATCH 076/132] no message --- helm-pipelines/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/README.md b/helm-pipelines/README.md index 255a84b..29a76cf 100644 --- a/helm-pipelines/README.md +++ b/helm-pipelines/README.md @@ -1,4 +1,4 @@ -# helm-pipelines +# helm-pipelines ## ARGO helm package registry From fa00840172245204cf6efacf2c39a8bdb90b1706 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 21:30:47 +0100 Subject: [PATCH 077/132] no message --- .../templates/workflow-template/workflow-template.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index bece95d..a7b06a4 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -7,6 +7,7 @@ spec: parameters: - name: git-repository + value: "used_by_webhook" # the "secret" method is still used when manually launching the workflow - name: git-commits value: "no_commit" From 77fc7ea829264c64f0a887eafa08d4d2880d7db1 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 21:31:43 +0100 Subject: [PATCH 078/132] no message --- helm-pipelines/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/README.md b/helm-pipelines/README.md index 29a76cf..255a84b 100644 --- a/helm-pipelines/README.md +++ b/helm-pipelines/README.md @@ -1,4 +1,4 @@ -# helm-pipelines +# helm-pipelines ## ARGO helm package registry From b1aa26b77a5d98d3abd3eb793c02f775c3b4d281 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 21:35:20 +0100 Subject: [PATCH 079/132] no message --- helm-pipelines/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/README.md b/helm-pipelines/README.md index 255a84b..29a76cf 100644 --- a/helm-pipelines/README.md +++ b/helm-pipelines/README.md @@ -1,4 +1,4 @@ -# helm-pipelines +# helm-pipelines ## ARGO helm package registry From a0d6ff18892b0b6f94cf5a3a41bb08db7345118c Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 21:37:56 +0100 Subject: [PATCH 080/132] no message --- helm-pipelines/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/README.md b/helm-pipelines/README.md index 29a76cf..2ae4828 100644 --- a/helm-pipelines/README.md +++ b/helm-pipelines/README.md @@ -1,4 +1,4 @@ -# helm-pipelines +# helm-pipelines ## ARGO helm package registry From 4797a8dd74ac0b4bcc68a6153bcce51ca8bc0f29 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 21:47:14 +0100 Subject: [PATCH 081/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index aa12795..102ce0d 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -114,7 +114,7 @@ spec: dest: spec.arguments.parameters.0.value - src: dependencyName: github-push-event - dataKey: body.repository.name + #dataKey: body.repository.name dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event From d288e71c5d6ce430259e93009e435bc3cf43d870 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 21:48:37 +0100 Subject: [PATCH 082/132] no message --- helm-pipelines/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/README.md b/helm-pipelines/README.md index 2ae4828..255a84b 100644 --- a/helm-pipelines/README.md +++ b/helm-pipelines/README.md @@ -1,4 +1,4 @@ -# helm-pipelines +# helm-pipelines ## ARGO helm package registry From f14410f8267005c4d85d22d0bc44041d837f7a09 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 21:50:31 +0100 Subject: [PATCH 083/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 102ce0d..2b46abc 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -114,7 +114,7 @@ spec: dest: spec.arguments.parameters.0.value - src: dependencyName: github-push-event - #dataKey: body.repository.name + dataKey: body dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event From 1364af529ea3d08d146fa0cb517a382c644bb0c2 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 21:51:45 +0100 Subject: [PATCH 084/132] no message --- helm-pipelines/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/README.md b/helm-pipelines/README.md index 255a84b..29a76cf 100644 --- a/helm-pipelines/README.md +++ b/helm-pipelines/README.md @@ -1,4 +1,4 @@ -# helm-pipelines +# helm-pipelines ## ARGO helm package registry From bd3f5fea5954af02086879eadfeeae8b57dfe630 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 21:55:25 +0100 Subject: [PATCH 085/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 2b46abc..47b1e9c 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -114,7 +114,7 @@ spec: dest: spec.arguments.parameters.0.value - src: dependencyName: github-push-event - dataKey: body + dataKey: body.repository dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event From 9cee94ad3562a7bc6de9fb5b779371a5e495aa57 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 21:56:16 +0100 Subject: [PATCH 086/132] no message --- helm-pipelines/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/README.md b/helm-pipelines/README.md index 29a76cf..255a84b 100644 --- a/helm-pipelines/README.md +++ b/helm-pipelines/README.md @@ -1,4 +1,4 @@ -# helm-pipelines +# helm-pipelines ## ARGO helm package registry From 33f3e583b541e7e189f0c307ac1a6fad6560c041 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 22:01:11 +0100 Subject: [PATCH 087/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 47b1e9c..aa12795 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -114,7 +114,7 @@ spec: dest: spec.arguments.parameters.0.value - src: dependencyName: github-push-event - dataKey: body.repository + dataKey: body.repository.name dest: spec.arguments.parameters.1.value - src: dependencyName: github-push-event From adb11cbeaf1203624ed5bffbd88ff6080556bb6b Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 22:02:12 +0100 Subject: [PATCH 088/132] no message --- helm-pipelines/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/README.md b/helm-pipelines/README.md index 255a84b..29a76cf 100644 --- a/helm-pipelines/README.md +++ b/helm-pipelines/README.md @@ -1,4 +1,4 @@ -# helm-pipelines +# helm-pipelines ## ARGO helm package registry From 1cf06509f4c9fb0c4f2250292e4cb95ba9fb0aa8 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 22:13:46 +0100 Subject: [PATCH 089/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 5 +++++ .../templates/workflow-template/workflow-template.yaml | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index aa12795..6674913 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -71,6 +71,7 @@ spec: - name: git-owner - name: git-repository - name: git-commits + - name: git-branch - name: git-repository-type value: {{ .Values.github.repository.type }} @@ -121,6 +122,10 @@ spec: dataTemplate: '{{ "{{" }} values (pick (.Input.body.commits | first) "modified" "added" "removed") | toJson | quote | replace "[" "" | replace "]" "" | replace "," " " {{ "}}" }}' #dataTemplate: '{{ "{{" }} concat (pluck "modified" .Input.body.commits) (pluck "added" .Input.body.commits) (pluck "removed" .Input.body.commits) | uniq {{ "}}" }}' dest: spec.arguments.parameters.2.value +# - src: +# dependencyName: github-push-event +# dataKey: body.ref +# dest: spec.arguments.parameters.3.value # Append pull request number and short sha to dynamically assign worklfow name # - src: # dependencyName: github-push-event diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index a7b06a4..7ec6795 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -11,6 +11,9 @@ spec: - name: git-commits value: "no_commit" + + - name: git-branch + value: "HEAD" - name: git-repository-type value: {{ .Values.github.repository.type }} @@ -89,9 +92,9 @@ spec: then if [[ {{ "{{" }} workflow.parameters.git-commits {{ "}}" }} == "no_commit" ]] then - cd /mnt/vol && git clone https://$git_token:x-oauth-basic@github.com/$git_username/$repo_name.git git-local-dir + cd /mnt/vol && git clone --branch {{ "{{" }} workflow.parameters.git-branch {{ "}}" }} https://$git_token:x-oauth-basic@github.com/$git_username/$repo_name.git git-local-dir else - cd /mnt/vol && git clone https://$git_token:x-oauth-basic@github.com/$git_username/{{ "{{" }} workflow.parameters.git-repository {{ "}}" }}.git git-local-dir + cd /mnt/vol && git clone --branch {{ "{{" }} workflow.parameters.git-branch {{ "}}" }} https://$git_token:x-oauth-basic@github.com/$git_username/{{ "{{" }} workflow.parameters.git-repository {{ "}}" }}.git git-local-dir fi else cd /mnt/vol && git clone {{ "{{" }} workflow.parameters.git-url {{ "}}" }} git-local-dir From 2ded88955a05ba8c80aa36f69c3f630a6c3b2f0e Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 22:15:36 +0100 Subject: [PATCH 090/132] no message --- helm-pipelines/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/README.md b/helm-pipelines/README.md index 29a76cf..255a84b 100644 --- a/helm-pipelines/README.md +++ b/helm-pipelines/README.md @@ -1,4 +1,4 @@ -# helm-pipelines +# helm-pipelines ## ARGO helm package registry From 58553f4a60a9e1ffe0ee371918d22cca07e5e30c Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 22:19:50 +0100 Subject: [PATCH 091/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 4 +++- .../templates/workflow-template/workflow-template.yaml | 2 +- helm-pipelines/values.yaml | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 6674913..2ca6152 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -71,8 +71,10 @@ spec: - name: git-owner - name: git-repository - name: git-commits - - name: git-branch + - name: git-branch + value: {{ .Values.github.repository.branch }} + - name: git-repository-type value: {{ .Values.github.repository.type }} diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index 7ec6795..7bc42d6 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -13,7 +13,7 @@ spec: value: "no_commit" - name: git-branch - value: "HEAD" + value: {{ .Values.github.repository.branch }} - name: git-repository-type value: {{ .Values.github.repository.type }} diff --git a/helm-pipelines/values.yaml b/helm-pipelines/values.yaml index 762da72..211e11a 100644 --- a/helm-pipelines/values.yaml +++ b/helm-pipelines/values.yaml @@ -5,6 +5,7 @@ github: names: - advatys - helm-pipelines + branch: HEAD path: # the path shall be automatically determined using github webhook's data. # still a default path can be usefull when launching helm pipeline's workflow manually From b39593cde47f70756f4b306c612e9ec7c83d826a Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 22:21:16 +0100 Subject: [PATCH 092/132] no message --- helm-pipelines/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/README.md b/helm-pipelines/README.md index 255a84b..29a76cf 100644 --- a/helm-pipelines/README.md +++ b/helm-pipelines/README.md @@ -1,4 +1,4 @@ -# helm-pipelines +# helm-pipelines ## ARGO helm package registry From 5a8497d4ead0b623bbada0f399920bf18b50b2d5 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 22:25:45 +0100 Subject: [PATCH 093/132] no message --- helm-pipelines/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/values.yaml b/helm-pipelines/values.yaml index 211e11a..188c819 100644 --- a/helm-pipelines/values.yaml +++ b/helm-pipelines/values.yaml @@ -5,7 +5,7 @@ github: names: - advatys - helm-pipelines - branch: HEAD + branch: "origin/HEAD" path: # the path shall be automatically determined using github webhook's data. # still a default path can be usefull when launching helm pipeline's workflow manually From 2dd80ad25c06eda96b8c229b4691d6a2308c6aec Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 22:26:53 +0100 Subject: [PATCH 094/132] no message --- helm-pipelines/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/README.md b/helm-pipelines/README.md index 29a76cf..255a84b 100644 --- a/helm-pipelines/README.md +++ b/helm-pipelines/README.md @@ -1,4 +1,4 @@ -# helm-pipelines +# helm-pipelines ## ARGO helm package registry From c806a9bd6f8adba090439fbebfa4d3cd67ec0261 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 22:29:29 +0100 Subject: [PATCH 095/132] no message --- helm-pipelines/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/values.yaml b/helm-pipelines/values.yaml index 188c819..fff7a57 100644 --- a/helm-pipelines/values.yaml +++ b/helm-pipelines/values.yaml @@ -5,7 +5,7 @@ github: names: - advatys - helm-pipelines - branch: "origin/HEAD" + branch: "main" path: # the path shall be automatically determined using github webhook's data. # still a default path can be usefull when launching helm pipeline's workflow manually From 28f97cabfe692c797ad71061978e507206884986 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 25 Jul 2021 22:30:47 +0100 Subject: [PATCH 096/132] no message --- helm-pipelines/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/README.md b/helm-pipelines/README.md index 255a84b..29a76cf 100644 --- a/helm-pipelines/README.md +++ b/helm-pipelines/README.md @@ -1,4 +1,4 @@ -# helm-pipelines +# helm-pipelines ## ARGO helm package registry From 5846484984deab531a356fc2dbe2d45af79c3843 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Mon, 26 Jul 2021 14:13:05 +0100 Subject: [PATCH 097/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 2ca6152..86d43a3 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -10,8 +10,8 @@ spec: - name: github-push-event eventSourceName: {{ .Release.Name }}-github-events eventName: push -# filters: -# data: + filters: + data: # # Name of the event that triggered the delivery: [pull_request, push, yadayadayada] # # https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads # - path: body.X-GitHub-Event @@ -29,10 +29,11 @@ spec: # type: string # value: # - open -# - path: body.pull_request.base.ref -# type: string -# value: -# - master + - path: body.ref + type: string + value: + - {{ .Values.github.repository.branch }} + template: "{{ base .Input }}" triggers: - template: From 3aae1f3c73c2e345e2e1061d9a159cb01baa71d6 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Mon, 26 Jul 2021 15:03:46 +0100 Subject: [PATCH 098/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 86d43a3..0ae6527 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -32,8 +32,8 @@ spec: - path: body.ref type: string value: - - {{ .Values.github.repository.branch }} - template: "{{ base .Input }}" + - "{{ .Values.github.repository.branch }}" + template: "{{ base .Input | quote }}" triggers: - template: From 4185caa53b738915940e6ec7f98c27732a10d2d2 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Mon, 26 Jul 2021 15:13:55 +0100 Subject: [PATCH 099/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 0ae6527..3269318 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -30,10 +30,11 @@ spec: # value: # - open - path: body.ref + template: "{{ .Input | quote | base }}" type: string value: - - "{{ .Values.github.repository.branch }}" - template: "{{ base .Input | quote }}" + - {{ .Values.github.repository.branch | quote }} + triggers: - template: From ac5d627111f4bddd466287420664fc9b09e4b22e Mon Sep 17 00:00:00 2001 From: itmwiw Date: Mon, 26 Jul 2021 15:16:05 +0100 Subject: [PATCH 100/132] no message --- helm-pipelines/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/README.md b/helm-pipelines/README.md index 29a76cf..255a84b 100644 --- a/helm-pipelines/README.md +++ b/helm-pipelines/README.md @@ -1,4 +1,4 @@ -# helm-pipelines +# helm-pipelines ## ARGO helm package registry From 3e0078f8537476b0585b6da6c16c9c4656060b67 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Mon, 26 Jul 2021 15:23:08 +0100 Subject: [PATCH 101/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 3269318..8e87c6b 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -30,10 +30,9 @@ spec: # value: # - open - path: body.ref - template: "{{ .Input | quote | base }}" type: string value: - - {{ .Values.github.repository.branch | quote }} + - refs/heads/{{ .Values.github.repository.branch | quote }} triggers: From 868ac7012dad54357447004654819b5c8e6a43f5 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Mon, 26 Jul 2021 15:26:08 +0100 Subject: [PATCH 102/132] no message --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- helm-pipelines/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 8e87c6b..1ca0c78 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -32,7 +32,7 @@ spec: - path: body.ref type: string value: - - refs/heads/{{ .Values.github.repository.branch | quote }} + - refs/heads/{{ .Values.github.repository.branch }} triggers: diff --git a/helm-pipelines/values.yaml b/helm-pipelines/values.yaml index fff7a57..6b6e4d2 100644 --- a/helm-pipelines/values.yaml +++ b/helm-pipelines/values.yaml @@ -5,7 +5,7 @@ github: names: - advatys - helm-pipelines - branch: "main" + branch: main path: # the path shall be automatically determined using github webhook's data. # still a default path can be usefull when launching helm pipeline's workflow manually From 9bc3729676f12d7691257eb2ec4d9ad8003c8a85 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Mon, 26 Jul 2021 15:29:24 +0100 Subject: [PATCH 103/132] no message --- helm-pipelines/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/README.md b/helm-pipelines/README.md index 255a84b..29a76cf 100644 --- a/helm-pipelines/README.md +++ b/helm-pipelines/README.md @@ -1,4 +1,4 @@ -# helm-pipelines +# helm-pipelines ## ARGO helm package registry From 48ba49bfa31e60679ed1cbc085f8da151edc93eb Mon Sep 17 00:00:00 2001 From: itmwiw Date: Mon, 26 Jul 2021 23:28:19 +0100 Subject: [PATCH 104/132] no message --- .../templates/{ => old - voir avec anas}/events/event-bind.yaml | 0 .../secret}/secret-role-binding.yaml | 0 .../{secrets => old - voir avec anas/secret}/secret-svc.yaml | 0 .../{secrets => old - voir avec anas/secret}/secret.yaml | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename helm-pipelines/templates/{ => old - voir avec anas}/events/event-bind.yaml (100%) rename helm-pipelines/templates/{secrets => old - voir avec anas/secret}/secret-role-binding.yaml (100%) rename helm-pipelines/templates/{secrets => old - voir avec anas/secret}/secret-svc.yaml (100%) rename helm-pipelines/templates/{secrets => old - voir avec anas/secret}/secret.yaml (100%) diff --git a/helm-pipelines/templates/events/event-bind.yaml b/helm-pipelines/templates/old - voir avec anas/events/event-bind.yaml similarity index 100% rename from helm-pipelines/templates/events/event-bind.yaml rename to helm-pipelines/templates/old - voir avec anas/events/event-bind.yaml diff --git a/helm-pipelines/templates/secrets/secret-role-binding.yaml b/helm-pipelines/templates/old - voir avec anas/secret/secret-role-binding.yaml similarity index 100% rename from helm-pipelines/templates/secrets/secret-role-binding.yaml rename to helm-pipelines/templates/old - voir avec anas/secret/secret-role-binding.yaml diff --git a/helm-pipelines/templates/secrets/secret-svc.yaml b/helm-pipelines/templates/old - voir avec anas/secret/secret-svc.yaml similarity index 100% rename from helm-pipelines/templates/secrets/secret-svc.yaml rename to helm-pipelines/templates/old - voir avec anas/secret/secret-svc.yaml diff --git a/helm-pipelines/templates/secrets/secret.yaml b/helm-pipelines/templates/old - voir avec anas/secret/secret.yaml similarity index 100% rename from helm-pipelines/templates/secrets/secret.yaml rename to helm-pipelines/templates/old - voir avec anas/secret/secret.yaml From b1addde4076ee5371b841305f214c499ada7768f Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 30 Jul 2021 13:08:30 +0100 Subject: [PATCH 105/132] supress unused manifests --- .../old - voir avec anas/events/event-bind.yaml | 10 ---------- .../secret/secret-role-binding.yaml | 11 ----------- .../old - voir avec anas/secret/secret-svc.yaml | 4 ---- .../old - voir avec anas/secret/secret.yaml | 17 ----------------- .../templates/secrets/aws-secret.yaml | 14 -------------- 5 files changed, 56 deletions(-) delete mode 100644 helm-pipelines/templates/old - voir avec anas/events/event-bind.yaml delete mode 100644 helm-pipelines/templates/old - voir avec anas/secret/secret-role-binding.yaml delete mode 100644 helm-pipelines/templates/old - voir avec anas/secret/secret-svc.yaml delete mode 100644 helm-pipelines/templates/old - voir avec anas/secret/secret.yaml delete mode 100644 helm-pipelines/templates/secrets/aws-secret.yaml diff --git a/helm-pipelines/templates/old - voir avec anas/events/event-bind.yaml b/helm-pipelines/templates/old - voir avec anas/events/event-bind.yaml deleted file mode 100644 index 3379a84..0000000 --- a/helm-pipelines/templates/old - voir avec anas/events/event-bind.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: WorkflowEventBinding -metadata: - name: event-bind-workflow -spec: - event: - selector: "true" - submit: - workflowTemplateRef: - name: push-to-registry-template diff --git a/helm-pipelines/templates/old - voir avec anas/secret/secret-role-binding.yaml b/helm-pipelines/templates/old - voir avec anas/secret/secret-role-binding.yaml deleted file mode 100644 index 9735fc3..0000000 --- a/helm-pipelines/templates/old - voir avec anas/secret/secret-role-binding.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: github.com -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: submit-workflow-template -subjects: - - kind: ServiceAccount - name: github.com diff --git a/helm-pipelines/templates/old - voir avec anas/secret/secret-svc.yaml b/helm-pipelines/templates/old - voir avec anas/secret/secret-svc.yaml deleted file mode 100644 index 7e42d02..0000000 --- a/helm-pipelines/templates/old - voir avec anas/secret/secret-svc.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: github.com diff --git a/helm-pipelines/templates/old - voir avec anas/secret/secret.yaml b/helm-pipelines/templates/old - voir avec anas/secret/secret.yaml deleted file mode 100644 index a848d04..0000000 --- a/helm-pipelines/templates/old - voir avec anas/secret/secret.yaml +++ /dev/null @@ -1,17 +0,0 @@ -kind: Secret -apiVersion: v1 -metadata: - name: argo-workflows-webhook-clients -stringData: - bitbucket.org: | - type: bitbucket - secret: "my-uuid" - bitbucketserver: | - type: bitbucketserver - secret: "shh!" - github.com: | - type: github - secret: "{ SECRET NEEDS TO BE PROVIDED }" - gitlab.com: | - type: gitlab - secret: "shh!" diff --git a/helm-pipelines/templates/secrets/aws-secret.yaml b/helm-pipelines/templates/secrets/aws-secret.yaml deleted file mode 100644 index 16f89bc..0000000 --- a/helm-pipelines/templates/secrets/aws-secret.yaml +++ /dev/null @@ -1,14 +0,0 @@ - {{- if eq .Values.secrets.aws.generate "true" }} -apiVersion: v1 -kind: Secret -metadata: - name: {{ .Values.secrets.aws.name }} - annotations: - argocd.argoproj.io/sync-options: Prune=false -type: Opaque -stringData: - AWS_SECRET: "aws_secret_key" - AWS_ACCESS: "aws_accesss_key" - USERNAME: "registry_username" - PASSWORD: "registry_password" - {{- end }} \ No newline at end of file From 34d78615d3a8b7a207457cebeef592fa24261715 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 30 Jul 2021 13:14:15 +0100 Subject: [PATCH 106/132] supress unused steps --- .../templates/sensor/github-push.yaml | 9 +-- .../workflow-template/workflow-template.yaml | 71 ++----------------- 2 files changed, 6 insertions(+), 74 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 1ca0c78..6ce70dc 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -62,10 +62,6 @@ spec: requests: storage: 1Gi - volumes: - - name: aws-secrets - secret: - secretName: {{ .Values.secrets.aws.name }} arguments: parameters: @@ -88,9 +84,6 @@ spec: - name: registry-type value: {{ .Values.registry.type }} - - name: region - value: {{ .Values.registry.region }} - - name: registry value: {{ .Values.registry.url }} @@ -104,7 +97,7 @@ spec: - name: call-push-to-registry-template templateRef: name: {{ .Release.Name }}-push-to-registry-template - template: generate-token + template: helm-pipeline # arguments: # parameters: # - name: message diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index 7bc42d6..eb38312 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -27,9 +27,6 @@ spec: - name: registry-type value: {{ .Values.registry.type }} - - name: region - value: {{ .Values.registry.region }} - - name: registry value: {{ .Values.registry.url }} @@ -46,33 +43,16 @@ spec: resources: requests: storage: 1Gi - - volumes: - - name: aws-secrets - secret: - secretName: {{ .Values.secrets.aws.name }} templates: - - name: generate-token + - name: helm-pipeline steps: - - name: pull-repo template: pull-repo - - - name: create-token - template: gen-token-bash - when: "{{ "{{" }} workflow.parameters.registry-type {{ "}}" }} == aws" - - - - name: aws-login - template: login - when: "{{ "{{" }} workflow.parameters.registry-type {{ "}}" }} == aws" - arguments: - parameters: - - name: token - value: "{{ "{{" }}steps.create-token.outputs.result{{ "}}" }}" - - - - name: private-registry - template: private-registry - when: "{{ "{{" }} workflow.parameters.registry-type {{ "}}" }} == private_registry" + - - name: oci-registry + template: oci-registry + when: "{{ "{{" }} workflow.parameters.registry-type {{ "}}" }} == oci_registry" - - name: helm-package template: helm-package @@ -129,49 +109,8 @@ spec: - name: workdir mountPath: /mnt/vol - - name: gen-token-bash - script: - image: amazon/aws-cli:2.2.4 - imagePullPolicy: IfNotPresent - command: [bash] - source: | - export AWS_ACCESS_KEY_ID=$access_key - export AWS_SECRET_ACCESS_KEY=$secret_key - export AWS_DEFAULT_REGION={{ "{{" }} workflow.parameters.region {{ "}}" }} - /usr/local/bin/aws ecr-public get-login-password --region {{ "{{" }} workflow.parameters.region {{ "}}" }} - - env: - - name: access_key - valueFrom: - secretKeyRef: - name: {{ .Values.secrets.aws.name }} - key: AWS_ACCESS - - name: secret_key - valueFrom: - secretKeyRef: - name: {{ .Values.secrets.aws.name }} - key: AWS_SECRET - - - name: login - inputs: - parameters: - - name: token - script: - image: alpine/helm:3.5.4 - imagePullPolicy: IfNotPresent - command: [sh] - source: | - export HELM_EXPERIMENTAL_OCI=1 - echo {{ "{{" }} inputs.parameters.token {{ "}}" }} | helm registry login --username AWS --password-stdin {{ "{{" }} workflow.parameters.registry {{ "}}" }} - cd /mnt/vol/git-local-dir - helm chart save . {{ "{{" }} workflow.parameters.chartname {{ "}}" }} - helm chart push {{ "{{" }} workflow.parameters.chartname {{ "}}" }} - - volumeMounts: - - name: workdir - mountPath: /mnt/vol - - name: private-registry + - name: oci-registry script: image: alpine/helm:3.5.4 imagePullPolicy: IfNotPresent From e2eb9c498030e47899d0c41d55bb4c36ca18abc4 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 30 Jul 2021 15:48:01 +0100 Subject: [PATCH 107/132] change RBACs: ClusterRoles and ClusterRoleBindings instead of Roles and Roles and RoleBindings some changes in values changes in github-push Sensor: deploy in dynamically generated namespaces --- .../templates/event-source/github.yaml | 1 + .../templates/rbac/RBAC-default.yaml | 13 ++-- helm-pipelines/templates/rbac/sa-sensor.yaml | 14 ++-- .../templates/sensor/github-push.yaml | 70 +++++++------------ helm-pipelines/values.yaml | 16 ++--- 5 files changed, 44 insertions(+), 70 deletions(-) diff --git a/helm-pipelines/templates/event-source/github.yaml b/helm-pipelines/templates/event-source/github.yaml index a6eec2a..f2c1ece 100644 --- a/helm-pipelines/templates/event-source/github.yaml +++ b/helm-pipelines/templates/event-source/github.yaml @@ -33,6 +33,7 @@ spec: # You can find more info on https://developer.github.com/v3/activity/events/types/ events: - "push" + - "pull_request" # apiToken refers to K8s secret that stores the github api token # if apiToken is provided controller will create webhook on GitHub repo # +optional diff --git a/helm-pipelines/templates/rbac/RBAC-default.yaml b/helm-pipelines/templates/rbac/RBAC-default.yaml index 20aad6f..dd82371 100644 --- a/helm-pipelines/templates/rbac/RBAC-default.yaml +++ b/helm-pipelines/templates/rbac/RBAC-default.yaml @@ -1,8 +1,9 @@ {{- if eq .Values.rbac.default "true" }} +# Similarly you can use a Role and RoleBinding apiVersion: rbac.authorization.k8s.io/v1 -kind: Role +kind: ClusterRole metadata: - name: {{ .Release.Name }}-workflow-role + name: {{ .Release.Name }}-workflow-cluster-role rules: # pod get/watch is used to identify the container IDs of the current pod # pod patch is used to annotate the step's outputs back to controller (e.g. artifact location) @@ -24,13 +25,13 @@ rules: - watch --- apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding +kind: ClusterRoleBinding metadata: - name: {{ .Release.Name }}-workflow-role-binding + name: {{ .Release.Name }}-workflow-role-cluster-binding roleRef: apiGroup: rbac.authorization.k8s.io - kind: Role - name: {{ .Release.Name }}-workflow-role + kind: ClusterRole + name: {{ .Release.Name }}-workflow-cluster-role subjects: - kind: ServiceAccount name: default diff --git a/helm-pipelines/templates/rbac/sa-sensor.yaml b/helm-pipelines/templates/rbac/sa-sensor.yaml index e4e7346..4a1e6b5 100644 --- a/helm-pipelines/templates/rbac/sa-sensor.yaml +++ b/helm-pipelines/templates/rbac/sa-sensor.yaml @@ -5,11 +5,11 @@ kind: ServiceAccount metadata: name: {{ .Release.Name }}-operate-workflow-sa --- -# Similarly you can use a ClusterRole and ClusterRoleBinding +# Similarly you can use a Role and RoleBinding apiVersion: rbac.authorization.k8s.io/v1 -kind: Role +kind: ClusterRole metadata: - name: {{ .Release.Name }}-operate-workflow-role + name: {{ .Release.Name }}-operate-workflow-cluster-role rules: - apiGroups: - argoproj.io @@ -22,13 +22,13 @@ rules: - clusterworkflowtemplates --- apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding +kind: ClusterRoleBinding metadata: - name: {{ .Release.Name }}-operate-workflow-role-binding + name: {{ .Release.Name }}-operate-workflow-cluster-role-binding roleRef: apiGroup: rbac.authorization.k8s.io - kind: Role - name: {{ .Release.Name }}-operate-workflow-role + kind: ClusterRole + name: {{ .Release.Name }}-operate-workflow-cluster-role subjects: - kind: ServiceAccount name: {{ .Release.Name }}-operate-workflow-sa diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 6ce70dc..ef8b7e7 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -12,27 +12,16 @@ spec: eventName: push filters: data: -# # Name of the event that triggered the delivery: [pull_request, push, yadayadayada] -# # https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads -# - path: body.X-GitHub-Event -# type: string -# value: -# - pull_request -# - path: body.action -# type: string -# value: -# - opened -# - edited -# - reopened -# - synchronize -# - path: body.pull_request.state -# type: string -# value: -# - open - - path: body.ref + # Name of the event that triggered the delivery: [pull_request, push, yadayadayada] + # https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads + - path: body.X-GitHub-Event type: string value: - - refs/heads/{{ .Values.github.repository.branch }} + - push +# - path: body.ref +# type: string +# value: +# - refs/heads/{{ .Values.github.repository.branch }} triggers: @@ -48,8 +37,8 @@ spec: apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: -# name: github- - generateName: helm-pipeline- + name: {{ .Release.Name }}-push- + namespace: {{ .Release.Name }}-push- spec: entrypoint: call-push-to-registry-template @@ -67,19 +56,12 @@ spec: parameters: - name: git-owner - name: git-repository - - name: git-commits - - - name: git-branch - value: {{ .Values.github.repository.branch }} - name: git-repository-type value: {{ .Values.github.repository.type }} - - - name: git-url - value: "git_url" - name: git-path - value: {{ .Values.github.repository.path.default }} + value: {{ .Values.github.repository.path }} - name: registry-type value: {{ .Values.registry.type }} @@ -98,10 +80,7 @@ spec: templateRef: name: {{ .Release.Name }}-push-to-registry-template template: helm-pipeline -# arguments: -# parameters: -# - name: message -# value: "hello world" + parameters: @@ -113,20 +92,21 @@ spec: dependencyName: github-push-event dataKey: body.repository.name dest: spec.arguments.parameters.1.value - - src: - dependencyName: github-push-event - dataTemplate: '{{ "{{" }} values (pick (.Input.body.commits | first) "modified" "added" "removed") | toJson | quote | replace "[" "" | replace "]" "" | replace "," " " {{ "}}" }}' - #dataTemplate: '{{ "{{" }} concat (pluck "modified" .Input.body.commits) (pluck "added" .Input.body.commits) (pluck "removed" .Input.body.commits) | uniq {{ "}}" }}' - dest: spec.arguments.parameters.2.value # - src: # dependencyName: github-push-event -# dataKey: body.ref -# dest: spec.arguments.parameters.3.value +# dataTemplate: '{{ "{{" }} values (pick (.Input.body.commits | first) "modified" "added" "removed") | toJson | quote | replace "[" "" | replace "]" "" | replace "," " " {{ "}}" }}' +# dest: spec.arguments.parameters.2.value + # Append pull request number and short sha to dynamically assign worklfow name - # - src: - # dependencyName: github-push-event - # dataTemplate: "{{ "{{" }} .Input.body.pull_request.number {{ "}}" }}-{{ "{{" }} .Input.body.pull_request.head.sha | substr 0 7 {{ "}}" }}" - # dest: metadata.name - # operation: append + - src: + dependencyName: github-push-event + dataTemplate: "{{ "{{" }} .Input.body.before {{ "}}" }}-{{ "{{" }} .Input.body.after {{ "}}" }}" + dest: metadata.name + operation: append + - src: + dependencyName: github-push-event + dataTemplate: "{{ "{{" }} .Input.body.before {{ "}}" }}-{{ "{{" }} .Input.body.after {{ "}}" }}" + dest: metadata.namespace + operation: append # retryStrategy: # steps: 3 \ No newline at end of file diff --git a/helm-pipelines/values.yaml b/helm-pipelines/values.yaml index 6b6e4d2..99e2e15 100644 --- a/helm-pipelines/values.yaml +++ b/helm-pipelines/values.yaml @@ -1,15 +1,11 @@ github: repository: type: private # Can be private or public accordingly, private creds to be stored in a secret - owner: itmwiw + owner: owner_of_repo names: - - advatys - - helm-pipelines - branch: main - path: - # the path shall be automatically determined using github webhook's data. - # still a default path can be usefull when launching helm pipeline's workflow manually - default: default_path + - name_of_repo + path: path_to_helm_chart + webhook: # url the event-source will use to register at Github. # This url must be reachable from outside the cluster. @@ -19,7 +15,6 @@ github: registry: type: chartmuseum # Can be "aws", "private_registry" or "chartmuseum" url: http://chartmuseum.apps.advatys.thadvatys.com - region: region_name # Set when registry type is aws secrets: # when generate is set to true, this will generate a secret with required keys. @@ -27,9 +22,6 @@ secrets: git: generate: "true" # when set to true, generate a secret with required keys. name: git-secret - aws: - generate: "true" - name: aws-secret chartmuseum: generate: "true" name: chartmuseum-secret From 83486c20be2c8f403e5ffa9d570924b852da23a3 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 30 Jul 2021 16:20:17 +0100 Subject: [PATCH 108/132] change from watching multiple repos to watching only 1 repo. add pull repo for all branch: detect witch branch has been modified and add it as a parameter in the pull_repo step use the git secret only for the token instead of token + owner + repo add oci-secret remove the script that let only modified elements be pushed to registry: keep it simple for the moment and publish all configured charts in the repo --- .../templates/event-source/github.yaml | 4 +- .../templates/secrets/git-secret.yaml | 1 - .../templates/secrets/oci-secret.yaml | 13 +++++ .../templates/sensor/github-push.yaml | 13 +++-- .../workflow-template/workflow-template.yaml | 54 +++++-------------- helm-pipelines/values.yaml | 8 +-- 6 files changed, 43 insertions(+), 50 deletions(-) create mode 100644 helm-pipelines/templates/secrets/oci-secret.yaml diff --git a/helm-pipelines/templates/event-source/github.yaml b/helm-pipelines/templates/event-source/github.yaml index f2c1ece..7c4ecbf 100644 --- a/helm-pipelines/templates/event-source/github.yaml +++ b/helm-pipelines/templates/event-source/github.yaml @@ -13,8 +13,8 @@ spec: push: repositories: - owner: {{ .Values.github.repository.owner }} - names: -{{ toYaml .Values.github.repository.names | indent 10 }} + names: + - {{ .Values.github.repository.name }} # Github will send events to following port and endpoint webhook: # endpoint to listen to events on diff --git a/helm-pipelines/templates/secrets/git-secret.yaml b/helm-pipelines/templates/secrets/git-secret.yaml index 74b9d84..c34bdd1 100644 --- a/helm-pipelines/templates/secrets/git-secret.yaml +++ b/helm-pipelines/templates/secrets/git-secret.yaml @@ -9,5 +9,4 @@ type: Opaque stringData: GIT_USERNAME: "git_username" GIT_TOKEN: "git_token" - REPO_NAME: "repo_name" # Provide only the name of the repo {{- end }} \ No newline at end of file diff --git a/helm-pipelines/templates/secrets/oci-secret.yaml b/helm-pipelines/templates/secrets/oci-secret.yaml new file mode 100644 index 0000000..d561513 --- /dev/null +++ b/helm-pipelines/templates/secrets/oci-secret.yaml @@ -0,0 +1,13 @@ + {{- if eq .Values.secrets.oci.generate "true" }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Values.secrets.oci.name }} + annotations: + argocd.argoproj.io/sync-options: Prune=false +type: Opaque +stringData: + OCI_USERNAME: "oci_username" + OCI_PASSWORD: "oci_password" + OCI_TOKEN: "oci_token" + {{- end }} \ No newline at end of file diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index ef8b7e7..5f7870f 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -55,7 +55,12 @@ spec: arguments: parameters: - name: git-owner + value: {{ .Values.github.repository.owner }} + - name: git-repository + value: {{ .Values.github.repository.name }} + + - name: git-branch - name: git-repository-type value: {{ .Values.github.repository.type }} @@ -92,10 +97,10 @@ spec: dependencyName: github-push-event dataKey: body.repository.name dest: spec.arguments.parameters.1.value -# - src: -# dependencyName: github-push-event -# dataTemplate: '{{ "{{" }} values (pick (.Input.body.commits | first) "modified" "added" "removed") | toJson | quote | replace "[" "" | replace "]" "" | replace "," " " {{ "}}" }}' -# dest: spec.arguments.parameters.2.value + - src: + dependencyName: github-push-event + dataTemplate: '{{ "{{" }} .Input.body.ref {{ "}}" }}' + dest: spec.arguments.parameters.2.value # Append pull request number and short sha to dynamically assign worklfow name - src: diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index eb38312..f0a89f3 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -6,14 +6,11 @@ spec: arguments: parameters: - - name: git-repository - value: "used_by_webhook" # the "secret" method is still used when manually launching the workflow - - - name: git-commits - value: "no_commit" + - name: git-owner + value: {{ .Values.github.repository.owner }} - - name: git-branch - value: {{ .Values.github.repository.branch }} + - name: git-repository + value: {{ .Values.github.repository.name }} - name: git-repository-type value: {{ .Values.github.repository.type }} @@ -22,7 +19,7 @@ spec: value: "git_url" - name: git-path - value: {{ .Values.github.repository.path.default }} + value: {{ .Values.github.repository.path }} - name: registry-type value: {{ .Values.registry.type }} @@ -70,41 +67,18 @@ spec: source: | if [[ {{ "{{" }} workflow.parameters.git-repository-type {{ "}}" }} == "private" ]] then - if [[ {{ "{{" }} workflow.parameters.git-commits {{ "}}" }} == "no_commit" ]] - then - cd /mnt/vol && git clone --branch {{ "{{" }} workflow.parameters.git-branch {{ "}}" }} https://$git_token:x-oauth-basic@github.com/$git_username/$repo_name.git git-local-dir - else - cd /mnt/vol && git clone --branch {{ "{{" }} workflow.parameters.git-branch {{ "}}" }} https://$git_token:x-oauth-basic@github.com/$git_username/{{ "{{" }} workflow.parameters.git-repository {{ "}}" }}.git git-local-dir - fi - else - cd /mnt/vol && git clone {{ "{{" }} workflow.parameters.git-url {{ "}}" }} git-local-dir - fi - if [[ {{ "{{" }} workflow.parameters.git-commits {{ "}}" }} == "no_commit" ]] - then - echo {{ "{{" }} workflow.parameters.git-path {{ "}}" }} > git-path.txt + cd /mnt/vol && git clone --branch {{ "{{" }} workflow.parameters.git-branch {{ "}}" }} https://$git_token:x-oauth-basic@github.com/{{ "{{" }} workflow.parameters.git-owner {{ "}}" }}/{{ "{{" }} workflow.parameters.git-repository {{ "}}" }}.git git-local-dir else - declare -a modified="("{{ "{{" }} workflow.parameters.git-commits {{ "}}" }}")" - echo "${modified[@]}" - printf '%s\n' "$(dirname "${modified[@]}")" | sort -u | cut -d "/" -f1 | uniq > git-path.txt + cd /mnt/vol && git clone --branch {{ "{{" }} workflow.parameters.git-branch {{ "}}" }} https://github.com/{{ "{{" }} workflow.parameters.git-owner {{ "}}" }}/{{ "{{" }} workflow.parameters.git-repository {{ "}}" }}.git git-local-dir fi - + echo {{ "{{" }} workflow.parameters.git-path {{ "}}" }} > git-path.txt env: - - name: git_username - valueFrom: - secretKeyRef: - name: {{ .Values.secrets.git.name }} - key: GIT_USERNAME - name: git_token valueFrom: secretKeyRef: name: {{ .Values.secrets.git.name }} key: GIT_TOKEN - - name: repo_name - valueFrom: - secretKeyRef: - name: {{ .Values.secrets.git.name }} - key: REPO_NAME volumeMounts: - name: workdir mountPath: /mnt/vol @@ -119,20 +93,20 @@ spec: export HELM_EXPERIMENTAL_OCI=1 helm registry login {{ "{{" }} workflow.parameters.registry {{ "}}" }} --username $registry_username --password $registry_password cd /mnt/vol/git-local-dir - helm chart save . {{ "{{" }} workflow.parameters.chartname {{ "}}" }} - helm chart push {{ "{{" }} workflow.parameters.chartname {{ "}}" }} +# helm chart save . {{ "{{" }} workflow.parameters.chartname {{ "}}" }} +# helm chart push {{ "{{" }} workflow.parameters.chartname {{ "}}" }} env: - name: registry_username valueFrom: secretKeyRef: - name: password - key: USERNAME + name: {{ .Values.secrets.oci.name }} + key: OCI_USERNAME - name: registry_password valueFrom: secretKeyRef: - name: {{ .Values.secrets.aws.name }} - key: password + name: {{ .Values.secrets.oci.name }} + key: OCI_PASSWORD volumeMounts: - name: workdir mountPath: /mnt/vol diff --git a/helm-pipelines/values.yaml b/helm-pipelines/values.yaml index 99e2e15..dbc177e 100644 --- a/helm-pipelines/values.yaml +++ b/helm-pipelines/values.yaml @@ -2,8 +2,7 @@ github: repository: type: private # Can be private or public accordingly, private creds to be stored in a secret owner: owner_of_repo - names: - - name_of_repo + name: name_of_repo path: path_to_helm_chart webhook: @@ -25,7 +24,10 @@ secrets: chartmuseum: generate: "true" name: chartmuseum-secret - + oci: + generate: "true" # when set to true, generate a secret with required keys. + name: oci-secret + eventbus: enabled: "true" replicas: 3 From b4ee37c272020039481fbb46dd567aeae3d9deb3 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 30 Jul 2021 16:32:35 +0100 Subject: [PATCH 109/132] add .Release.Namespace for ClusterRoleBindings' SA --- helm-pipelines/templates/rbac/RBAC-default.yaml | 1 + helm-pipelines/templates/rbac/sa-sensor.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/helm-pipelines/templates/rbac/RBAC-default.yaml b/helm-pipelines/templates/rbac/RBAC-default.yaml index dd82371..7c9f4d3 100644 --- a/helm-pipelines/templates/rbac/RBAC-default.yaml +++ b/helm-pipelines/templates/rbac/RBAC-default.yaml @@ -35,4 +35,5 @@ roleRef: subjects: - kind: ServiceAccount name: default + namepsace: {{ .Release.Namespace }} {{- end }} \ No newline at end of file diff --git a/helm-pipelines/templates/rbac/sa-sensor.yaml b/helm-pipelines/templates/rbac/sa-sensor.yaml index 4a1e6b5..5682a92 100644 --- a/helm-pipelines/templates/rbac/sa-sensor.yaml +++ b/helm-pipelines/templates/rbac/sa-sensor.yaml @@ -32,4 +32,5 @@ roleRef: subjects: - kind: ServiceAccount name: {{ .Release.Name }}-operate-workflow-sa + namepsace: {{ .Release.Namespace }} {{- end }} \ No newline at end of file From 6e71e49d93e3d6004db2fe28182ec455f22cd683 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 30 Jul 2021 16:40:01 +0100 Subject: [PATCH 110/132] typo correcting --- helm-pipelines/templates/rbac/RBAC-default.yaml | 2 +- helm-pipelines/templates/rbac/sa-sensor.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-pipelines/templates/rbac/RBAC-default.yaml b/helm-pipelines/templates/rbac/RBAC-default.yaml index 7c9f4d3..6c04afc 100644 --- a/helm-pipelines/templates/rbac/RBAC-default.yaml +++ b/helm-pipelines/templates/rbac/RBAC-default.yaml @@ -35,5 +35,5 @@ roleRef: subjects: - kind: ServiceAccount name: default - namepsace: {{ .Release.Namespace }} + namespace: {{ .Release.Namespace }} {{- end }} \ No newline at end of file diff --git a/helm-pipelines/templates/rbac/sa-sensor.yaml b/helm-pipelines/templates/rbac/sa-sensor.yaml index 5682a92..a24652a 100644 --- a/helm-pipelines/templates/rbac/sa-sensor.yaml +++ b/helm-pipelines/templates/rbac/sa-sensor.yaml @@ -32,5 +32,5 @@ roleRef: subjects: - kind: ServiceAccount name: {{ .Release.Name }}-operate-workflow-sa - namepsace: {{ .Release.Namespace }} + namespace: {{ .Release.Namespace }} {{- end }} \ No newline at end of file From 8e0f6c3130896d603ffb44284b5bad0ab50f84ea Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 30 Jul 2021 16:55:24 +0100 Subject: [PATCH 111/132] add rbac's rule to grant sensor's sa namespaces creation --- helm-pipelines/templates/rbac/sa-sensor.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/helm-pipelines/templates/rbac/sa-sensor.yaml b/helm-pipelines/templates/rbac/sa-sensor.yaml index a24652a..76453e2 100644 --- a/helm-pipelines/templates/rbac/sa-sensor.yaml +++ b/helm-pipelines/templates/rbac/sa-sensor.yaml @@ -20,6 +20,12 @@ rules: - workflowtemplates - cronworkflows - clusterworkflowtemplates + - apiGroups: + - "" + resources: + - namespaces + verbs: + - create --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding From 15801c50513a9981545094d150264e06a51d5bfa Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 30 Jul 2021 17:30:29 +0100 Subject: [PATCH 112/132] adding trigger's template for namespace creation -> sensor --- .../templates/sensor/github-push.yaml | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 5f7870f..1a80516 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -25,6 +25,27 @@ spec: triggers: + - template: + name: create-namespace-trigger + k8s: + group: "" + version: v1 + resource: namespaces + operation: create + source: + resource: + apiVersion: v1 + kind: Namespace + metadata: + name: {{ .Release.Name }}-push- + + parameters: + - src: + dependencyName: github-push-event + dataTemplate: "{{ "{{" }} .Input.body.before {{ "}}" }}-{{ "{{" }} .Input.body.after {{ "}}" }}" + dest: metadata.name + operation: append + - template: name: github-workflow-trigger k8s: @@ -86,8 +107,6 @@ spec: name: {{ .Release.Name }}-push-to-registry-template template: helm-pipeline - - parameters: - src: dependencyName: github-push-event From 237f307f95c66a80d207014268c80b867d4dc4bc Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 30 Jul 2021 17:35:53 +0100 Subject: [PATCH 113/132] add get and watch namespaces rbac --- helm-pipelines/templates/rbac/sa-sensor.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helm-pipelines/templates/rbac/sa-sensor.yaml b/helm-pipelines/templates/rbac/sa-sensor.yaml index 76453e2..0812f58 100644 --- a/helm-pipelines/templates/rbac/sa-sensor.yaml +++ b/helm-pipelines/templates/rbac/sa-sensor.yaml @@ -26,6 +26,8 @@ rules: - namespaces verbs: - create + - get + - watch --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding From c5c87968566b5dffda4deb0505a3b5aece74e374 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 30 Jul 2021 17:53:31 +0100 Subject: [PATCH 114/132] reduce name and namespace length --- helm-pipelines/templates/sensor/github-push.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 1a80516..7c48786 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -42,7 +42,7 @@ spec: parameters: - src: dependencyName: github-push-event - dataTemplate: "{{ "{{" }} .Input.body.before {{ "}}" }}-{{ "{{" }} .Input.body.after {{ "}}" }}" + dataTemplate: {{ "{{" }} .Input.body.after {{ "}}" }}" dest: metadata.name operation: append @@ -124,12 +124,12 @@ spec: # Append pull request number and short sha to dynamically assign worklfow name - src: dependencyName: github-push-event - dataTemplate: "{{ "{{" }} .Input.body.before {{ "}}" }}-{{ "{{" }} .Input.body.after {{ "}}" }}" + dataTemplate: {{ "{{" }} .Input.body.after {{ "}}" }}" dest: metadata.name operation: append - src: dependencyName: github-push-event - dataTemplate: "{{ "{{" }} .Input.body.before {{ "}}" }}-{{ "{{" }} .Input.body.after {{ "}}" }}" + dataTemplate: {{ "{{" }} .Input.body.after {{ "}}" }}" dest: metadata.namespace operation: append # retryStrategy: From 4dc10863c3a2c3619c1916fd84880bddada45c67 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 30 Jul 2021 17:54:49 +0100 Subject: [PATCH 115/132] correct typo --- helm-pipelines/templates/sensor/github-push.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 7c48786..dd38836 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -42,7 +42,7 @@ spec: parameters: - src: dependencyName: github-push-event - dataTemplate: {{ "{{" }} .Input.body.after {{ "}}" }}" + dataTemplate: "{{ "{{" }} .Input.body.after {{ "}}" }}" dest: metadata.name operation: append @@ -124,12 +124,12 @@ spec: # Append pull request number and short sha to dynamically assign worklfow name - src: dependencyName: github-push-event - dataTemplate: {{ "{{" }} .Input.body.after {{ "}}" }}" + dataTemplate: "{{ "{{" }} .Input.body.after {{ "}}" }}" dest: metadata.name operation: append - src: dependencyName: github-push-event - dataTemplate: {{ "{{" }} .Input.body.after {{ "}}" }}" + dataTemplate: "{{ "{{" }} .Input.body.after {{ "}}" }}" dest: metadata.namespace operation: append # retryStrategy: From b20cb581a7acb90a4dc5c7462c526f00c0a05882 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 31 Jul 2021 12:02:49 +0100 Subject: [PATCH 116/132] generate ns from argo-workflows instead of events: there seems to be a bug --- .../templates/sensor/github-push.yaml | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index dd38836..c33dbe9 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -28,16 +28,33 @@ spec: - template: name: create-namespace-trigger k8s: - group: "" - version: v1 - resource: namespaces + group: argoproj.io + version: v1alpha1 + resource: workflows operation: create source: resource: - apiVersion: v1 - kind: Namespace + apiVersion: argoproj.io/v1alpha1 + kind: Workflow metadata: - name: {{ .Release.Name }}-push- + name: create-ns- + namespace: {{ .Release.Namespace }} + spec: + templates: + - name: generate-namespace + resource: + action: create + manifest: | + apiVersion: v1 + kind: Namespace + metadata: + name: ns-test-"{{ "{{" }} .Input.body.after {{ "}}" }}" + successCondition: status.phase = Active + entrypoint: generate-namespace + arguments: {} + serviceAccountName: helm-pipeline-operate-workflow-sa + podGC: + strategy: OnPodSuccess parameters: - src: From 255c04039dfc0fd2aa23229a56bd3e915c3924f3 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 31 Jul 2021 12:49:33 +0100 Subject: [PATCH 117/132] add retry strategy to wait for the namespace to be created --- .../templates/sensor/github-push.yaml | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index c33dbe9..6f04fd9 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -31,15 +31,21 @@ spec: group: argoproj.io version: v1alpha1 resource: workflows - operation: create source: resource: apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: create-ns- - namespace: {{ .Release.Namespace }} + namespace: helm-pipelines spec: + arguments: + parameters: + - name: ns-name + entrypoint: generate-namespace + podGC: + strategy: OnPodSuccess + serviceAccountName: helm-pipeline-operate-workflow-sa templates: - name: generate-namespace resource: @@ -48,20 +54,20 @@ spec: apiVersion: v1 kind: Namespace metadata: - name: ns-test-"{{ "{{" }} .Input.body.after {{ "}}" }}" + name: {{ .Release.Name }}-push-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} successCondition: status.phase = Active - entrypoint: generate-namespace - arguments: {} - serviceAccountName: helm-pipeline-operate-workflow-sa - podGC: - strategy: OnPodSuccess - + operation: create parameters: - src: dependencyName: github-push-event - dataTemplate: "{{ "{{" }} .Input.body.after {{ "}}" }}" + dataKey: body.after + dest: spec.arguments.parameters.0.value + - src: + dependencyName: github-push-event + dataTemplate: '{{ .Input.body.after }}' dest: metadata.name operation: append + - template: name: github-workflow-trigger @@ -149,5 +155,6 @@ spec: dataTemplate: "{{ "{{" }} .Input.body.after {{ "}}" }}" dest: metadata.namespace operation: append -# retryStrategy: -# steps: 3 \ No newline at end of file + retryStrategy: + steps: 3 + duration: 60s \ No newline at end of file From 4b2f3955e87b12ff6e6d92f8010afe6b5a51591b Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 31 Jul 2021 12:51:42 +0100 Subject: [PATCH 118/132] typo --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 6f04fd9..4ca9abe 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -64,7 +64,7 @@ spec: dest: spec.arguments.parameters.0.value - src: dependencyName: github-push-event - dataTemplate: '{{ .Input.body.after }}' + dataTemplate: "{{ "{{" }} .Input.body.after {{ "}}" }}" dest: metadata.name operation: append From 4985641c271b05208d66baab0daa1d948d076547 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 31 Jul 2021 20:59:56 +0100 Subject: [PATCH 119/132] test workflow of workflows --- .../templates/sensor/github-push.yaml | 218 +++++++++--------- .../workflow-template/workflow-template.yaml | 2 +- 2 files changed, 113 insertions(+), 107 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 4ca9abe..ad762f5 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -26,135 +26,141 @@ spec: triggers: - template: - name: create-namespace-trigger + name: main k8s: group: argoproj.io version: v1alpha1 resource: workflows source: resource: + apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: - name: create-ns- - namespace: helm-pipelines + generateName: workflow-of-workflows- spec: + serviceAccountName: helm-pipeline-operate-workflow-sa + entrypoint: main + arguments: parameters: + - name: git-branch + value: "git_branch" - name: ns-name - entrypoint: generate-namespace - podGC: - strategy: OnPodSuccess - serviceAccountName: helm-pipeline-operate-workflow-sa + value: "ns_name" + templates: - - name: generate-namespace + - name: main + steps: + - - name: create-namespace + template: create-namespace + + - - name: launch-helm-pipeline + template: launch-helm-pipeline + + - name: create-namespace resource: action: create manifest: | - apiVersion: v1 - kind: Namespace - metadata: - name: {{ .Release.Name }}-push-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} - successCondition: status.phase = Active - operation: create - parameters: - - src: - dependencyName: github-push-event - dataKey: body.after - dest: spec.arguments.parameters.0.value - - src: - dependencyName: github-push-event - dataTemplate: "{{ "{{" }} .Input.body.after {{ "}}" }}" - dest: metadata.name - operation: append - - - - template: - name: github-workflow-trigger - k8s: - group: argoproj.io - version: v1alpha1 - resource: workflows - operation: create - source: - resource: - apiVersion: argoproj.io/v1alpha1 - kind: Workflow - metadata: - name: {{ .Release.Name }}-push- - namespace: {{ .Release.Name }}-push- - spec: - entrypoint: call-push-to-registry-template - - volumeClaimTemplates: - - metadata: - name: workdir - spec: - accessModes: [ "ReadWriteOnce" ] - resources: - requests: - storage: 1Gi - - - arguments: - parameters: - - name: git-owner - value: {{ .Values.github.repository.owner }} - - - name: git-repository - value: {{ .Values.github.repository.name }} - - - name: git-branch + apiVersion: argoproj.io/v1alpha1 + kind: Workflow + metadata: + name: create-ns-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} + namespace: {{ .Release.Namespace }} + spec: + arguments: + parameters: + - name: ns-name + value: "ns_name" + entrypoint: generate-namespace + podGC: + strategy: OnPodSuccess + serviceAccountName: helm-pipeline-operate-workflow-sa + templates: + - name: generate-namespace + resource: + action: create + manifest: | + apiVersion: v1 + kind: Namespace + metadata: + name: {{ .Release.Name }}-push-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} + labels: + app: helm-pipelines + successCondition: status.phase = Active + failureCondition: status.phase in (Failed, Error) + - - name: git-repository-type - value: {{ .Values.github.repository.type }} - - - name: git-path - value: {{ .Values.github.repository.path }} - - - name: registry-type - value: {{ .Values.registry.type }} - - - name: registry - value: {{ .Values.registry.url }} - - - name: chartname - value: "chart_name" - - templates: - - name: call-push-to-registry-template - dag: - tasks: - - name: call-push-to-registry-template - templateRef: - name: {{ .Release.Name }}-push-to-registry-template - template: helm-pipeline + - name: launch-helm-pipeline + resource: + action: create + manifest: | + apiVersion: argoproj.io/v1alpha1 + kind: Workflow + metadata: + name: {{ .Release.Name }}-push-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} + namespace: {{ .Release.Name }}-push-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} + spec: + entrypoint: call-push-to-registry-template + + volumeClaimTemplates: + - metadata: + name: workdir + spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: 1Gi + + arguments: + parameters: + - name: git-owner + value: {{ .Values.github.repository.owner }} + + - name: git-repository + value: {{ .Values.github.repository.name }} + + - name: git-branch + value: "git_branch" + + - name: ns-name + value: "ns_name" + + - name: git-repository-type + value: {{ .Values.github.repository.type }} + + - name: git-path + value: {{ .Values.github.repository.path }} + + - name: registry-type + value: {{ .Values.registry.type }} + + - name: registry + value: {{ .Values.registry.url }} + + - name: chartname + value: "chart_name" + + templates: + - name: call-push-to-registry-template + dag: + tasks: + - name: call-push-to-registry-template + templateRef: + name: {{ .Release.Name }}-push-to-registry-template + template: helm-pipeline + + successCondition: status.phase == Succeeded + failureCondition: status.phase in (Failed, Error) + parameters: - src: dependencyName: github-push-event - dataKey: body.repository.owner.name + dataTemplate: '{{ "{{" }} .Input.body.ref {{ "}}" }}' dest: spec.arguments.parameters.0.value - src: dependencyName: github-push-event - dataKey: body.repository.name + dataKey: body.after dest: spec.arguments.parameters.1.value - - src: - dependencyName: github-push-event - dataTemplate: '{{ "{{" }} .Input.body.ref {{ "}}" }}' - dest: spec.arguments.parameters.2.value - - # Append pull request number and short sha to dynamically assign worklfow name - - src: - dependencyName: github-push-event - dataTemplate: "{{ "{{" }} .Input.body.after {{ "}}" }}" - dest: metadata.name - operation: append - - src: - dependencyName: github-push-event - dataTemplate: "{{ "{{" }} .Input.body.after {{ "}}" }}" - dest: metadata.namespace - operation: append - retryStrategy: - steps: 3 - duration: 60s \ No newline at end of file + \ No newline at end of file diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index f0a89f3..f80b6b2 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -1,5 +1,5 @@ apiVersion: argoproj.io/v1alpha1 -kind: WorkflowTemplate +kind: ClusterWorkflowTemplate metadata: name: {{ .Release.Name }}-push-to-registry-template spec: From d8c06e7fe1a28755e4605b9dd3886aeba1ad79f8 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 31 Jul 2021 21:06:21 +0100 Subject: [PATCH 120/132] add clusterscope to workflowTemplate --- helm-pipelines/templates/sensor/github-push.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index ad762f5..0e20cfa 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -149,6 +149,7 @@ spec: templateRef: name: {{ .Release.Name }}-push-to-registry-template template: helm-pipeline + clusterScope: true successCondition: status.phase == Succeeded failureCondition: status.phase in (Failed, Error) From 9bc5a59d22d0d8db7b36bb3dc3e6e6174ff3e518 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 31 Jul 2021 23:18:57 +0100 Subject: [PATCH 121/132] add kyverno policy to clone secrets --- .../templates/policies/duplicate-secrets.yaml | 56 +++++++++++++++++++ helm-pipelines/values.yaml | 7 ++- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 helm-pipelines/templates/policies/duplicate-secrets.yaml diff --git a/helm-pipelines/templates/policies/duplicate-secrets.yaml b/helm-pipelines/templates/policies/duplicate-secrets.yaml new file mode 100644 index 0000000..8a27681 --- /dev/null +++ b/helm-pipelines/templates/policies/duplicate-secrets.yaml @@ -0,0 +1,56 @@ + {{- if eq .Values.kyvernoPolicy.enabled "true" }} +apiVersion: kyverno.io/v1 +kind: ClusterPolicy +metadata: + name: sync-{{ .Release.Namespace }}-secrets +spec: + rules: + - name: sync-git-secret + match: + resources: + kinds: + - Namespace + selector: + matchLabels: + app: helm-pipelines + generate: + kind: Secret + name: {{ .Values.secrets.git.name }} + namespace: "{{request.object.metadata.name}}" + synchronize : true + clone: + namespace: {{ .Release.Namespace }} + name: {{ .Values.secrets.git.name }} + - name: sync-oci-secret + match: + resources: + kinds: + - Namespace + selector: + matchLabels: + app: helm-pipelines + generate: + kind: Secret + name: {{ .Values.secrets.oci.name }} + namespace: "{{request.object.metadata.name}}" + synchronize : true + clone: + namespace: {{ .Release.Namespace }} + name: {{ .Values.secrets.oci.name }} + - name: sync-chartmuseum-secret + match: + resources: + kinds: + - Namespace + selector: + matchLabels: + app: helm-pipelines + generate: + kind: Secret + name: {{ .Values.secrets.chartmuseum.name }} + namespace: "{{request.object.metadata.name}}" + synchronize : true + clone: + namespace: {{ .Release.Namespace }} + name: {{ .Values.secrets.chartmuseum.name }} + {{- end }} \ No newline at end of file diff --git a/helm-pipelines/values.yaml b/helm-pipelines/values.yaml index dbc177e..b005efa 100644 --- a/helm-pipelines/values.yaml +++ b/helm-pipelines/values.yaml @@ -27,7 +27,12 @@ secrets: oci: generate: "true" # when set to true, generate a secret with required keys. name: oci-secret - + +kyvernoPolicy: +#create a kyverno policy that clone secrets from release's namespace to namespaces' where the pipelines would be executed +#set to false if the policy is already created + enabled: "true" + eventbus: enabled: "true" replicas: 3 From 9bf269a36e1726939dcaeda26a680a49737aaf99 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sat, 31 Jul 2021 23:22:30 +0100 Subject: [PATCH 122/132] typo --- helm-pipelines/templates/policies/duplicate-secrets.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helm-pipelines/templates/policies/duplicate-secrets.yaml b/helm-pipelines/templates/policies/duplicate-secrets.yaml index 8a27681..714513f 100644 --- a/helm-pipelines/templates/policies/duplicate-secrets.yaml +++ b/helm-pipelines/templates/policies/duplicate-secrets.yaml @@ -16,7 +16,7 @@ spec: generate: kind: Secret name: {{ .Values.secrets.git.name }} - namespace: "{{request.object.metadata.name}}" + namespace: "{{ "{{" }}request.object.metadata.name{{ "}}" }}" synchronize : true clone: namespace: {{ .Release.Namespace }} @@ -32,7 +32,7 @@ spec: generate: kind: Secret name: {{ .Values.secrets.oci.name }} - namespace: "{{request.object.metadata.name}}" + namespace: "{{ "{{" }}request.object.metadata.name{{ "}}" }}" synchronize : true clone: namespace: {{ .Release.Namespace }} @@ -48,7 +48,7 @@ spec: generate: kind: Secret name: {{ .Values.secrets.chartmuseum.name }} - namespace: "{{request.object.metadata.name}}" + namespace: "{{ "{{" }}request.object.metadata.name{{ "}}" }}" synchronize : true clone: namespace: {{ .Release.Namespace }} From 87d024548deeb963d40b37391dd64057fc782cda Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 1 Aug 2021 19:02:16 +0100 Subject: [PATCH 123/132] test vault integration --- .../templates/policies/duplicate-secrets.yaml | 56 ------------------- .../templates/rbac/RBAC-default.yaml | 2 +- .../templates/secrets/chartmuseum-secret.yaml | 13 ----- .../templates/secrets/git-secret.yaml | 12 ---- .../templates/secrets/oci-secret.yaml | 13 ----- .../templates/sensor/github-push.yaml | 32 +++++++++++ helm-pipelines/values.yaml | 34 +++++------ 7 files changed, 50 insertions(+), 112 deletions(-) delete mode 100644 helm-pipelines/templates/policies/duplicate-secrets.yaml delete mode 100644 helm-pipelines/templates/secrets/chartmuseum-secret.yaml delete mode 100644 helm-pipelines/templates/secrets/git-secret.yaml delete mode 100644 helm-pipelines/templates/secrets/oci-secret.yaml diff --git a/helm-pipelines/templates/policies/duplicate-secrets.yaml b/helm-pipelines/templates/policies/duplicate-secrets.yaml deleted file mode 100644 index 714513f..0000000 --- a/helm-pipelines/templates/policies/duplicate-secrets.yaml +++ /dev/null @@ -1,56 +0,0 @@ - {{- if eq .Values.kyvernoPolicy.enabled "true" }} -apiVersion: kyverno.io/v1 -kind: ClusterPolicy -metadata: - name: sync-{{ .Release.Namespace }}-secrets -spec: - rules: - - name: sync-git-secret - match: - resources: - kinds: - - Namespace - selector: - matchLabels: - app: helm-pipelines - generate: - kind: Secret - name: {{ .Values.secrets.git.name }} - namespace: "{{ "{{" }}request.object.metadata.name{{ "}}" }}" - synchronize : true - clone: - namespace: {{ .Release.Namespace }} - name: {{ .Values.secrets.git.name }} - - name: sync-oci-secret - match: - resources: - kinds: - - Namespace - selector: - matchLabels: - app: helm-pipelines - generate: - kind: Secret - name: {{ .Values.secrets.oci.name }} - namespace: "{{ "{{" }}request.object.metadata.name{{ "}}" }}" - synchronize : true - clone: - namespace: {{ .Release.Namespace }} - name: {{ .Values.secrets.oci.name }} - - name: sync-chartmuseum-secret - match: - resources: - kinds: - - Namespace - selector: - matchLabels: - app: helm-pipelines - generate: - kind: Secret - name: {{ .Values.secrets.chartmuseum.name }} - namespace: "{{ "{{" }}request.object.metadata.name{{ "}}" }}" - synchronize : true - clone: - namespace: {{ .Release.Namespace }} - name: {{ .Values.secrets.chartmuseum.name }} - {{- end }} \ No newline at end of file diff --git a/helm-pipelines/templates/rbac/RBAC-default.yaml b/helm-pipelines/templates/rbac/RBAC-default.yaml index 6c04afc..dc81d1b 100644 --- a/helm-pipelines/templates/rbac/RBAC-default.yaml +++ b/helm-pipelines/templates/rbac/RBAC-default.yaml @@ -25,7 +25,7 @@ rules: - watch --- apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding +kind: RoleBinding metadata: name: {{ .Release.Name }}-workflow-role-cluster-binding roleRef: diff --git a/helm-pipelines/templates/secrets/chartmuseum-secret.yaml b/helm-pipelines/templates/secrets/chartmuseum-secret.yaml deleted file mode 100644 index 5b92965..0000000 --- a/helm-pipelines/templates/secrets/chartmuseum-secret.yaml +++ /dev/null @@ -1,13 +0,0 @@ - {{- if eq .Values.secrets.chartmuseum.generate "true" }} -apiVersion: v1 -kind: Secret -metadata: - name: {{ .Values.secrets.chartmuseum.name }} - annotations: - argocd.argoproj.io/sync-options: Prune=false -type: Opaque -stringData: - CHARTMUSEUM_USERNAME: "chartmuseum_username" - CHARTMUSEUM_PASSWORD: "chartmuseum_password" - CHARTMUSEUM_TOKEN: "charmuseum_token" - {{- end }} \ No newline at end of file diff --git a/helm-pipelines/templates/secrets/git-secret.yaml b/helm-pipelines/templates/secrets/git-secret.yaml deleted file mode 100644 index c34bdd1..0000000 --- a/helm-pipelines/templates/secrets/git-secret.yaml +++ /dev/null @@ -1,12 +0,0 @@ - {{- if eq .Values.secrets.git.generate "true" }} -apiVersion: v1 -kind: Secret -metadata: - name: {{ .Values.secrets.git.name }} - annotations: - argocd.argoproj.io/sync-options: Prune=false -type: Opaque -stringData: - GIT_USERNAME: "git_username" - GIT_TOKEN: "git_token" - {{- end }} \ No newline at end of file diff --git a/helm-pipelines/templates/secrets/oci-secret.yaml b/helm-pipelines/templates/secrets/oci-secret.yaml deleted file mode 100644 index d561513..0000000 --- a/helm-pipelines/templates/secrets/oci-secret.yaml +++ /dev/null @@ -1,13 +0,0 @@ - {{- if eq .Values.secrets.oci.generate "true" }} -apiVersion: v1 -kind: Secret -metadata: - name: {{ .Values.secrets.oci.name }} - annotations: - argocd.argoproj.io/sync-options: Prune=false -type: Opaque -stringData: - OCI_USERNAME: "oci_username" - OCI_PASSWORD: "oci_password" - OCI_TOKEN: "oci_token" - {{- end }} \ No newline at end of file diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 0e20cfa..ef90602 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -87,6 +87,38 @@ spec: name: {{ .Release.Name }}-push-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} labels: app: helm-pipelines + --- + apiVersion: v1 + kind: Secret + metadata: + name: {{ .Release.Name }}-secret + namespace: {{ .Release.Name }}-push-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} + annotations: + vault.security.banzaicloud.io/vault-addr: '{{ .Values.vault.address }}' + vault.security.banzaicloud.io/vault-path: {{ .Values.vault.path }} + vault.security.banzaicloud.io/vault-role: {{ .Values.vault.role }} + vault.security.banzaicloud.io/vault-skip-verify: '{{ .Values.vault.skipVerify }}' + type: Opaque + stringData: + GIT_TOKEN: vault:{{ .Values.vault.secrets.git.location }}#{{ .Values.vault.secrets.git.gitToken }} + CHARTMUSEUM_USERNAME: vault:{{ .Values.vault.secrets.chartmuseum.location }}#{{ .Values.vault.secrets.chartmuseum.chartmuseumUsername }} + CHARTMUSEUM_PASSWORD: vault:{{ .Values.vault.secrets.chartmuseum.location }}#{{ .Values.vault.secrets.chartmuseum.chartmuseumPassword }} + OCI_USERNAME: vault:{{ .Values.vault.secrets.oci.location }}#{{ .Values.vault.secrets.oci.ociUsername }} + OCI_PASSWORD: vault:{{ .Values.vault.secrets.oci.location }}#{{ .Values.vault.secrets.oci.ociPassword }} + --- + apiVersion: rbac.authorization.k8s.io/v1 + kind: RoleBinding + metadata: + name: {{ .Release.Name }}-workflow-role-cluster-binding + namespace: {{ .Release.Name }}-push-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} + roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ .Release.Name }}-workflow-cluster-role + subjects: + - kind: ServiceAccount + name: default + namespace: {{ .Release.Name }}-push-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} successCondition: status.phase = Active failureCondition: status.phase in (Failed, Error) diff --git a/helm-pipelines/values.yaml b/helm-pipelines/values.yaml index b005efa..8d83a03 100644 --- a/helm-pipelines/values.yaml +++ b/helm-pipelines/values.yaml @@ -14,24 +14,24 @@ github: registry: type: chartmuseum # Can be "aws", "private_registry" or "chartmuseum" url: http://chartmuseum.apps.advatys.thadvatys.com - -secrets: - # when generate is set to true, this will generate a secret with required keys. - # those secrets' values should be replaced with real values (ex: git token, etc.) - git: - generate: "true" # when set to true, generate a secret with required keys. - name: git-secret - chartmuseum: - generate: "true" - name: chartmuseum-secret - oci: - generate: "true" # when set to true, generate a secret with required keys. - name: oci-secret -kyvernoPolicy: -#create a kyverno policy that clone secrets from release's namespace to namespaces' where the pipelines would be executed -#set to false if the policy is already created - enabled: "true" +vault: + address: "http://vault.vault.svc.cluster.local:8200" + path: kubernetes + role: webhook + skipVerify: "true" + secrets: + git: + location: secret/data/git/config #git secrets' path in vault + gitToken: git_token_vault_key + chartmuseum: + location: secret/data/chartmuseum/config #chartmuseum secrets' path in vault + chartmuseumUsername: chartmuseum_username_vault_key + chartmuseumPassword: chartmuseum_password_vault_key + oci: + location: secret/data/oci/config #oci secrets' path in vault + ociUsername: oci_username_vault_key + ociPassword: oci_password_vault_key eventbus: enabled: "true" From 36d436cbc8a8131440f99bfd7c920ca1c3b956fc Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 1 Aug 2021 19:08:36 +0100 Subject: [PATCH 124/132] regroup all secrets in one --- .../templates/workflow-template/workflow-template.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/helm-pipelines/templates/workflow-template/workflow-template.yaml b/helm-pipelines/templates/workflow-template/workflow-template.yaml index f80b6b2..f9e26d8 100644 --- a/helm-pipelines/templates/workflow-template/workflow-template.yaml +++ b/helm-pipelines/templates/workflow-template/workflow-template.yaml @@ -77,7 +77,7 @@ spec: - name: git_token valueFrom: secretKeyRef: - name: {{ .Values.secrets.git.name }} + name: {{ .Release.Name }}-secret key: GIT_TOKEN volumeMounts: - name: workdir @@ -100,12 +100,12 @@ spec: - name: registry_username valueFrom: secretKeyRef: - name: {{ .Values.secrets.oci.name }} + name: {{ .Release.Name }}-secret key: OCI_USERNAME - name: registry_password valueFrom: secretKeyRef: - name: {{ .Values.secrets.oci.name }} + name: {{ .Release.Name }}-secret key: OCI_PASSWORD volumeMounts: - name: workdir @@ -150,12 +150,12 @@ spec: - name: registry_username valueFrom: secretKeyRef: - name: {{ .Values.secrets.chartmuseum.name }} + name: {{ .Release.Name }}-secret key: CHARTMUSEUM_USERNAME - name: registry_password valueFrom: secretKeyRef: - name: {{ .Values.secrets.chartmuseum.name }} + name: {{ .Release.Name }}-secret key: CHARTMUSEUM_PASSWORD volumeMounts: - name: workdir From b780871650549938d9f10affcaa22148352c1c0e Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 1 Aug 2021 19:18:32 +0100 Subject: [PATCH 125/132] add rbacs to operate-workflow-sa: create and watch secrets and rolebindings --- helm-pipelines/templates/rbac/sa-sensor.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/helm-pipelines/templates/rbac/sa-sensor.yaml b/helm-pipelines/templates/rbac/sa-sensor.yaml index 0812f58..1aa776b 100644 --- a/helm-pipelines/templates/rbac/sa-sensor.yaml +++ b/helm-pipelines/templates/rbac/sa-sensor.yaml @@ -28,6 +28,22 @@ rules: - create - get - watch + - apiGroups: + - "rbac.authorization.k8s.io" + resources: + - rolebindings + verbs: + - create + - get + - watch + - apiGroups: + - "" + resources: + - secrets + verbs: + - create + - get + - watch --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding From c85d081ec62abcdcccb436cf8cd4c0aed834829e Mon Sep 17 00:00:00 2001 From: itmwiw Date: Sun, 1 Aug 2021 23:04:46 +0100 Subject: [PATCH 126/132] add rbac: bind clusterRole --- helm-pipelines/templates/rbac/sa-sensor.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/helm-pipelines/templates/rbac/sa-sensor.yaml b/helm-pipelines/templates/rbac/sa-sensor.yaml index 1aa776b..4291186 100644 --- a/helm-pipelines/templates/rbac/sa-sensor.yaml +++ b/helm-pipelines/templates/rbac/sa-sensor.yaml @@ -44,6 +44,11 @@ rules: - create - get - watch + - apiGroups: ["rbac.authorization.k8s.io"] + resources: ["clusterroles"] + verbs: ["bind"] + # omit resourceNames to allow binding any ClusterRole + resourceNames: ["{{ .Release.Name }}-workflow-cluster-role"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding From 2d422215131a7e7cd444e5ee28f26c6945c98220 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Mon, 2 Aug 2021 00:35:07 +0100 Subject: [PATCH 127/132] split manifest creation (ns, secret, rb) in 3 --- .../templates/sensor/github-push.yaml | 118 +++++++++--------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index ef90602..9dff8e0 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -41,6 +41,8 @@ spec: spec: serviceAccountName: helm-pipeline-operate-workflow-sa entrypoint: main + podGC: + strategy: OnPodSuccess arguments: parameters: @@ -54,6 +56,12 @@ spec: steps: - - name: create-namespace template: create-namespace + + - - name: create-secret + template: create-secret + + - - name: bind-cluster-role + template: bind-cluster-role - - name: launch-helm-pipeline template: launch-helm-pipeline @@ -62,66 +70,58 @@ spec: resource: action: create manifest: | - apiVersion: argoproj.io/v1alpha1 - kind: Workflow + apiVersion: v1 + kind: Namespace + metadata: + name: {{ .Release.Name }}-push-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} + labels: + app: helm-pipelines + successCondition: status.phase = Active + failureCondition: status.phase in (Failed, Error) + + - name: create-secret + resource: + action: create + manifest: | + apiVersion: v1 + kind: Secret metadata: - name: create-ns-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} - namespace: {{ .Release.Namespace }} - spec: - arguments: - parameters: - - name: ns-name - value: "ns_name" - entrypoint: generate-namespace - podGC: - strategy: OnPodSuccess - serviceAccountName: helm-pipeline-operate-workflow-sa - templates: - - name: generate-namespace - resource: - action: create - manifest: | - apiVersion: v1 - kind: Namespace - metadata: - name: {{ .Release.Name }}-push-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} - labels: - app: helm-pipelines - --- - apiVersion: v1 - kind: Secret - metadata: - name: {{ .Release.Name }}-secret - namespace: {{ .Release.Name }}-push-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} - annotations: - vault.security.banzaicloud.io/vault-addr: '{{ .Values.vault.address }}' - vault.security.banzaicloud.io/vault-path: {{ .Values.vault.path }} - vault.security.banzaicloud.io/vault-role: {{ .Values.vault.role }} - vault.security.banzaicloud.io/vault-skip-verify: '{{ .Values.vault.skipVerify }}' - type: Opaque - stringData: - GIT_TOKEN: vault:{{ .Values.vault.secrets.git.location }}#{{ .Values.vault.secrets.git.gitToken }} - CHARTMUSEUM_USERNAME: vault:{{ .Values.vault.secrets.chartmuseum.location }}#{{ .Values.vault.secrets.chartmuseum.chartmuseumUsername }} - CHARTMUSEUM_PASSWORD: vault:{{ .Values.vault.secrets.chartmuseum.location }}#{{ .Values.vault.secrets.chartmuseum.chartmuseumPassword }} - OCI_USERNAME: vault:{{ .Values.vault.secrets.oci.location }}#{{ .Values.vault.secrets.oci.ociUsername }} - OCI_PASSWORD: vault:{{ .Values.vault.secrets.oci.location }}#{{ .Values.vault.secrets.oci.ociPassword }} - --- - apiVersion: rbac.authorization.k8s.io/v1 - kind: RoleBinding - metadata: - name: {{ .Release.Name }}-workflow-role-cluster-binding - namespace: {{ .Release.Name }}-push-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} - roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: {{ .Release.Name }}-workflow-cluster-role - subjects: - - kind: ServiceAccount - name: default - namespace: {{ .Release.Name }}-push-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} - successCondition: status.phase = Active - failureCondition: status.phase in (Failed, Error) - + name: {{ .Release.Name }}-secret + namespace: {{ .Release.Name }}-push-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} + annotations: + vault.security.banzaicloud.io/vault-addr: '{{ .Values.vault.address }}' + vault.security.banzaicloud.io/vault-path: {{ .Values.vault.path }} + vault.security.banzaicloud.io/vault-role: {{ .Values.vault.role }} + vault.security.banzaicloud.io/vault-skip-verify: '{{ .Values.vault.skipVerify }}' + type: Opaque + stringData: + GIT_TOKEN: vault:{{ .Values.vault.secrets.git.location }}#{{ .Values.vault.secrets.git.gitToken }} + CHARTMUSEUM_USERNAME: vault:{{ .Values.vault.secrets.chartmuseum.location }}#{{ .Values.vault.secrets.chartmuseum.chartmuseumUsername }} + CHARTMUSEUM_PASSWORD: vault:{{ .Values.vault.secrets.chartmuseum.location }}#{{ .Values.vault.secrets.chartmuseum.chartmuseumPassword }} + OCI_USERNAME: vault:{{ .Values.vault.secrets.oci.location }}#{{ .Values.vault.secrets.oci.ociUsername }} + OCI_PASSWORD: vault:{{ .Values.vault.secrets.oci.location }}#{{ .Values.vault.secrets.oci.ociPassword }} + successCondition: status.phase = Active + failureCondition: status.phase in (Failed, Error) + + - name: bind-cluster-role + resource: + action: create + manifest: | + apiVersion: rbac.authorization.k8s.io/v1 + kind: RoleBinding + metadata: + name: {{ .Release.Name }}-workflow-role-cluster-binding + namespace: {{ .Release.Name }}-push-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} + roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ .Release.Name }}-workflow-cluster-role + subjects: + - kind: ServiceAccount + name: default + namespace: {{ .Release.Name }}-push-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} + successCondition: status.phase = Active + failureCondition: status.phase in (Failed, Error) - name: launch-helm-pipeline resource: From 8abc2bad81f37518ff788a0e24124950a981a973 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Mon, 2 Aug 2021 00:53:30 +0100 Subject: [PATCH 128/132] update successCondition --- helm-pipelines/templates/sensor/github-push.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index 9dff8e0..fbb5050 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -100,8 +100,8 @@ spec: CHARTMUSEUM_PASSWORD: vault:{{ .Values.vault.secrets.chartmuseum.location }}#{{ .Values.vault.secrets.chartmuseum.chartmuseumPassword }} OCI_USERNAME: vault:{{ .Values.vault.secrets.oci.location }}#{{ .Values.vault.secrets.oci.ociUsername }} OCI_PASSWORD: vault:{{ .Values.vault.secrets.oci.location }}#{{ .Values.vault.secrets.oci.ociPassword }} - successCondition: status.phase = Active - failureCondition: status.phase in (Failed, Error) + successCondition: metadata.name = {{ .Release.Name }}-secret + #failureCondition: status.phase in (Failed, Error) - name: bind-cluster-role resource: @@ -120,8 +120,8 @@ spec: - kind: ServiceAccount name: default namespace: {{ .Release.Name }}-push-{{ "{{" }} workflow.parameters.ns-name {{ "}}" }} - successCondition: status.phase = Active - failureCondition: status.phase in (Failed, Error) + successCondition: metadata.name = {{ .Release.Name }}-workflow-role-cluster-binding + #failureCondition: status.phase in (Failed, Error) - name: launch-helm-pipeline resource: From b845ac8a54beb7d4111c6b88e562c7e662f22728 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 17 Sep 2021 23:33:37 +0100 Subject: [PATCH 129/132] generate git secret from vault --- helm-pipelines/templates/secrets/git-secret.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 helm-pipelines/templates/secrets/git-secret.yaml diff --git a/helm-pipelines/templates/secrets/git-secret.yaml b/helm-pipelines/templates/secrets/git-secret.yaml new file mode 100644 index 0000000..8598450 --- /dev/null +++ b/helm-pipelines/templates/secrets/git-secret.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Secret +metadata: + name: git-secret + annotations: + vault.security.banzaicloud.io/vault-addr: '{{ .Values.vault.address }}' + vault.security.banzaicloud.io/vault-path: {{ .Values.vault.path }} + vault.security.banzaicloud.io/vault-role: {{ .Values.vault.role }} + vault.security.banzaicloud.io/vault-skip-verify: '{{ .Values.vault.skipVerify }}' +type: Opaque +stringData: + GIT_TOKEN: vault:{{ .Values.vault.secrets.git.location }}#{{ .Values.vault.secrets.git.gitToken }} \ No newline at end of file From 01e49b77b2b6d7aac0b0a2337cfc107839cc6de3 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Fri, 17 Sep 2021 23:50:11 +0100 Subject: [PATCH 130/132] change routes default values to sandbox openshift cluster (instead of advatys cluster) --- helm-pipelines/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-pipelines/values.yaml b/helm-pipelines/values.yaml index 8d83a03..b5b3791 100644 --- a/helm-pipelines/values.yaml +++ b/helm-pipelines/values.yaml @@ -8,12 +8,12 @@ github: webhook: # url the event-source will use to register at Github. # This url must be reachable from outside the cluster. - url: github-event.apps.advatys.thadvatys.com + url: github-event.apps.sandbox.thadvatys.com route: "true" # if set to true, an openshift route will be created registry: type: chartmuseum # Can be "aws", "private_registry" or "chartmuseum" - url: http://chartmuseum.apps.advatys.thadvatys.com + url: http://chartmuseum.apps.sandbox.thadvatys.com vault: address: "http://vault.vault.svc.cluster.local:8200" From ae7d313705d7d00084f3fb728ca021b644e132e0 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Wed, 20 Oct 2021 23:28:19 +0100 Subject: [PATCH 131/132] pull from commited branch + comment oci username and password for now --- helm-pipelines/templates/sensor/github-push.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index fbb5050..d0a72ce 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -98,8 +98,8 @@ spec: GIT_TOKEN: vault:{{ .Values.vault.secrets.git.location }}#{{ .Values.vault.secrets.git.gitToken }} CHARTMUSEUM_USERNAME: vault:{{ .Values.vault.secrets.chartmuseum.location }}#{{ .Values.vault.secrets.chartmuseum.chartmuseumUsername }} CHARTMUSEUM_PASSWORD: vault:{{ .Values.vault.secrets.chartmuseum.location }}#{{ .Values.vault.secrets.chartmuseum.chartmuseumPassword }} - OCI_USERNAME: vault:{{ .Values.vault.secrets.oci.location }}#{{ .Values.vault.secrets.oci.ociUsername }} - OCI_PASSWORD: vault:{{ .Values.vault.secrets.oci.location }}#{{ .Values.vault.secrets.oci.ociPassword }} + #OCI_USERNAME: vault:{{ .Values.vault.secrets.oci.location }}#{{ .Values.vault.secrets.oci.ociUsername }} + #OCI_PASSWORD: vault:{{ .Values.vault.secrets.oci.location }}#{{ .Values.vault.secrets.oci.ociPassword }} successCondition: metadata.name = {{ .Release.Name }}-secret #failureCondition: status.phase in (Failed, Error) @@ -153,7 +153,7 @@ spec: value: {{ .Values.github.repository.name }} - name: git-branch - value: "git_branch" + value: {{ workflow.parameters.git-branch }} - name: ns-name value: "ns_name" @@ -190,7 +190,7 @@ spec: parameters: - src: dependencyName: github-push-event - dataTemplate: '{{ "{{" }} .Input.body.ref {{ "}}" }}' + dataTemplate: '{{ "{{" }} base .Input.body.ref {{ "}}" }}' dest: spec.arguments.parameters.0.value - src: dependencyName: github-push-event From a7cfc67bf875e6097081492c87e7b81bc6887653 Mon Sep 17 00:00:00 2001 From: itmwiw Date: Wed, 20 Oct 2021 23:32:58 +0100 Subject: [PATCH 132/132] typo correction --- helm-pipelines/templates/sensor/github-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-pipelines/templates/sensor/github-push.yaml b/helm-pipelines/templates/sensor/github-push.yaml index d0a72ce..94b61fd 100644 --- a/helm-pipelines/templates/sensor/github-push.yaml +++ b/helm-pipelines/templates/sensor/github-push.yaml @@ -153,7 +153,7 @@ spec: value: {{ .Values.github.repository.name }} - name: git-branch - value: {{ workflow.parameters.git-branch }} + value: {{ "{{" }} workflow.parameters.git-branch {{ "}}" }} - name: ns-name value: "ns_name"