GitLab#
| Description | GitLab application integrates Nokia EDA with GitLab issues and pipeline runs. |
| Author | Nokia |
| Catalog | nokia-eda/catalog |
| Language | Go |
Overview#
The GitLab application enables Nokia EDA to integrate with GitLab to support the following scenarios:
- Create GitLab issues or run GitLab pipelines based on the triggering events from EDA (alarms or queries).
- Create GitLab issues or run GitLab pipelines using the workflow definition resources provided by the application.
The app provides these resource groups:
GitlabInstanceandClusterGitlabInstance: define how to connect to GitLabGitlabIssueandClusterGitlabIssue: create and optionally close GitLab issues based on alarms or query eventsGitlabPipelineandClusterGitlabPipeline: trigger GitLab pipelines based on alarms or query eventsCreateGitlabIssueandRunGitlabPipeline: run-to-completion workflow resources
Installation#
You can install the GitLab app via EDA Store or by running an AppInstaller workflow with kubectl or edactl:
Configuration Notes#
The current deployment template does not expose install-time appSettings.
The following controls the deployment in the EDA base namespace:
- proxy environment variables are read from the fixed ConfigMap name
proxy-config - container limits are fixed at
1CPU and1Gimemory
The default requests are fixed at
500mCPU and500Mimemory.
Getting Started#
Create a GitLab instance first, then reference it from the GitlabIssue or GitlabPipeline resources.
Namespace rules:
GitlabInstance,GitlabIssue, andGitlabPipelineare namespace-scoped and are typically created in a user namespace such asedaClusterGitlabInstance,ClusterGitlabIssue, andClusterGitlabPipelineare namespaced CRs, but are intended for use from the EDA base namespace
GitLab Instances#
A GitLab instance defines the target API endpoint and authentication token.
Notable specification fields:
apiBaseURL: optional base URL. If omitted, the runtime defaults tohttps://gitlab.comauthSecretRef.name: Secret name containing credentials (Personal Access Token)authSecretRef.key: validated by the API and typically set totoken
Credential behavior:
- the runtime reads
data.tokenfrom the referenced Secret - it also accepts
usernameandpassword, but PAT-based authentication is the most common authentication method - the same Secret may also contain
tls.crt,tls.key, and optionalca.crtfor TLS client configuration - for self-managed GitLab, set
apiBaseURLto your GitLab API base URL
The resource status contains the fields related to the connectivity parameters of this instance:
connected: indicates if the instance is connected to GitLaberror: contains the error message if the instance is not connectedlastChecked: the last time the instance was checked
apiVersion: v1
kind: Secret
metadata:
name: gitlab-secret
namespace: eda
type: Opaque
stringData:
token: glpat-exampleTokenValue
---
apiVersion: gitlab.eda.nokia.com/v1alpha1
kind: GitlabInstance
metadata:
name: gitlab-server
namespace: eda
spec:
apiBaseURL: https://gitlab.example.com
authSecretRef:
name: gitlab-secret
key: token
cat << 'EOF' | kubectl apply -f -
apiVersion: v1
kind: Secret
metadata:
name: gitlab-secret
namespace: eda
type: Opaque
stringData:
token: glpat-exampleTokenValue
---
apiVersion: gitlab.eda.nokia.com/v1alpha1
kind: GitlabInstance
metadata:
name: gitlab-server
namespace: eda
spec:
apiBaseURL: https://gitlab.example.com
authSecretRef:
name: gitlab-secret
key: token
EOF
GitLab Issues#
Use GitlabIssue or ClusterGitlabIssue to create issues in GitLab when an alarm or query event occurs.
Notable specification fields:
trigger.alarm: create a GitLab issue when the matching alarm types occurtrigger.query: create a GitLab issue when the matching query updates occurrepo: GitLab project path, typically ingroup/projectforminstance: referenced instance resourcecloseOnResolve: close the GitLab issue when the alarm clears or the query object disappearsissue.titleandissue.body: Go templates rendered with the triggering event dataissue.assignees,issue.labels,issue.milestone: optional GitLab issue metadata
Behavior notes:
- the runtime resolves assignees by GitLab username
- the app searches for an existing open issue by rendered title and appends a hash of the source path to keep one issue per source object
- if an issue already exists, the app adds a note instead of opening a duplicate
- current validation requires at least one assignee
Duplicate Issue Handling#
The app does not use the rendered issue title by itself as the unique key.
For each triggering alarm or query event, the app:
- renders
spec.issue.title - computes a hash from the triggering object path in EDA state
- builds the final GitLab issue title as
<rendered title> -- <hash>
This means duplicate-looking issue titles are handled as follows:
- if the same source object triggers again, the hash is the same, so the app finds the existing open issue and adds a note instead of creating another issue
- if two different source objects render the same title text, their source paths are different, so the hashes differ and the app creates separate issues
- if
closeOnResolveis enabled, the app looks up the same hashed title and closes that matching issue when the source alarm clears or the query object disappears
In practice, the visible title in GitLab is intentionally suffixed with a hash so the app can safely distinguish repeated events from different objects even when the human-readable part of the title is identical.
apiVersion: gitlab.eda.nokia.com/v1alpha1
kind: GitlabIssue
metadata:
name: influxdb-connection-issue
namespace: eda
spec:
trigger:
alarm:
include:
- InfluxDBServerConnectionFailed
repo: network-operations/eda-automation
instance: gitlab-server
closeOnResolve: true
issue:
title: "[ALERT] InfluxDB server connection failed"
body: |
Probable cause: {{ index . "probableCause" }}
Last changed: {{ index . "lastChanged" }}
Details: {{ index . "description" }}
assignees:
- network-ops
milestone: Rel-25.10
labels:
- eda
- alarm
cat << 'EOF' | kubectl apply -f -
apiVersion: gitlab.eda.nokia.com/v1alpha1
kind: GitlabIssue
metadata:
name: influxdb-connection-issue
namespace: eda
spec:
trigger:
alarm:
include:
- InfluxDBServerConnectionFailed
repo: network-operations/eda-automation
instance: gitlab-server
closeOnResolve: true
issue:
title: "[ALERT] InfluxDB server connection failed"
body: |
Probable cause: {{ index . "probableCause" }}
Last changed: {{ index . "lastChanged" }}
Details: {{ index . "description" }}
assignees:
- network-ops
milestone: Rel-25.10
labels:
- eda
- alarm
EOF
GitLab Pipelines#
Use GitlabPipeline or ClusterGitlabPipeline to trigger a GitLab pipeline when an alarm or query event occurs.
Notable specification fields:
trigger.alarmortrigger.query: trigger a GitLab pipeline when the matching alarm types or query updates occurrepo: GitLab project path, typically ingroup/projectformref: branch, tag, or commit referenceinstance: referenced instance resourceparameters[]: pipeline variables
Parameters can be:
- static with
value.staticValue - dynamic with
value.dynamicValue, which fetches a field from EDA using thepath,field, and optionalwhereconditions
apiVersion: gitlab.eda.nokia.com/v1alpha1
kind: GitlabPipeline
metadata:
name: interface-admin-down
namespace: eda
spec:
trigger:
query:
path: .namespace.node.srl.interface
fields: []
where: .namespace.node.name = "leaf-1" and name = "ethernet-1/9" and admin-state = "disable"
repo: network-operations/eda-automation
pipeline: ci.yml
ref: main
instance: gitlab-server
parameters:
- name: trigger_source
value:
staticValue: EDA
- name: interface_name
value:
dynamicValue:
path: .namespace.node{.name=="leaf-1"}.srl.interface
field: name
where: name = "ethernet-1/9" and admin-state = "disable"
- name: interface_index
value:
dynamicValue:
path: .namespace.node{.name=="leaf-1"}.srl.interface
field: ifindex
where: name = "ethernet-1/9" and admin-state = "disable"
cat << 'EOF' | kubectl apply -f -
apiVersion: gitlab.eda.nokia.com/v1alpha1
kind: GitlabPipeline
metadata:
name: interface-admin-down
namespace: eda
spec:
trigger:
query:
path: .namespace.node.srl.interface
fields: []
where: .namespace.node.name = "leaf-1" and name = "ethernet-1/9" and admin-state = "disable"
repo: network-operations/eda-automation
pipeline: ci.yml
ref: main
instance: gitlab-server
parameters:
- name: trigger_source
value:
staticValue: EDA
- name: interface_name
value:
dynamicValue:
path: .namespace.node{.name=="leaf-1"}.srl.interface
field: name
where: name = "ethernet-1/9" and admin-state = "disable"
- name: interface_index
value:
dynamicValue:
path: .namespace.node{.name=="leaf-1"}.srl.interface
field: ifindex
where: name = "ethernet-1/9" and admin-state = "disable"
EOF
Cluster-Scoped Resources#
Use the cluster variants from the EDA base namespace when you want centralized automation across namespaces.
Cluster-specific behavior:
ClusterGitlabIssueandClusterGitlabPipelinecan watch alarms across namespaces throughtrigger.alarm.namespaces- query triggers can use fully qualified
.namespacepaths - cluster resources must reference
ClusterGitlabInstance
Workflow Resources#
The app also installs two workflow definition resources:
CreateGitlabIssueRunGitlabPipeline
These workflows are run-to-completion programs that do not watch alarms or queries continuously; instead, they submit a single GitLab operation (issue or pipeline run) when the workflow is run.
Current behavior
- although the workflow specification contains both
instanceandclusterInstance, the current version only supportsinstance(notclusterInstance) - use a regular
GitlabInstancefor these workflow resources
apiVersion: gitlab.eda.nokia.com/v1alpha1
kind: CreateGitlabIssue
metadata:
name: create-gitlab-issue-now
namespace: eda
spec:
instance: gitlab-server
repo: network-operations/eda-automation
issue:
title: "Manual issue from EDA workflow"
body: |
This issue was created by the GitLab app workflow resource.
assignees:
- network-ops
labels:
- eda
- workflow
cat << 'EOF' | kubectl apply -f -
apiVersion: gitlab.eda.nokia.com/v1alpha1
kind: CreateGitlabIssue
metadata:
name: create-gitlab-issue-now
namespace: eda
spec:
instance: gitlab-server
repo: network-operations/eda-automation
issue:
title: "Manual issue from EDA workflow"
body: |
This issue was created by the GitLab app workflow resource.
assignees:
- network-ops
labels:
- eda
- workflow
EOF
apiVersion: gitlab.eda.nokia.com/v1alpha1
kind: RunGitlabPipeline
metadata:
name: run-gitlab-pipeline-now
namespace: eda
spec:
instance: gitlab-server
repo: network-operations/eda-automation
pipeline: ci.yml
ref: main
parameters:
- name: trigger_source
value:
staticValue: EDA
- name: requested_by
value:
staticValue: workflow-cr
cat << 'EOF' | kubectl apply -f -
apiVersion: gitlab.eda.nokia.com/v1alpha1
kind: RunGitlabPipeline
metadata:
name: run-gitlab-pipeline-now
namespace: eda
spec:
instance: gitlab-server
repo: network-operations/eda-automation
pipeline: ci.yml
ref: main
parameters:
- name: trigger_source
value:
staticValue: EDA
- name: requested_by
value:
staticValue: workflow-cr
EOF
Validation Notes#
When creating resources, follow these rules:
- instances require both
authSecretRef.nameandauthSecretRef.key - issues require
repo,instance,issue.title,issue.body, at least one assignee, and either an alarm or query trigger - issue title and body templates must be valid Go templates
- pipelines require
repo,pipeline,ref,instance, and either an alarm or query trigger - dynamic pipeline parameters must set at least one of
fieldorpath