diff --git a/charts/common-library/README.md b/charts/common-library/README.md index b7ff5029..00eb861e 100644 --- a/charts/common-library/README.md +++ b/charts/common-library/README.md @@ -26,8 +26,5 @@ Common library that holds steps for EDP pipelines | Key | Type | Default | Description | |-----|------|---------|-------------| -| github.webhook.existingSecret | string | `"github"` | Existing secret which holds GitHub integration credentials: Username, Access Token, Secret String and Private SSH Key | -| gitlab.host | string | `"gitlab.com"` | The GitLab host, adjust this if you run a GitLab enterprise. Default: gitlab.com | -| gitlab.webhook.existingSecret | string | `"gitlab"` | Existing secret which holds GitLab integration credentials: Username, Access Token, Secret String and Private SSH Key | | global.gerritSSHPort | string | `"30003"` | Gerrit SSH node port | | tekton.resources | object | `{"limits":{"cpu":"2","memory":"3Gi"},"requests":{"cpu":"0.5","memory":"2Gi"}}` | The resource limits and requests for the Tekton Tasks | diff --git a/charts/common-library/templates/_common_github.yaml b/charts/common-library/templates/_common_github.yaml index 1453da36..1e0eefec 100644 --- a/charts/common-library/templates/_common_github.yaml +++ b/charts/common-library/templates/_common_github.yaml @@ -46,7 +46,7 @@ - name: AUTH_TYPE value: Token - name: GITHUB_TOKEN_SECRET_NAME - value: {{ .Values.github.webhook.existingSecret }} + value: ci-github - name: GITHUB_TOKEN_SECRET_KEY value: token - name: SHA @@ -109,7 +109,7 @@ finally: - name: AUTH_TYPE value: Token - name: GITHUB_TOKEN_SECRET_NAME - value: {{ .Values.github.webhook.existingSecret }} + value: ci-github - name: GITHUB_TOKEN_SECRET_KEY value: token - name: SHA @@ -135,7 +135,7 @@ finally: - name: AUTH_TYPE value: Token - name: GITHUB_TOKEN_SECRET_NAME - value: {{ .Values.github.webhook.existingSecret }} + value: ci-github - name: GITHUB_TOKEN_SECRET_KEY value: token - name: SHA diff --git a/charts/common-library/templates/_common_gitlab.yaml b/charts/common-library/templates/_common_gitlab.yaml index 8072ee4a..f94479c8 100644 --- a/charts/common-library/templates/_common_gitlab.yaml +++ b/charts/common-library/templates/_common_gitlab.yaml @@ -40,11 +40,11 @@ - name: "STATE" value: "pending" - name: "GITLAB_HOST_URL" - value: "{{ .Values.gitlab.host }}" + value: "$(params.git-source-url)" - name: "REPO_FULL_NAME" value: "$(params.gitfullrepositoryname)" - name: "GITLAB_TOKEN_SECRET_NAME" - value: {{ .Values.gitlab.webhook.existingSecret }} + value: ci-gitlab - name: "GITLAB_TOKEN_SECRET_KEY" value: token - name: "SHA" @@ -106,11 +106,11 @@ finally: - name: "STATE" value: "success" - name: "GITLAB_HOST_URL" - value: "{{ .Values.gitlab.host }}" + value: "$(params.git-source-url)" - name: "REPO_FULL_NAME" value: "$(params.gitfullrepositoryname)" - name: "GITLAB_TOKEN_SECRET_NAME" - value: {{ .Values.gitlab.webhook.existingSecret }} + value: ci-gitlab - name: "GITLAB_TOKEN_SECRET_KEY" value: token - name: "SHA" @@ -134,11 +134,11 @@ finally: - name: "STATE" value: "failed" - name: "GITLAB_HOST_URL" - value: "{{ .Values.gitlab.host }}" + value: "$(params.git-source-url)" - name: "REPO_FULL_NAME" value: "$(params.gitfullrepositoryname)" - name: "GITLAB_TOKEN_SECRET_NAME" - value: {{ .Values.gitlab.webhook.existingSecret }} + value: ci-gitlab - name: "GITLAB_TOKEN_SECRET_KEY" value: token - name: "SHA" diff --git a/charts/common-library/values.yaml b/charts/common-library/values.yaml index 2cf6393f..da6050fe 100644 --- a/charts/common-library/values.yaml +++ b/charts/common-library/values.yaml @@ -6,18 +6,6 @@ global: # -- Gerrit SSH node port gerritSSHPort: "30003" -github: - webhook: - # -- Existing secret which holds GitHub integration credentials: Username, Access Token, Secret String and Private SSH Key - existingSecret: github - -gitlab: - # -- The GitLab host, adjust this if you run a GitLab enterprise. Default: gitlab.com - host: gitlab.com - webhook: - # -- Existing secret which holds GitLab integration credentials: Username, Access Token, Secret String and Private SSH Key - existingSecret: gitlab - tekton: # --The resource limits and requests for the Tekton Tasks resources: diff --git a/charts/pipelines-library/README.md b/charts/pipelines-library/README.md index b50261c0..3711a33d 100644 --- a/charts/pipelines-library/README.md +++ b/charts/pipelines-library/README.md @@ -93,25 +93,47 @@ Follows [Tekton Interceptor](https://tekton.dev/vault/triggers-main/clusterinter | dashboard.resources | object | `{"limits":{"cpu":"60m","memory":"70Mi"},"requests":{"cpu":"50m","memory":"40Mi"}}` | The resource limits and requests for the Tekton Dashboard | | dashboard.tolerations | list | `[]` | Toleration labels for pod assignment | | dashboard.triggersNamespace | string | `"tekton-pipelines"` | Namespace where cluster tekton triggers deployed. Default: tekton-pipelines | -| eventListener.affinity | object | `{}` | Affinity settings for pod assignment | -| eventListener.enabled | bool | `true` | Deploy eventListener as a part of pipeline library when true. Default: true | -| eventListener.ingress.annotations | object | `{}` | Annotations for Ingress resource | -| eventListener.ingress.enabled | bool | `true` | Deploy EDP with eventListener ingress as a part of pipeline library when true. Default: true | -| eventListener.ingress.tls | list | `[]` | Ingress TLS configuration | -| eventListener.nodeSelector | object | `{}` | Node labels for pod assignment | -| eventListener.resources | object | `{"limits":{"cpu":"500m","memory":"128Mi"},"requests":{"cpu":"50m","memory":"64Mi"}}` | The resource limits and requests for the Tekton eventListener | -| eventListener.tolerations | list | `[]` | Toleration labels for pod assignment | | fullnameOverride | string | `""` | | -| github.host | string | `"github.com"` | The GitHub host, adjust this if you run a GitHub enterprise. Default: github.com | -| github.webhook.existingSecret | string | `"ci-github"` | Existing secret which holds GitHub integration credentials: Username, Access Token, Secret String and Private SSH Key | -| github.webhook.skipWebhookSSLVerification | bool | `false` | If true, webhook ssl verification will be skipped. Default: false | -| gitlab.host | string | `"gitlab.com"` | The GitLab host, adjust this if you run a GitLab enterprise. Default: gitlab.com | -| gitlab.webhook.existingSecret | string | `"ci-gitlab"` | Existing secret which holds GitLab integration credentials: Username, Access Token, Secret String and Private SSH Key | -| gitlab.webhook.skipWebhookSSLVerification | bool | `false` | If true, webhook ssl verification will be skipped. Default: false | +| gitServers[0].eventListener.affinity | object | `{}` | Affinity for EventListener pod assignment | +| gitServers[0].eventListener.enabled | bool | `true` | Enable EventListener | +| gitServers[0].eventListener.ingress.annotations | object | `{}` | Ingress annotations | +| gitServers[0].eventListener.ingress.enabled | bool | `true` | Enable ingress controller resource | +| gitServers[0].eventListener.ingress.tls | list | `[]` | Ingress TLS configuration | +| gitServers[0].eventListener.nodeSelector | object | `{}` | Node labels for EventListener pod assignment | +| gitServers[0].eventListener.resources | object | `{"limits":{"cpu":"500m","memory":"128Mi"},"requests":{"cpu":"50m","memory":"64Mi"}}` | EventListener resources | +| gitServers[0].eventListener.tolerations | list | `[]` | Tolerations for EventListener pod assignment | +| gitServers[0].gitProvider | string | `"github"` | | +| gitServers[0].host | string | `"github.com"` | | +| gitServers[0].name | string | `"my-github"` | | +| gitServers[0].webhook.skipWebhookSSLVerification | bool | `false` | | +| gitServers[1].eventListener.affinity | object | `{}` | Affinity for EventListener pod assignment | +| gitServers[1].eventListener.enabled | bool | `true` | Enable EventListener | +| gitServers[1].eventListener.ingress.annotations | object | `{}` | Ingress annotations | +| gitServers[1].eventListener.ingress.enabled | bool | `true` | Enable ingress controller resource | +| gitServers[1].eventListener.ingress.tls | list | `[]` | Ingress TLS configuration | +| gitServers[1].eventListener.nodeSelector | object | `{}` | Node labels for EventListener pod assignment | +| gitServers[1].eventListener.resources | object | `{"limits":{"cpu":"500m","memory":"128Mi"},"requests":{"cpu":"50m","memory":"64Mi"}}` | EventListener resources | +| gitServers[1].eventListener.tolerations | list | `[]` | Tolerations for EventListener pod assignment | +| gitServers[1].gitProvider | string | `"gitlab"` | | +| gitServers[1].host | string | `"gitlab.com"` | | +| gitServers[1].name | string | `"my-gitlab"` | | +| gitServers[1].webhook.skipWebhookSSLVerification | bool | `false` | | +| gitServers[2].eventListener.affinity | object | `{}` | Affinity for EventListener pod assignment | +| gitServers[2].eventListener.enabled | bool | `true` | Enable EventListener | +| gitServers[2].eventListener.ingress.annotations | object | `{}` | Ingress annotations | +| gitServers[2].eventListener.ingress.enabled | bool | `true` | Enable ingress controller resource | +| gitServers[2].eventListener.ingress.tls | list | `[]` | Ingress TLS configuration | +| gitServers[2].eventListener.nodeSelector | object | `{}` | Node labels for EventListener pod assignment | +| gitServers[2].eventListener.resources | object | `{"limits":{"cpu":"500m","memory":"128Mi"},"requests":{"cpu":"50m","memory":"64Mi"}}` | EventListener resources | +| gitServers[2].eventListener.tolerations | list | `[]` | Tolerations for EventListener pod assignment | +| gitServers[2].gitProvider | string | `"gerrit"` | | +| gitServers[2].host | string | `"gerrit.example.com"` | | +| gitServers[2].name | string | `"my-gerrit"` | | +| gitServers[2].webhook.skipWebhookSSLVerification | bool | `false` | | | global.dnsWildCard | string | `""` | a cluster DNS wildcard name | | global.dockerRegistry.type | string | `"ecr"` | Define Image Registry that will to be used in Pipelines. Can be ecr (default), harbor, dockerhub | | global.dockerRegistry.url | string | `".dkr.ecr..amazonaws.com/"` | Docker Registry endpoint. In dockerhub case the URL must be specified in accordance with the Kaniko name convention (docker.io/) | -| global.gitProviders | list | `["github"]` | Deploy Kubernetes Resources for the specific Git Provider. Can be gerrit, gitlab, github (default) | +| global.gitProviders | list | `["github","gitlab","gerrit"]` | Deploy Kubernetes Resources for the specific Git Provider. Can be gerrit, gitlab, github (default) | | global.platform | string | `"kubernetes"` | platform type that can be "kubernetes" or "openshift" | | interceptor.affinity | object | `{}` | Affinity settings for pod assignment | | interceptor.enabled | bool | `true` | Deploy EDP interceptor as a part of pipeline library when true. Default: true | diff --git a/charts/pipelines-library/templates/_helpers.tpl b/charts/pipelines-library/templates/_helpers.tpl index 279e8311..76b738e1 100644 --- a/charts/pipelines-library/templates/_helpers.tpl +++ b/charts/pipelines-library/templates/_helpers.tpl @@ -40,3 +40,16 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end }} + + +{{/* +Validate values of gitProviders +*/}} +{{- define "edp-tekton.validateGitProviders" -}} +{{- $allowedProviders := list "github" "gitlab" "gerrit" -}} +{{- range .Values.global.gitProviders }} + {{- if not (has . $allowedProviders) }} + {{- printf "Error: Invalid gitProvider %s. The gitProvider must be one of: %s" . (join ", " $allowedProviders) | fail }} + {{- end }} +{{- end }} +{{- end }} diff --git a/charts/pipelines-library/templates/pipelines/docker/kaniko/github-review.yaml b/charts/pipelines-library/templates/pipelines/docker/kaniko/github-review.yaml index a3805d36..7541639b 100644 --- a/charts/pipelines-library/templates/pipelines/docker/kaniko/github-review.yaml +++ b/charts/pipelines-library/templates/pipelines/docker/kaniko/github-review.yaml @@ -47,7 +47,7 @@ spec: - name: AUTH_TYPE value: Token - name: GITHUB_TOKEN_SECRET_NAME - value: {{ .Values.github.webhook.existingSecret }} + value: ci-github - name: GITHUB_TOKEN_SECRET_KEY value: token - name: SHA diff --git a/charts/pipelines-library/templates/pipelines/docker/kaniko/gitlab-review.yaml b/charts/pipelines-library/templates/pipelines/docker/kaniko/gitlab-review.yaml index aa9133a4..00a8edaf 100644 --- a/charts/pipelines-library/templates/pipelines/docker/kaniko/gitlab-review.yaml +++ b/charts/pipelines-library/templates/pipelines/docker/kaniko/gitlab-review.yaml @@ -38,11 +38,11 @@ spec: - name: "STATE" value: "pending" - name: "GITLAB_HOST_URL" - value: "{{ .Values.gitlab.host }}" + value: "$(params.git-source-url)" - name: "REPO_FULL_NAME" value: "$(params.gitfullrepositoryname)" - name: "GITLAB_TOKEN_SECRET_NAME" - value: {{ .Values.gitlab.webhook.existingSecret }} + value: ci-gitlab - name: "GITLAB_TOKEN_SECRET_KEY" value: token - name: "SHA" diff --git a/charts/pipelines-library/templates/pipelines/helm-pipelines/github-review-lib.yaml b/charts/pipelines-library/templates/pipelines/helm-pipelines/github-review-lib.yaml index 70323e7f..8c553327 100644 --- a/charts/pipelines-library/templates/pipelines/helm-pipelines/github-review-lib.yaml +++ b/charts/pipelines-library/templates/pipelines/helm-pipelines/github-review-lib.yaml @@ -55,7 +55,7 @@ spec: - name: AUTH_TYPE value: Token - name: GITHUB_TOKEN_SECRET_NAME - value: {{ .Values.github.webhook.existingSecret }} + value: ci-github - name: GITHUB_TOKEN_SECRET_KEY value: token - name: SHA diff --git a/charts/pipelines-library/templates/pipelines/helm-pipelines/gitlab-review-lib.yaml b/charts/pipelines-library/templates/pipelines/helm-pipelines/gitlab-review-lib.yaml index 2fe1a354..cb410858 100644 --- a/charts/pipelines-library/templates/pipelines/helm-pipelines/gitlab-review-lib.yaml +++ b/charts/pipelines-library/templates/pipelines/helm-pipelines/gitlab-review-lib.yaml @@ -47,11 +47,11 @@ spec: - name: "STATE" value: "pending" - name: "GITLAB_HOST_URL" - value: "{{ .Values.gitlab.host }}" + value: "$(params.git-source-url)" - name: "REPO_FULL_NAME" value: "$(params.gitfullrepositoryname)" - name: "GITLAB_TOKEN_SECRET_NAME" - value: {{ .Values.gitlab.webhook.existingSecret }} + value: ci-gitlab - name: "GITLAB_TOKEN_SECRET_KEY" value: token - name: "SHA" diff --git a/charts/pipelines-library/templates/pipelines/helm/github-review-lib.yaml b/charts/pipelines-library/templates/pipelines/helm/github-review-lib.yaml index 8b0f5dcb..5e62cabf 100644 --- a/charts/pipelines-library/templates/pipelines/helm/github-review-lib.yaml +++ b/charts/pipelines-library/templates/pipelines/helm/github-review-lib.yaml @@ -64,7 +64,7 @@ spec: - name: AUTH_TYPE value: Token - name: GITHUB_TOKEN_SECRET_NAME - value: {{ .Values.github.webhook.existingSecret }} + value: ci-github - name: GITHUB_TOKEN_SECRET_KEY value: token - name: SHA diff --git a/charts/pipelines-library/templates/pipelines/helm/github-review.yaml b/charts/pipelines-library/templates/pipelines/helm/github-review.yaml index 6f6277e4..28002324 100644 --- a/charts/pipelines-library/templates/pipelines/helm/github-review.yaml +++ b/charts/pipelines-library/templates/pipelines/helm/github-review.yaml @@ -55,7 +55,7 @@ spec: - name: AUTH_TYPE value: Token - name: GITHUB_TOKEN_SECRET_NAME - value: {{ .Values.github.webhook.existingSecret }} + value: ci-github - name: GITHUB_TOKEN_SECRET_KEY value: token - name: SHA diff --git a/charts/pipelines-library/templates/pipelines/helm/gitlab-review-lib.yaml b/charts/pipelines-library/templates/pipelines/helm/gitlab-review-lib.yaml index 98e4f8f6..9e102b4d 100644 --- a/charts/pipelines-library/templates/pipelines/helm/gitlab-review-lib.yaml +++ b/charts/pipelines-library/templates/pipelines/helm/gitlab-review-lib.yaml @@ -56,11 +56,11 @@ spec: - name: "STATE" value: "pending" - name: "GITLAB_HOST_URL" - value: "{{ .Values.gitlab.host }}" + value: "$(params.git-source-url)" - name: "REPO_FULL_NAME" value: "$(params.gitfullrepositoryname)" - name: "GITLAB_TOKEN_SECRET_NAME" - value: {{ .Values.gitlab.webhook.existingSecret }} + value: ci-gitlab - name: "GITLAB_TOKEN_SECRET_KEY" value: token - name: "SHA" diff --git a/charts/pipelines-library/templates/pipelines/helm/gitlab-review.yaml b/charts/pipelines-library/templates/pipelines/helm/gitlab-review.yaml index 434a3aee..aa3b2e59 100644 --- a/charts/pipelines-library/templates/pipelines/helm/gitlab-review.yaml +++ b/charts/pipelines-library/templates/pipelines/helm/gitlab-review.yaml @@ -47,11 +47,11 @@ spec: - name: "STATE" value: "pending" - name: "GITLAB_HOST_URL" - value: "{{ .Values.gitlab.host }}" + value: "$(params.git-source-url)" - name: "REPO_FULL_NAME" value: "$(params.gitfullrepositoryname)" - name: "GITLAB_TOKEN_SECRET_NAME" - value: {{ .Values.gitlab.webhook.existingSecret }} + value: ci-gitlab - name: "GITLAB_TOKEN_SECRET_KEY" value: token - name: "SHA" diff --git a/charts/pipelines-library/templates/pipelines/js/npm/antora/github-review.yaml b/charts/pipelines-library/templates/pipelines/js/npm/antora/github-review.yaml index 79344e0e..e49fd531 100644 --- a/charts/pipelines-library/templates/pipelines/js/npm/antora/github-review.yaml +++ b/charts/pipelines-library/templates/pipelines/js/npm/antora/github-review.yaml @@ -66,7 +66,7 @@ spec: - name: AUTH_TYPE value: Token - name: GITHUB_TOKEN_SECRET_NAME - value: {{ $.Values.github.webhook.existingSecret }} + value: ci-github - name: GITHUB_TOKEN_SECRET_KEY value: token - name: SHA diff --git a/charts/pipelines-library/templates/pipelines/js/npm/antora/gitlab-review.yaml b/charts/pipelines-library/templates/pipelines/js/npm/antora/gitlab-review.yaml index 733d3e57..88d99da9 100644 --- a/charts/pipelines-library/templates/pipelines/js/npm/antora/gitlab-review.yaml +++ b/charts/pipelines-library/templates/pipelines/js/npm/antora/gitlab-review.yaml @@ -57,11 +57,11 @@ spec: - name: "STATE" value: "pending" - name: "GITLAB_HOST_URL" - value: "{{ $.Values.gitlab.host }}" + value: "$(params.git-source-url)" - name: "REPO_FULL_NAME" value: "$(params.gitfullrepositoryname)" - name: "GITLAB_TOKEN_SECRET_NAME" - value: {{ $.Values.gitlab.webhook.existingSecret }} + value: ci-gitlab - name: "GITLAB_TOKEN_SECRET_KEY" value: token - name: "SHA" diff --git a/charts/pipelines-library/templates/pipelines/opa/github-review-lib.yaml b/charts/pipelines-library/templates/pipelines/opa/github-review-lib.yaml index 1e827384..90198f2c 100644 --- a/charts/pipelines-library/templates/pipelines/opa/github-review-lib.yaml +++ b/charts/pipelines-library/templates/pipelines/opa/github-review-lib.yaml @@ -51,7 +51,7 @@ spec: - name: AUTH_TYPE value: Token - name: GITHUB_TOKEN_SECRET_NAME - value: {{ .Values.github.webhook.existingSecret }} + value: ci-github - name: GITHUB_TOKEN_SECRET_KEY value: token - name: SHA diff --git a/charts/pipelines-library/templates/pipelines/opa/gitlab-review-lib.yaml b/charts/pipelines-library/templates/pipelines/opa/gitlab-review-lib.yaml index 00b1e67f..80141eed 100644 --- a/charts/pipelines-library/templates/pipelines/opa/gitlab-review-lib.yaml +++ b/charts/pipelines-library/templates/pipelines/opa/gitlab-review-lib.yaml @@ -42,11 +42,11 @@ spec: - name: "STATE" value: "pending" - name: "GITLAB_HOST_URL" - value: "{{ .Values.gitlab.host }}" + value: "$(params.git-source-url)" - name: "REPO_FULL_NAME" value: "$(params.gitfullrepositoryname)" - name: "GITLAB_TOKEN_SECRET_NAME" - value: {{ .Values.gitlab.webhook.existingSecret }} + value: ci-gitlab - name: "GITLAB_TOKEN_SECRET_KEY" value: token - name: "SHA" diff --git a/charts/pipelines-library/templates/resources/edpcomponents/github.yaml b/charts/pipelines-library/templates/resources/edpcomponents/github.yaml deleted file mode 100644 index dd4fd976..00000000 --- a/charts/pipelines-library/templates/resources/edpcomponents/github.yaml +++ /dev/null @@ -1,13 +0,0 @@ -{{ if has "github" .Values.global.gitProviders }} -apiVersion: v1.edp.epam.com/v1 -kind: EDPComponent -metadata: - name: github - labels: - {{- include "edp-tekton.labels" . | nindent 4 }} -spec: - type: github - url: "https://{{ .Values.github.host }}" - visible: true - icon: "PHN2ZyB3aWR0aD0iOTgiIGhlaWdodD0iOTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik00OC44NTQgMEMyMS44MzkgMCAwIDIyIDAgNDkuMjE3YzAgMjEuNzU2IDEzLjk5MyA0MC4xNzIgMzMuNDA1IDQ2LjY5IDIuNDI3LjQ5IDMuMzE2LTEuMDU5IDMuMzE2LTIuMzYyIDAtMS4xNDEtLjA4LTUuMDUyLS4wOC05LjEyNy0xMy41OSAyLjkzNC0xNi40Mi01Ljg2Ny0xNi40Mi01Ljg2Ny0yLjE4NC01LjcwNC01LjQyLTcuMTctNS40Mi03LjE3LTQuNDQ4LTMuMDE1LjMyNC0zLjAxNS4zMjQtMy4wMTUgNC45MzQuMzI2IDcuNTIzIDUuMDUyIDcuNTIzIDUuMDUyIDQuMzY3IDcuNDk2IDExLjQwNCA1LjM3OCAxNC4yMzUgNC4wNzQuNDA0LTMuMTc4IDEuNjk5LTUuMzc4IDMuMDc0LTYuNi0xMC44MzktMS4xNDEtMjIuMjQzLTUuMzc4LTIyLjI0My0yNC4yODMgMC01LjM3OCAxLjk0LTkuNzc4IDUuMDE0LTEzLjItLjQ4NS0xLjIyMi0yLjE4NC02LjI3NS40ODYtMTMuMDM4IDAgMCA0LjEyNS0xLjMwNCAxMy40MjYgNS4wNTJhNDYuOTcgNDYuOTcgMCAwIDEgMTIuMjE0LTEuNjNjNC4xMjUgMCA4LjMzLjU3MSAxMi4yMTMgMS42MyA5LjMwMi02LjM1NiAxMy40MjctNS4wNTIgMTMuNDI3LTUuMDUyIDIuNjcgNi43NjMuOTcgMTEuODE2LjQ4NSAxMy4wMzggMy4xNTUgMy40MjIgNS4wMTUgNy44MjIgNS4wMTUgMTMuMiAwIDE4LjkwNS0xMS40MDQgMjMuMDYtMjIuMzI0IDI0LjI4MyAxLjc4IDEuNTQ4IDMuMzE2IDQuNDgxIDMuMzE2IDkuMTI2IDAgNi42LS4wOCAxMS44OTctLjA4IDEzLjUyNiAwIDEuMzA0Ljg5IDIuODUzIDMuMzE2IDIuMzY0IDE5LjQxMi02LjUyIDMzLjQwNS0yNC45MzUgMzMuNDA1LTQ2LjY5MUM5Ny43MDcgMjIgNzUuNzg4IDAgNDguODU0IDB6IiBmaWxsPSIjMjQyOTJmIi8+PC9zdmc+" -{{ end }} diff --git a/charts/pipelines-library/templates/resources/edpcomponents/gitlab.yaml b/charts/pipelines-library/templates/resources/edpcomponents/gitlab.yaml deleted file mode 100644 index 08543842..00000000 --- a/charts/pipelines-library/templates/resources/edpcomponents/gitlab.yaml +++ /dev/null @@ -1,13 +0,0 @@ -{{ if has "gitlab" .Values.global.gitProviders }} -apiVersion: v1.edp.epam.com/v1 -kind: EDPComponent -metadata: - name: gitlab - labels: - {{- include "edp-tekton.labels" . | nindent 4 }} -spec: - type: gitlab - url: "https://{{ .Values.gitlab.host }}" - visible: true - icon: "PHN2ZyB3aWR0aD0iMjUwMCIgaGVpZ2h0PSIyMzA1IiB2aWV3Qm94PSIwIDAgMjU2IDIzNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWluWU1pbiBtZWV0Ij48cGF0aCBkPSJNMTI4LjA3NSAyMzYuMDc1bDQ3LjEwNC0xNDQuOTdIODAuOTdsNDcuMTA0IDE0NC45N3oiIGZpbGw9IiNFMjQzMjkiLz48cGF0aCBkPSJNMTI4LjA3NSAyMzYuMDc0TDgwLjk3IDkxLjEwNEgxNC45NTZsMTEzLjExOSAxNDQuOTd6IiBmaWxsPSIjRkM2RDI2Ii8+PHBhdGggZD0iTTE0Ljk1NiA5MS4xMDRMLjY0MiAxMzUuMTZhOS43NTIgOS43NTIgMCAwIDAgMy41NDIgMTAuOTAzbDEyMy44OTEgOTAuMDEyLTExMy4xMi0xNDQuOTd6IiBmaWxsPSIjRkNBMzI2Ii8+PHBhdGggZD0iTTE0Ljk1NiA5MS4xMDVIODAuOTdMNTIuNjAxIDMuNzljLTEuNDYtNC40OTMtNy44MTYtNC40OTItOS4yNzUgMGwtMjguMzcgODcuMzE1eiIgZmlsbD0iI0UyNDMyOSIvPjxwYXRoIGQ9Ik0xMjguMDc1IDIzNi4wNzRsNDcuMTA0LTE0NC45N2g2Ni4wMTVsLTExMy4xMiAxNDQuOTd6IiBmaWxsPSIjRkM2RDI2Ii8+PHBhdGggZD0iTTI0MS4xOTQgOTEuMTA0bDE0LjMxNCA0NC4wNTZhOS43NTIgOS43NTIgMCAwIDEtMy41NDMgMTAuOTAzbC0xMjMuODkgOTAuMDEyIDExMy4xMTktMTQ0Ljk3eiIgZmlsbD0iI0ZDQTMyNiIvPjxwYXRoIGQ9Ik0yNDEuMTk0IDkxLjEwNWgtNjYuMDE1bDI4LjM3LTg3LjMxNWMxLjQ2LTQuNDkzIDcuODE2LTQuNDkyIDkuMjc1IDBsMjguMzcgODcuMzE1eiIgZmlsbD0iI0UyNDMyOSIvPjwvc3ZnPg==" -{{ end }} diff --git a/charts/pipelines-library/templates/resources/gitservers/eventlistener.yaml b/charts/pipelines-library/templates/resources/gitservers/eventlistener.yaml new file mode 100644 index 00000000..c4f13d78 --- /dev/null +++ b/charts/pipelines-library/templates/resources/gitservers/eventlistener.yaml @@ -0,0 +1,37 @@ +{{- range .Values.gitServers }} +{{- if and (has .gitProvider $.Values.global.gitProviders) .eventListener.enabled }} +apiVersion: triggers.tekton.dev/v1beta1 +kind: EventListener +metadata: + name: edp-{{ .gitProvider }} + labels: + {{- include "edp-tekton.labels" $ | nindent 4 }} +spec: + triggers: + - triggerRef: {{ .gitProvider }}-build + - triggerRef: {{ .gitProvider }}-review + resources: + kubernetesResource: + spec: + template: + spec: + serviceAccountName: tekton-triggers-sa-{{ $.Release.Namespace }} + containers: + - name: '' + resources: + {{- toYaml .eventListener.resources | nindent 18 }} + {{- with .eventListener.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 14 }} + {{- end }} + {{- with .eventListener.affinity }} + affinity: + {{- toYaml . | nindent 14 }} + {{- end }} + {{- with .eventListener.tolerations }} + tolerations: + {{- toYaml . | nindent 14 }} + {{- end }} +{{- end }} +--- +{{- end }} diff --git a/charts/pipelines-library/templates/resources/gitservers/github.yaml b/charts/pipelines-library/templates/resources/gitservers/github.yaml deleted file mode 100644 index 5ea4d47e..00000000 --- a/charts/pipelines-library/templates/resources/gitservers/github.yaml +++ /dev/null @@ -1,16 +0,0 @@ -{{ if has "github" .Values.global.gitProviders }} -apiVersion: v2.edp.epam.com/v1 -kind: GitServer -metadata: - name: github - labels: - {{- include "edp-tekton.labels" . | nindent 4 }} -spec: - gitHost: {{ .Values.github.host }} - gitProvider: github - gitUser: git - httpsPort: 443 - nameSshKeySecret: {{ .Values.github.webhook.existingSecret }} - sshPort: 22 - skipWebhookSSLVerification: {{ .Values.github.webhook.skipWebhookSSLVerification }} -{{ end }} diff --git a/charts/pipelines-library/templates/resources/gitservers/gitlab.yaml b/charts/pipelines-library/templates/resources/gitservers/gitlab.yaml deleted file mode 100644 index aaf91a91..00000000 --- a/charts/pipelines-library/templates/resources/gitservers/gitlab.yaml +++ /dev/null @@ -1,16 +0,0 @@ -{{ if has "gitlab" .Values.global.gitProviders }} -apiVersion: v2.edp.epam.com/v1 -kind: GitServer -metadata: - name: gitlab - labels: - {{- include "edp-tekton.labels" . | nindent 4 }} -spec: - gitHost: {{ .Values.gitlab.host }} - gitProvider: gitlab - gitUser: git - httpsPort: 443 - nameSshKeySecret: {{ .Values.gitlab.webhook.existingSecret }} - sshPort: 22 - skipWebhookSSLVerification: {{ .Values.gitlab.webhook.skipWebhookSSLVerification }} -{{ end }} diff --git a/charts/pipelines-library/templates/resources/gitservers/gitserver.yaml b/charts/pipelines-library/templates/resources/gitservers/gitserver.yaml new file mode 100644 index 00000000..587c377c --- /dev/null +++ b/charts/pipelines-library/templates/resources/gitservers/gitserver.yaml @@ -0,0 +1,19 @@ +{{- range .Values.gitServers }} +{{- if has .gitProvider $.Values.global.gitProviders }} +apiVersion: v2.edp.epam.com/v1 +kind: GitServer +metadata: + name: {{ .name }} + labels: + {{- include "edp-tekton.labels" $ | nindent 4 }} +spec: + gitHost: {{ .host }} + gitProvider: {{ .gitProvider }} + gitUser: git + httpsPort: 443 + nameSshKeySecret: {{ printf "ci-%s" .gitProvider | quote }} + sshPort: 22 + skipWebhookSSLVerification: {{ .webhook.skipWebhookSSLVerification }} +{{- end }} +--- +{{- end }} diff --git a/charts/pipelines-library/templates/resources/ingress-eventlistener.yaml b/charts/pipelines-library/templates/resources/gitservers/ingress-eventlistener.yaml similarity index 57% rename from charts/pipelines-library/templates/resources/ingress-eventlistener.yaml rename to charts/pipelines-library/templates/resources/gitservers/ingress-eventlistener.yaml index bddf1671..8706138c 100644 --- a/charts/pipelines-library/templates/resources/ingress-eventlistener.yaml +++ b/charts/pipelines-library/templates/resources/gitservers/ingress-eventlistener.yaml @@ -1,32 +1,30 @@ {{- if eq .Values.global.platform "kubernetes" }} -{{- if .Values.eventListener.ingress.enabled }} -{{- $root := . -}} -{{- $gitProviders := .Values.global.gitProviders -}} -{{- range $gitProvider := $gitProviders }} - +{{- $root := $ -}} +{{- range .Values.gitServers }} +{{- if and (has .gitProvider $.Values.global.gitProviders) .eventListener.ingress.enabled }} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: event-listener-{{ $gitProvider }} + name: event-listener-{{ .gitProvider }} labels: {{- include "edp-tekton.labels" $root | nindent 4 }} - {{- with $root.Values.eventListener.ingress.annotations }} annotations: + {{- with .eventListener.ingress.annotations }} {{- toYaml . | nindent 4 }} - {{- end }} + {{- end }} spec: -{{- if $root.Values.eventListener.ingress.tls }} +{{- if .eventListener.ingress.tls }} tls: - {{- range $root.Values.eventListener.ingress.tls }} + {{- range .eventListener.ingress.tls }} - hosts: {{- range .hosts }} - {{ . | quote }} {{- end }} secretName: {{ .secretName }} {{- end }} - {{- end }} +{{- end }} rules: - - host: el-{{ $gitProvider }}-{{ $root.Release.Namespace }}.{{ $root.Values.global.dnsWildCard }} + - host: el-{{ .gitProvider }}-{{ $root.Release.Namespace }}.{{ $root.Values.global.dnsWildCard }} http: paths: - path: / @@ -34,9 +32,10 @@ spec: backend: service: # The service name will come from EventListener CR - name: el-edp-{{ $gitProvider }} + name: el-edp-{{ .gitProvider }} port: number: 8080 {{- end }} +--- {{- end }} {{- end }} diff --git a/charts/pipelines-library/templates/resources/gitservers/quicklink.yaml b/charts/pipelines-library/templates/resources/gitservers/quicklink.yaml new file mode 100644 index 00000000..1172a17f --- /dev/null +++ b/charts/pipelines-library/templates/resources/gitservers/quicklink.yaml @@ -0,0 +1,22 @@ +{{- range .Values.gitServers }} +{{- if has .gitProvider $.Values.global.gitProviders }} +apiVersion: v2.edp.epam.com/v1 +kind: QuickLink +metadata: + name: {{ .gitProvider }} + labels: + {{- include "edp-tekton.labels" $ | nindent 4 }} +spec: + type: system + url: "https://{{ .host }}" + visible: true + {{- if eq .gitProvider "github" }} + icon: "PHN2ZyB3aWR0aD0iOTgiIGhlaWdodD0iOTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik00OC44NTQgMEMyMS44MzkgMCAwIDIyI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PC9yZWN0PgogICAgICAgICAgICA8cG9seWdvbiBpZD0iUGF0aCIgZmlsbD0iI0ZGMDAwMCIgcG9pbnRzPSI5IDEyIDE1IDEyIDE1IDE0IDkgMTQiPjwvcG9seWdvbj4KICAgICAgICAgICAgPHBvbHlnb24gaWQ9IlBhdGgiIGZpbGw9IiNGRjAwMDAiIHBvaW50cz0iMTggMTIgMjQgMTIgMjQgMTQgMTggMTQiPjwvcG9seWdvbj4KICAgICAgICAgICAgPHBvbHlnb24gaWQ9IlBhdGgiIGZpbGw9IiMwMDgwMDAiIHBvaW50cz0iOSAxOCAxMSAxOCAxMSAxNiAxMyAxNiAxMyAxOCAxNSAxOCAxNSAyMCAxMyAyMCAxMyAyMiAxMSAyMiAxMSAyMCA5IDIwIj48L3BvbHlnb24+CiAgICAgICAgICAgIDxwb2x5Z29uIGlkPSJQYXRoIiBmaWxsPSIjMDA4MDAwIiBwb2ludHM9IjE4IDE4IDIwIDE4IDIwIDE2IDIyIDE2IDIyIDE4IDI0IDE4IDI0IDIwIDIyIDIwIDIyIDIyIDIwIDIyIDIwIDIwIDE4IDIwIj48L3BvbHlnb24+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=" + {{ end }} +{{- end }} +--- +{{- end }} diff --git a/charts/pipelines-library/templates/resources/quicklinks/github.yaml b/charts/pipelines-library/templates/resources/quicklinks/github.yaml deleted file mode 100644 index 28549772..00000000 --- a/charts/pipelines-library/templates/resources/quicklinks/github.yaml +++ /dev/null @@ -1,13 +0,0 @@ -{{ if has "github" .Values.global.gitProviders }} -apiVersion: v2.edp.epam.com/v1 -kind: QuickLink -metadata: - name: github - labels: - {{- include "edp-tekton.labels" . | nindent 4 }} -spec: - type: system - url: "https://{{ .Values.github.host }}" - visible: true - icon: "PHN2ZyB3aWR0aD0iOTgiIGhlaWdodD0iOTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbC1ydWxlPSJldmVub2Rk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DE5LjQxMi02LjUyIDMzLjQwNS0yNC45MzUgMzMuNDA1LTQ2LjY5MUM5Ny43MDcgMjIgNzUuNzg4IDAgNDguODU0IDB6IiBmaWxsPSIjMjQyOTJmIi8+PC9zdmc+" -{{ end }} diff --git a/charts/pipelines-library/templates/resources/quicklinks/gitlab.yaml b/charts/pipelines-library/templates/resources/quicklinks/gitlab.yaml deleted file mode 100644 index 1985cf99..00000000 --- a/charts/pipelines-library/templates/resources/quicklinks/gitlab.yaml +++ /dev/null @@ -1,11 +0,0 @@ -{{ if has "gitlab" .Values.global.gitProviders }} -apiVersion: v2.edp.epam.com/v1 -kind: QuickLink -metadata: - name: gitlab -spec: - type: system - url: "https://{{ .Values.gitlab.host }}" - visible: true - icon: "PHN2ZyB3aWR0aD0iMjUwMCIgaGVpZ2h0PSIyMzA1IiB2aWV3Qm94PSIwIDAgMjU2IDIzNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWluWU1pbiBtZWV0Ij48cGF0aCBkPSJNMTI4LjA3NSAyMzYuMDc1bDQ3LjEwNC0xNDQuOTdIODAuOTdsNDcuMTA0IDE0NC45N3oiIGZpbGw9IiNFMjQzMjkiLz48cGF0aCBkPSJNMTI4LjA3NSAyMzYuMDc0TDgwLjk3IDkxLjEwNEgxNC45NTZsMTEzLjExOSAxNDQuOTd6IiBmaWxsPSIjRkM2RDI2Ii8+PHBhdGggZD0iTTE0Ljk1NiA5MS4xMDRMLjY0MiAxMzUuMTZhOS43NTIgOS43NTIgMCAwIDAgMy41NDIgMTAuOTAzbDEyMy44OTEgOTAuMDEyLTExMy4xMi0xNDQuOTd6IiBmaWxsPSIjRkNBMzI2Ii8+PHBhdGggZD0iTTE0Ljk1NiA5MS4xMDVIODAuOTdMNTIuNjAxIDMuNzljLTEuNDYtNC40OTMtNy44MTYtNC40OTItOS4yNzUgMGwtMjguMzcgODcuMzE1eiIgZmlsbD0iI0UyNDMyOSIvPjxwYXRoIGQ9Ik0xMjguMDc1IDIzNi4wNzRsNDcuMTA0LTE0NC45N2g2Ni4wMTVsLTExMy4xMiAxNDQuOTd6IiBmaWxsPSIjRkM2RDI2Ii8+PHBhdGggZD0iTTI0MS4xOTQgOTEuMTA0bDE0LjMxNCA0NC4wNTZhOS43NTIgOS43NTIgMCAwIDEtMy41NDMgMTAuOTAzbC0xMjMuODkgOTAuMDEyIDExMy4xMTktMTQ0Ljk3eiIgZmlsbD0iI0ZDQTMyNiIvPjxwYXRoIGQ9Ik0yNDEuMTk0IDkxLjEwNWgtNjYuMDE1bDI4LjM3LTg3LjMxNWMxLjQ2LTQuNDkzIDcuODE2LTQuNDkyIDkuMjc1IDBsMjguMzcgODcuMzE1eiIgZmlsbD0iI0UyNDMyOSIvPjwvc3ZnPg==" -{{ end }} diff --git a/charts/pipelines-library/templates/tasks/gitlab-set-status.yaml b/charts/pipelines-library/templates/tasks/gitlab-set-status.yaml index e7591875..32dc3b96 100644 --- a/charts/pipelines-library/templates/tasks/gitlab-set-status.yaml +++ b/charts/pipelines-library/templates/tasks/gitlab-set-status.yaml @@ -25,7 +25,8 @@ spec: params: - name: GITLAB_HOST_URL description: | - The GitLab host, adjust this if you run a GitLab enterprise. + The GitLab host, adjust this if you run a GitLab enterprise. In EDP we use git_ssh_url + value from the event payload, format: "git@example.com:mike/diaspora.git" default: "gitlab.com" type: string @@ -122,6 +123,10 @@ spec: api_url = f"{API_PATH_PREFIX}/projects/{URLENCODED_REPO_NAME}/statuses/{SHA}?{encoded_params}" + # we need to adapt to EDP approach and extract the host from the git_ssh_url + # which is in the format: git@example.com:mike/diaspora.git + GITLAB_HOST_URL = urllib.parse.urlparse(GITLAB_HOST_URL).hostname + print(f"POST to {GITLAB_HOST_URL}{api_url}") if GITLAB_HOST_URL.startswith("http://"): diff --git a/charts/pipelines-library/templates/triggers/gerrit/eventlistener.yaml b/charts/pipelines-library/templates/triggers/gerrit/eventlistener.yaml deleted file mode 100644 index c43dc7fa..00000000 --- a/charts/pipelines-library/templates/triggers/gerrit/eventlistener.yaml +++ /dev/null @@ -1,76 +0,0 @@ -{{- if and (has "gerrit" .Values.global.gitProviders) .Values.eventListener.enabled }} -apiVersion: triggers.tekton.dev/v1beta1 -kind: EventListener -metadata: - name: edp-gerrit - labels: - {{- include "edp-tekton.labels" . | nindent 4 }} -spec: - triggers: - - name: gerrit-listener-build - interceptors: - - ref: - name: "cel" - params: - - name: "filter" - value: "body.change.status in ['MERGED']" - - ref: - name: "edp" - kind: NamespacedInterceptor - - ref: - name: "cel" - params: - - name: "overlays" - value: - - key: cbtype_short - expression: "extensions.spec.type.truncate(3)" - bindings: - - ref: gerrit-binding-build - template: - ref: gerrit-build-template - - - name: gerrit-listener-review - interceptors: - - ref: - name: "cel" - params: - - name: "filter" - value: "body.change.status in ['NEW']" - - ref: - name: "edp" - kind: NamespacedInterceptor - - ref: - name: "cel" - params: - - name: "overlays" - value: - - key: cbtype_short - expression: "extensions.spec.type.truncate(3)" - bindings: - - ref: gerrit-binding-review - template: - ref: gerrit-review-template - - resources: - kubernetesResource: - spec: - template: - spec: - serviceAccountName: tekton-triggers-sa-{{ .Release.Namespace }} - containers: - - name: '' - resources: - {{- toYaml .Values.eventListener.resources | nindent 18 }} - {{- with .Values.eventListener.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 14 }} - {{- end }} - {{- with .Values.eventListener.affinity }} - affinity: - {{- toYaml . | nindent 14 }} - {{- end }} - {{- with .Values.eventListener.tolerations }} - tolerations: - {{- toYaml . | nindent 14 }} - {{- end }} -{{ end }} diff --git a/charts/pipelines-library/templates/triggers/gerrit/trigger-build.yaml b/charts/pipelines-library/templates/triggers/gerrit/trigger-build.yaml new file mode 100644 index 00000000..e5d6cccb --- /dev/null +++ b/charts/pipelines-library/templates/triggers/gerrit/trigger-build.yaml @@ -0,0 +1,29 @@ +{{ if has "gerrit" .Values.global.gitProviders }} +apiVersion: triggers.tekton.dev/v1beta1 +kind: Trigger +metadata: + name: gerrit-build + labels: + {{- include "edp-tekton.labels" . | nindent 4 }} +spec: + interceptors: + - ref: + name: "cel" + params: + - name: "filter" + value: "body.change.status in ['MERGED']" + - ref: + name: "edp" + kind: NamespacedInterceptor + - ref: + name: "cel" + params: + - name: "overlays" + value: + - key: cbtype_short + expression: "extensions.spec.type.truncate(3)" + bindings: + - ref: gerrit-binding-build + template: + ref: gerrit-build-template +{{ end }} diff --git a/charts/pipelines-library/templates/triggers/gerrit/trigger-review.yaml b/charts/pipelines-library/templates/triggers/gerrit/trigger-review.yaml new file mode 100644 index 00000000..145354d6 --- /dev/null +++ b/charts/pipelines-library/templates/triggers/gerrit/trigger-review.yaml @@ -0,0 +1,29 @@ +{{ if has "gerrit" .Values.global.gitProviders }} +apiVersion: triggers.tekton.dev/v1beta1 +kind: Trigger +metadata: + name: gerrit-review + labels: + {{- include "edp-tekton.labels" . | nindent 4 }} +spec: + interceptors: + - ref: + name: "cel" + params: + - name: "filter" + value: "body.change.status in ['NEW']" + - ref: + name: "edp" + kind: NamespacedInterceptor + - ref: + name: "cel" + params: + - name: "overlays" + value: + - key: cbtype_short + expression: "extensions.spec.type.truncate(3)" + bindings: + - ref: gerrit-binding-review + template: + ref: gerrit-review-template +{{ end }} diff --git a/charts/pipelines-library/templates/triggers/github/eventlistener.yaml b/charts/pipelines-library/templates/triggers/github/eventlistener.yaml deleted file mode 100644 index 53f30942..00000000 --- a/charts/pipelines-library/templates/triggers/github/eventlistener.yaml +++ /dev/null @@ -1,94 +0,0 @@ -{{- if and (has "github" .Values.global.gitProviders) .Values.eventListener.enabled }} -apiVersion: triggers.tekton.dev/v1beta1 -kind: EventListener -metadata: - name: edp-github - labels: - {{- include "edp-tekton.labels" . | nindent 4 }} -spec: - triggers: - - name: github-listener-build - interceptors: - - ref: - name: "github" - params: - - name: "secretRef" - value: - secretName: {{ .Values.github.webhook.existingSecret }} - secretKey: secretString - - name: "eventTypes" - value: ["pull_request"] - - ref: - name: "cel" - params: - - name: "filter" - value: "body.action in ['closed'] && body.pull_request.merged == true" - - ref: - name: "edp" - kind: NamespacedInterceptor - - ref: - name: "cel" - params: - - name: "overlays" - value: - - key: cbtype_short - expression: "extensions.spec.type.truncate(3)" - bindings: - - ref: github-binding-build - template: - ref: github-build-template - - - name: github-listener-review - interceptors: - - ref: - name: "github" - params: - - name: "secretRef" - value: - secretName: {{ .Values.github.webhook.existingSecret }} - secretKey: secretString - - name: "eventTypes" - value: ["pull_request", "issue_comment"] - - ref: - name: "cel" - params: - - name: "filter" - value: "body.action in ['opened', 'synchronize', 'edited', 'created']" - - ref: - name: "edp" - kind: NamespacedInterceptor - - ref: - name: "cel" - params: - - name: "overlays" - value: - - key: cbtype_short - expression: "extensions.spec.type.truncate(3)" - bindings: - - ref: github-binding-review - template: - ref: github-review-template - - resources: - kubernetesResource: - spec: - template: - spec: - serviceAccountName: tekton-triggers-sa-{{ .Release.Namespace }} - containers: - - name: '' - resources: - {{- toYaml .Values.eventListener.resources | nindent 18 }} - {{- with .Values.eventListener.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 14 }} - {{- end }} - {{- with .Values.eventListener.affinity }} - affinity: - {{- toYaml . | nindent 14 }} - {{- end }} - {{- with .Values.eventListener.tolerations }} - tolerations: - {{- toYaml . | nindent 14 }} - {{- end }} -{{ end }} diff --git a/charts/pipelines-library/templates/triggers/github/trigger-build.yaml b/charts/pipelines-library/templates/triggers/github/trigger-build.yaml new file mode 100644 index 00000000..bfc573b6 --- /dev/null +++ b/charts/pipelines-library/templates/triggers/github/trigger-build.yaml @@ -0,0 +1,38 @@ +{{ if has "github" .Values.global.gitProviders }} +apiVersion: triggers.tekton.dev/v1beta1 +kind: Trigger +metadata: + name: github-build + labels: + {{- include "edp-tekton.labels" . | nindent 4 }} +spec: + interceptors: + - ref: + name: "github" + params: + - name: "secretRef" + value: + secretName: ci-github + secretKey: secretString + - name: "eventTypes" + value: ["pull_request"] + - ref: + name: "cel" + params: + - name: "filter" + value: "body.action in ['closed'] && body.pull_request.merged == true" + - ref: + name: "edp" + kind: NamespacedInterceptor + - ref: + name: "cel" + params: + - name: "overlays" + value: + - key: cbtype_short + expression: "extensions.spec.type.truncate(3)" + bindings: + - ref: github-binding-build + template: + ref: github-build-template +{{ end }} diff --git a/charts/pipelines-library/templates/triggers/github/trigger-review.yaml b/charts/pipelines-library/templates/triggers/github/trigger-review.yaml new file mode 100644 index 00000000..10a1f32b --- /dev/null +++ b/charts/pipelines-library/templates/triggers/github/trigger-review.yaml @@ -0,0 +1,38 @@ +{{ if has "github" .Values.global.gitProviders }} +apiVersion: triggers.tekton.dev/v1beta1 +kind: Trigger +metadata: + name: github-review + labels: + {{- include "edp-tekton.labels" . | nindent 4 }} +spec: + interceptors: + - ref: + name: "github" + params: + - name: "secretRef" + value: + secretName: ci-github + secretKey: secretString + - name: "eventTypes" + value: ["pull_request", "issue_comment"] + - ref: + name: "cel" + params: + - name: "filter" + value: "body.action in ['opened', 'synchronize', 'edited', 'created']" + - ref: + name: "edp" + kind: NamespacedInterceptor + - ref: + name: "cel" + params: + - name: "overlays" + value: + - key: cbtype_short + expression: "extensions.spec.type.truncate(3)" + bindings: + - ref: github-binding-review + template: + ref: github-review-template +{{ end }} diff --git a/charts/pipelines-library/templates/triggers/github/tt-build.yaml b/charts/pipelines-library/templates/triggers/github/tt-build.yaml index aa54e181..88f1c30c 100644 --- a/charts/pipelines-library/templates/triggers/github/tt-build.yaml +++ b/charts/pipelines-library/templates/triggers/github/tt-build.yaml @@ -78,5 +78,5 @@ spec: subPath: codebase - name: ssh-creds secret: - secretName: {{ .Values.github.webhook.existingSecret }} + secretName: ci-github {{ end }} diff --git a/charts/pipelines-library/templates/triggers/github/tt-review.yaml b/charts/pipelines-library/templates/triggers/github/tt-review.yaml index a3afbf88..c7f15192 100644 --- a/charts/pipelines-library/templates/triggers/github/tt-review.yaml +++ b/charts/pipelines-library/templates/triggers/github/tt-review.yaml @@ -78,5 +78,5 @@ spec: subPath: codebase - name: ssh-creds secret: - secretName: {{ .Values.github.webhook.existingSecret }} + secretName: ci-github {{ end }} diff --git a/charts/pipelines-library/templates/triggers/gitlab/eventlistener.yaml b/charts/pipelines-library/templates/triggers/gitlab/eventlistener.yaml deleted file mode 100644 index 45a68676..00000000 --- a/charts/pipelines-library/templates/triggers/gitlab/eventlistener.yaml +++ /dev/null @@ -1,94 +0,0 @@ -{{- if and (has "gitlab" .Values.global.gitProviders) .Values.eventListener.enabled }} -apiVersion: triggers.tekton.dev/v1beta1 -kind: EventListener -metadata: - name: edp-gitlab - labels: - {{- include "edp-tekton.labels" . | nindent 4 }} -spec: - triggers: - - name: gitlab-listener-build - interceptors: - - ref: - name: "gitlab" - params: - - name: "secretRef" - value: - secretName: {{ .Values.gitlab.webhook.existingSecret }} - secretKey: secretString - - name: "eventTypes" - value: ["Merge Request Hook"] - - ref: - name: "cel" - params: - - name: "filter" - value: "body.object_attributes.action in ['merge']" - - ref: - name: "edp" - kind: NamespacedInterceptor - - ref: - name: "cel" - params: - - name: "overlays" - value: - - key: cbtype_short - expression: "extensions.spec.type.truncate(3)" - bindings: - - ref: gitlab-binding-build - template: - ref: gitlab-build-template - - - name: gitlab-listener-review - interceptors: - - ref: - name: "gitlab" - params: - - name: "secretRef" - value: - secretName: {{ .Values.gitlab.webhook.existingSecret }} - secretKey: secretString - - name: "eventTypes" - value: ["Merge Request Hook", "Note Hook"] - - ref: - name: "cel" - params: - - name: "filter" - value: "body.object_attributes.action in ['open', 'reopen', 'update'] || (body.object_kind == 'note' && has(body.merge_request))" - - ref: - name: "edp" - kind: NamespacedInterceptor - - ref: - name: "cel" - params: - - name: "overlays" - value: - - key: cbtype_short - expression: "extensions.spec.type.truncate(3)" - bindings: - - ref: gitlab-binding-review - template: - ref: gitlab-review-template - - resources: - kubernetesResource: - spec: - template: - spec: - serviceAccountName: tekton-triggers-sa-{{ .Release.Namespace }} - containers: - - name: '' - resources: - {{- toYaml .Values.eventListener.resources | nindent 18 }} - {{- with .Values.eventListener.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 14 }} - {{- end }} - {{- with .Values.eventListener.affinity }} - affinity: - {{- toYaml . | nindent 14 }} - {{- end }} - {{- with .Values.eventListener.tolerations }} - tolerations: - {{- toYaml . | nindent 14 }} - {{- end }} -{{ end }} diff --git a/charts/pipelines-library/templates/triggers/gitlab/trigger-build.yaml b/charts/pipelines-library/templates/triggers/gitlab/trigger-build.yaml new file mode 100644 index 00000000..79aef593 --- /dev/null +++ b/charts/pipelines-library/templates/triggers/gitlab/trigger-build.yaml @@ -0,0 +1,38 @@ +{{ if has "gitlab" .Values.global.gitProviders }} +apiVersion: triggers.tekton.dev/v1beta1 +kind: Trigger +metadata: + name: gitlab-build + labels: + {{- include "edp-tekton.labels" . | nindent 4 }} +spec: + interceptors: + - ref: + name: "gitlab" + params: + - name: "secretRef" + value: + secretName: ci-gitlab + secretKey: secretString + - name: "eventTypes" + value: ["Merge Request Hook"] + - ref: + name: "cel" + params: + - name: "filter" + value: "body.object_attributes.action in ['merge']" + - ref: + name: "edp" + kind: NamespacedInterceptor + - ref: + name: "cel" + params: + - name: "overlays" + value: + - key: cbtype_short + expression: "extensions.spec.type.truncate(3)" + bindings: + - ref: gitlab-binding-build + template: + ref: gitlab-build-template +{{ end }} diff --git a/charts/pipelines-library/templates/triggers/gitlab/trigger-review.yaml b/charts/pipelines-library/templates/triggers/gitlab/trigger-review.yaml new file mode 100644 index 00000000..fd92059b --- /dev/null +++ b/charts/pipelines-library/templates/triggers/gitlab/trigger-review.yaml @@ -0,0 +1,38 @@ +{{ if has "gitlab" .Values.global.gitProviders }} +apiVersion: triggers.tekton.dev/v1beta1 +kind: Trigger +metadata: + name: gitlab-review + labels: + {{- include "edp-tekton.labels" . | nindent 4 }} +spec: + interceptors: + - ref: + name: "gitlab" + params: + - name: "secretRef" + value: + secretName: ci-gitlab + secretKey: secretString + - name: "eventTypes" + value: ["Merge Request Hook", "Note Hook"] + - ref: + name: "cel" + params: + - name: "filter" + value: "body.object_attributes.action in ['open', 'reopen', 'update'] || (body.object_kind == 'note' && has(body.merge_request))" + - ref: + name: "edp" + kind: NamespacedInterceptor + - ref: + name: "cel" + params: + - name: "overlays" + value: + - key: cbtype_short + expression: "extensions.spec.type.truncate(3)" + bindings: + - ref: gitlab-binding-review + template: + ref: gitlab-review-template +{{ end }} diff --git a/charts/pipelines-library/templates/triggers/gitlab/tt-build.yaml b/charts/pipelines-library/templates/triggers/gitlab/tt-build.yaml index 9f6bc396..6b7001b4 100644 --- a/charts/pipelines-library/templates/triggers/gitlab/tt-build.yaml +++ b/charts/pipelines-library/templates/triggers/gitlab/tt-build.yaml @@ -78,5 +78,5 @@ spec: subPath: codebase - name: ssh-creds secret: - secretName: {{ .Values.gitlab.webhook.existingSecret }} + secretName: ci-gitlab {{ end }} diff --git a/charts/pipelines-library/templates/triggers/gitlab/tt-review.yaml b/charts/pipelines-library/templates/triggers/gitlab/tt-review.yaml index e7d764ac..1077460a 100644 --- a/charts/pipelines-library/templates/triggers/gitlab/tt-review.yaml +++ b/charts/pipelines-library/templates/triggers/gitlab/tt-review.yaml @@ -76,5 +76,5 @@ spec: subPath: codebase - name: ssh-creds secret: - secretName: {{ .Values.gitlab.webhook.existingSecret }} + secretName: ci-gitlab {{ end }} diff --git a/charts/pipelines-library/tests/test_github_integration.py b/charts/pipelines-library/tests/test_github_integration.py index 93abf390..ac73cebb 100644 --- a/charts/pipelines-library/tests/test_github_integration.py +++ b/charts/pipelines-library/tests/test_github_integration.py @@ -10,17 +10,14 @@ def test_github_is_enabled(): r = helm_template(config) - glb = r["eventlistener"]["edp-github"]["spec"]["triggers"][0]["interceptors"][0]["params"][0]["value"] - glr = r["eventlistener"]["edp-github"]["spec"]["triggers"][1]["interceptors"][0]["params"][0]["value"] - gitserver = r["gitserver"]["github"]["spec"] + # Access the event listener using the new structure + el = r["eventlistener"]["edp-github"]["spec"] - assert "secretString" \ - == glb["secretKey"] \ - == glr["secretKey"] + # Check if the triggers are correctly set + assert "github-build" == el["triggers"][0]["triggerRef"] + assert "github-review" == el["triggers"][1]["triggerRef"] - assert "ci-github" \ - == glb["secretName"] \ - == glr["secretName"] + gitserver = r["gitserver"]["my-github"]["spec"] assert "github.com" == gitserver["gitHost"] assert "github" == gitserver["gitProvider"] @@ -28,3 +25,49 @@ def test_github_is_enabled(): assert 443 == gitserver["httpsPort"] assert "ci-github" == gitserver["nameSshKeySecret"] assert 22 == gitserver["sshPort"] + + +def test_github_build_trigger(): + config = """ +global: + gitProviders: + - github + """ + + r = helm_template(config) + + # Access the github-build trigger using the new structure + trigger = r["trigger"]["github-build"]["spec"] + + # Check if the interceptors are correctly set + assert "github" == trigger["interceptors"][0]["ref"]["name"] + assert "ci-github" == trigger["interceptors"][0]["params"][0]["value"]["secretName"] + assert ["pull_request"] == trigger["interceptors"][0]["params"][1]["value"] + + # Check if the bindings and template are correctly set + assert "github-binding-build" == trigger["bindings"][0]["ref"] + assert "github-build-template" == trigger["template"]["ref"] + + +def test_github_review_trigger(): + config = """ +global: + gitProviders: + - github + """ + + r = helm_template(config) + + # Access the github-review trigger using the new structure + trigger = r["trigger"]["github-review"]["spec"] + + # Check if the interceptors are correctly set + assert "github" == trigger["interceptors"][0]["ref"]["name"] + assert "ci-github" == trigger["interceptors"][0]["params"][0]["value"]["secretName"] + assert ["pull_request", "issue_comment"] == trigger["interceptors"][0]["params"][1][ + "value" + ] + + # Check if the bindings and template are correctly set + assert "github-binding-review" == trigger["bindings"][0]["ref"] + assert "github-review-template" == trigger["template"]["ref"] diff --git a/charts/pipelines-library/tests/test_gitlab_integration.py b/charts/pipelines-library/tests/test_gitlab_integration.py index 6f35826c..20961d81 100644 --- a/charts/pipelines-library/tests/test_gitlab_integration.py +++ b/charts/pipelines-library/tests/test_gitlab_integration.py @@ -10,14 +10,54 @@ def test_gitlab_is_enabled(): r = helm_template(config) - glb = r["eventlistener"]["edp-gitlab"]["spec"]["triggers"][0]["interceptors"][0]["params"][0]["value"] - glr = r["eventlistener"]["edp-gitlab"]["spec"]["triggers"][1]["interceptors"][0]["params"][0]["value"] - gitserver = r["gitserver"]["gitlab"]["spec"] - assert "secretString" == glb["secretKey"] == glr["secretKey"] - assert "ci-gitlab" == glb["secretName"] == glr["secretName"] + gitserver = r["gitserver"]["my-gitlab"]["spec"] assert "gitlab.com" == gitserver["gitHost"] assert "gitlab" == gitserver["gitProvider"] assert "git" == gitserver["gitUser"] assert 443 == gitserver["httpsPort"] assert "ci-gitlab" == gitserver["nameSshKeySecret"] assert 22 == gitserver["sshPort"] + + +def test_gitlab_build_trigger(): + config = """ +global: + gitProviders: + - gitlab + """ + + r = helm_template(config) + + # Access the gitlab-build trigger using the new structure + trigger = r["trigger"]["gitlab-build"]["spec"] + + # Check if the interceptors are correctly set + assert "gitlab" == trigger["interceptors"][0]["ref"]["name"] + assert "ci-gitlab" == trigger["interceptors"][0]["params"][0]["value"]["secretName"] + assert ["Merge Request Hook"] == trigger["interceptors"][0]["params"][1]["value"] + + # Check if the bindings and template are correctly set + assert "gitlab-binding-build" == trigger["bindings"][0]["ref"] + assert "gitlab-build-template" == trigger["template"]["ref"] + + +def test_gitlab_review_trigger(): + config = """ +global: + gitProviders: + - gitlab + """ + + r = helm_template(config) + + # Access the gitlab-review trigger using the new structure + trigger = r["trigger"]["gitlab-review"]["spec"] + + # Check if the interceptors are correctly set + assert "gitlab" == trigger["interceptors"][0]["ref"]["name"] + assert "ci-gitlab" == trigger["interceptors"][0]["params"][0]["value"]["secretName"] + assert ["Merge Request Hook", "Note Hook"] == trigger["interceptors"][0]["params"][1]["value"] + + # Check if the bindings and template are correctly set + assert "gitlab-binding-review" == trigger["bindings"][0]["ref"] + assert "gitlab-review-template" == trigger["template"]["ref"] diff --git a/charts/pipelines-library/values.yaml b/charts/pipelines-library/values.yaml index 013454c5..9d79a4f5 100644 --- a/charts/pipelines-library/values.yaml +++ b/charts/pipelines-library/values.yaml @@ -11,8 +11,8 @@ global: # -- Deploy Kubernetes Resources for the specific Git Provider. Can be gerrit, gitlab, github (default) gitProviders: - github - # - gitlab - # - gerrit + - gitlab + - gerrit # -- a cluster DNS wildcard name dnsWildCard: "" @@ -53,26 +53,6 @@ kaniko: # -- Save cert in secret "custom-ca-certificates" with key ca.crt customCert: false -# If gitProviders contains github, the following configuration should be provided -github: - # -- The GitHub host, adjust this if you run a GitHub enterprise. Default: github.com - host: github.com - webhook: - # -- Existing secret which holds GitHub integration credentials: Username, Access Token, Secret String and Private SSH Key - existingSecret: ci-github - # -- If true, webhook ssl verification will be skipped. Default: false - skipWebhookSSLVerification: false - -# If gitProviders contains gitlab, the following configuration should be provided -gitlab: - # -- The GitLab host, adjust this if you run a GitLab enterprise. Default: gitlab.com - host: gitlab.com - webhook: - # -- Existing secret which holds GitLab integration credentials: Username, Access Token, Secret String and Private SSH Key - existingSecret: ci-gitlab - # -- If true, webhook ssl verification will be skipped. Default: false - skipWebhookSSLVerification: false - # Tekton configuration section tekton: # Settings for the 'package-registries-auth-secret' secret that contains package registries authentication information. @@ -350,42 +330,100 @@ dashboard: # -- Affinity settings for pod assignment affinity: {} -# Event listener to listen git webhooks -# EventListener is a Kubernetes resource that listens for events from a GitProvider and triggers a PipelineRun to run a Pipeline. -# We create eventListener for each git provider -eventListener: - # We might have multiple git Servers, so we need to create eventListeners per each git server - # Currently, we create two Git Servers: GitHub and GitLab using this chart. But there is a possibility to add more Git Servers - # using the EDP Portal UI, so codebase-operator can create a new eventListener for each new Git Server, for such case we need to - # set the following value to false and disable the creation of eventListeners from chart. - # -- Deploy eventListener as a part of pipeline library when true. Default: true - enabled: true - ingress: - # -- Deploy EDP with eventListener ingress as a part of pipeline library when true. Default: true - enabled: true - # -- Annotations for Ingress resource - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - # -- Hostname(s) for the Ingress resource - # -- Ingress TLS configuration - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - - # -- The resource limits and requests for the Tekton eventListener - resources: - requests: - memory: "64Mi" - cpu: "50m" - limits: - memory: "128Mi" - cpu: "500m" - - # -- Node labels for pod assignment - nodeSelector: {} - # -- Toleration labels for pod assignment - tolerations: [] - # -- Affinity settings for pod assignment - affinity: {} +# GitServers configuration section +# GitServer creation depends on the gitProviders configuration, if gitProvider is not enabled, +# the GitServer will not be created. +# gitServers: {} +gitServers: + - name: my-github + gitProvider: github + host: github.com + webhook: + skipWebhookSSLVerification: false + eventListener: + # -- Enable EventListener + enabled: true + # -- EventListener resources + resources: + requests: + memory: "64Mi" + cpu: "50m" + limits: + memory: "128Mi" + cpu: "500m" + # -- Node labels for EventListener pod assignment + nodeSelector: {} + # -- Tolerations for EventListener pod assignment + tolerations: [] + # -- Affinity for EventListener pod assignment + affinity: {} + + ingress: + # -- Enable ingress controller resource + enabled: true + # -- Ingress annotations + annotations: {} + # -- Ingress TLS configuration + tls: [] + + - name: my-gitlab + gitProvider: gitlab + host: gitlab.com + webhook: + skipWebhookSSLVerification: false + eventListener: + # -- Enable EventListener + enabled: true + # -- EventListener resources + resources: + requests: + memory: "64Mi" + cpu: "50m" + limits: + memory: "128Mi" + cpu: "500m" + # -- Node labels for EventListener pod assignment + nodeSelector: {} + # -- Tolerations for EventListener pod assignment + tolerations: [] + # -- Affinity for EventListener pod assignment + affinity: {} + + ingress: + # -- Enable ingress controller resource + enabled: true + # -- Ingress annotations + annotations: {} + # -- Ingress TLS configuration + tls: [] + + - name: my-gerrit + gitProvider: gerrit + host: gerrit.example.com + webhook: + skipWebhookSSLVerification: false + eventListener: + # -- Enable EventListener + enabled: true + # -- EventListener resources + resources: + requests: + memory: "64Mi" + cpu: "50m" + limits: + memory: "128Mi" + cpu: "500m" + # -- Node labels for EventListener pod assignment + nodeSelector: {} + # -- Tolerations for EventListener pod assignment + tolerations: [] + # -- Affinity for EventListener pod assignment + affinity: {} + + ingress: + # -- Enable ingress controller resource + enabled: true + # -- Ingress annotations + annotations: {} + # -- Ingress TLS configuration + tls: []