diff --git a/bundle/manifests/rhdh.redhat.com_orchestrators.yaml b/bundle/manifests/rhdh.redhat.com_orchestrators.yaml index a9244f74..4594e1de 100644 --- a/bundle/manifests/rhdh.redhat.com_orchestrators.yaml +++ b/bundle/manifests/rhdh.redhat.com_orchestrators.yaml @@ -249,6 +249,26 @@ spec: available. type: string type: object + gitlab: + description: Gitlab specific configuration fields that are + injected to the backstage instance to allow the plugin to + communicate with Gitlub. + properties: + token: + default: GITLAB_TOKEN + description: Key in the secret with name defined in the + 'name' field that contains the value of the authentication + token as expected by Gitlab. Required for importing + resource to the catalog, launching software templates + and more. Defaults to 'GITLAB_TOKEN', empty for not + available. + type: string + host: + default: gitlab-host + description: The name of the host for the gitlab instance used. + Required for launching software templates. + Defaults to 'gitlab-host', empty for not available. + type: string k8s: description: Kubernetes specific configuration fields that are injected to the backstage instance to allow the plugin @@ -273,7 +293,7 @@ spec: default: backstage-backend-auth-secret description: Name of the secret that contains the credentials for the plugin to establish a communication channel with - the Kubernetes API, ArgoCD, GitHub servers and SMTP mail + the Kubernetes API, ArgoCD, GitHub/Gitlab servers and SMTP mail server. type: string notificationsEmail: diff --git a/config/crd/bases/rhdh.redhat.com_orchestrators.yaml b/config/crd/bases/rhdh.redhat.com_orchestrators.yaml index b0f436e3..958fedfa 100644 --- a/config/crd/bases/rhdh.redhat.com_orchestrators.yaml +++ b/config/crd/bases/rhdh.redhat.com_orchestrators.yaml @@ -178,6 +178,18 @@ spec: default: GITHUB_CLIENT_SECRET type: string type: object + gitlab: + description: Gitlab specific configuration fields that are injected to the backstage instance to allow the plugin to communicate with Gitlab. + properties: + token: + description: Key in the secret with name defined in the 'name' field that contains the value of the authentication token as expected by Gitlab. Required for importing resource to the catalog, launching software templates and more. Defaults to 'GITLAB_TOKEN', empty for not available. + default: gitlab-host + type: string + host: + description: The name of the host for the gitlab instance used. Required for launching software templates. Defaults to 'GITLAB_HOST', empty for not available. + default: gitlab-host + type: string + type: object k8s: description: Kubernetes specific configuration fields that are injected to the backstage instance to allow the plugin to communicate with the Kubernetes API Server. properties: diff --git a/hack/setup.sh b/hack/setup.sh index c716d4cf..0342a57d 100755 --- a/hack/setup.sh +++ b/hack/setup.sh @@ -109,6 +109,16 @@ function captureGitToken { fi } +function captureGitlabToken { + if [ -z "$GITLAB_TOKEN" ]; then + read -s -p "Enter Gitlab user access token: " value + echo "" + GITLAB_TOKEN=$value + else + echo "Gitlab access token already set." + fi +} + function captureGitClientId { if [ -z "$GITHUB_CLIENT_ID" ]; then read -s -p "Enter GitHub client ID (empty for disabling it): " value @@ -256,6 +266,9 @@ function createBackstageSecret { if [ -n "$GITHUB_TOKEN" ]; then secretKeys[GITHUB_TOKEN]=$GITHUB_TOKEN fi + if [ -n "$GITLAB_TOKEN" ]; then + secretKeys[GITLAB_TOKEN]=$GITLAB_TOKEN + fi if [ -n "$GITHUB_CLIENT_ID" ]; then secretKeys[GITHUB_CLIENT_ID]=$GITHUB_CLIENT_ID fi diff --git a/helm-charts/orchestrator/templates/rhdh-operator.yaml b/helm-charts/orchestrator/templates/rhdh-operator.yaml index 05960009..46083713 100644 --- a/helm-charts/orchestrator/templates/rhdh-operator.yaml +++ b/helm-charts/orchestrator/templates/rhdh-operator.yaml @@ -277,6 +277,14 @@ data: github: - host: github.com token: {{ printf "${%s}" .Values.rhdhOperator.secretRef.github.token }} + {{- end }} + {{- if and .Values.rhdhOperator.secretRef.gitlab.token (dig "data" .Values.rhdhOperator.secretRef.gitlab.token "" $secret) }} + gitlab: + - host: {{ printf "${%s}" .Values.rhdhOperator.secretRef.gitlab.host }} + token: {{ printf "${%s}" .Values.rhdhOperator.secretRef.gitlab.token }} + apiBaseUrl: https://{{ printf "${%s}" .Values.rhdhOperator.secretRef.gitlab.host }}/api/v4 + {{- end }} + {{- if and .Values.rhdhOperator.secretRef.github.token (dig "data" .Values.rhdhOperator.secretRef.github.token "" $secret) }} auth: environment: development {{- end }}