Using Git Connector in Tekton Task
Using Git Connector in Tekton Tasks enables centralized management of tool integration information and secure access to Git repositories during Tekton Task execution. Currently, Git Connector only supports BasicAuth authentication method and does not support SSH authentication.
Requirements for Tekton Task
Not all Tekton Tasks can use Git Connector.
Git Connector essentially injects temporary Git credentials through a CSI Driver. It provides a configuration named gitconfig that generates a .gitconfig file with temporary authentication and URL rewriting settings.
For example:
Therefore, Tekton Tasks must meet the following requirement to use Git Connector:
Support mounting a .gitconfig file via Workspace, and the Workspace must support providing only the .gitconfig file
Usage Instructions
After confirming that your Tekton Task can use Git Connector, you can add Git Connector configuration to the TaskRun YAML file:
For example:
Parameter descriptions:
name: The Workspace name defined in the Taskcsi:driver: Fixed valueconnectors-csireadOnly: Fixed valuetruevolumeAttributes: CSI Volume attributesconnector.name: Name of the Git Connectorconnector.namespace: Namespace of the Git Connector; if not specified, the TaskRun's namespace is usedconfiguration.names: Configuration name, fixed asgitconfig, which will generate a.gitconfigfile in the$(workspaces.basic-auth.path)directory
For more information, please refer to Connectors CSI Configuration.