Skip to content

Commit

Permalink
adding gitlab support
Browse files Browse the repository at this point in the history
  • Loading branch information
ElaiShalevRH committed Nov 18, 2024
1 parent 763ac46 commit 6747f35
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
22 changes: 21 additions & 1 deletion bundle/manifests/rhdh.redhat.com_orchestrators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.cee.redhat.com
description: The name of the host for the gitlab instance used.
Required for launching software templates.
Defaults to 'gitlab.cee.redhat.com', empty for not available.
type: string
k8s:
description: Kubernetes specific configuration fields that
are injected to the backstage instance to allow the plugin
Expand All @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions config/crd/bases/rhdh.redhat.com_orchestrators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,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_TOKEN
type: string
host:
description: The name of the host for the gitlab instance used. Required for launching software templates. Defaults to 'gitlab.cee.redhat.com', empty for not available.
default: gitlab.cee.redhat.com
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:
Expand Down
13 changes: 13 additions & 0 deletions hack/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions helm-charts/orchestrator/templates/rhdh-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down

0 comments on commit 6747f35

Please sign in to comment.