Using GitLab Connector in Tekton Tasks enables centralized management of GitLab credentials and secure access to GitLab repositories during Tekton Task execution.
Not all Tekton Tasks can use GitLab Connector.
GitLab Connector injects temporary credentials through a CSI Driver. It provides configurations that generate configuration files with temporary authentication and URL rewriting settings:
.gitconfig file for Git CLI operationsconfig.yml file for GitLab CLI (glab) operationsExample of generated .gitconfig:
Example of generated config.yml:
Therefore, Tekton Tasks must meet the following requirements to use GitLab Connector:
For Git CLI operations:
.gitconfig file via WorkspaceFor GitLab CLI (glab) operations:
config.yml file via Workspace.gitconfig file via Workspace (required when using glab to clone repositories or interact with repository directories)When using Git CLI in Tekton Tasks, mount the gitconfig configuration:
Parameter descriptions:
name: The Workspace name defined in the Taskcsi:
driver: Fixed value connectors-csireadOnly: Fixed value truevolumeAttributes: CSI Volume attributes
connector.name: Name of the GitLab Connectorconnector.namespace: (Optional) Namespace of the GitLab Connector; if not specified, uses the TaskRun's namespaceconfiguration.names: Configuration name (gitconfig for Git CLI operations)When using GitLab CLI (glab) in Tekton Tasks, mount both gitlabconfig and gitconfig:
The Task should:
Copy configuration files to the appropriate locations:
.gitconfig → ~/.gitconfigconfig.yml → ~/.config/glab-cli/config.ymlSet correct file permissions:
~/.gitconfig → 644~/.config/glab-cli/config.yml → 600When using custom CLI tools (like reviewdog) with GitLab Connector, you can use the built-in configuration files to access the GitLab API through the proxy service.
For more details, see: Connectors CSI Built-in Configurations
or refer to Using Reviewdog with GitLab Connector for more details.