Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding gitlab integration to operator #379

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-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
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 @@ -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:
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