Using Maven Connector in Tekton Task
Using Maven Connector in Tekton Tasks enables centralized management of tool integration information and secure access to Maven registry during Tekton Task execution.
This document shows how to use the multi-connector capability in one TaskRun to:
- pull dependencies from a mirror Maven repository
- publish build artifacts to a private Maven repository
Requirements for Tekton Task
Not all Tekton Tasks can use Maven Connector.
Maven Connector injects temporary Maven credentials through the Connectors CSI Driver. It provides a configuration named settings that generates a settings.xml file with temporary authentication and a ca.cert file to trust the connector proxy server.
Therefore, Tekton Tasks must meet the following requirements to use Maven Connector:
Support mounting a settings.xml and ca.cert file via Workspace
Multi-Connector Scenario
To pull dependencies from a mirror and deploy to a private repository in the same TaskRun, prepare two Maven connectors:
maven-mirror-connector: configured withuseAsMirror=truefor dependency resolutionmaven-deploy-connector: configured for deployment target repository
Then mount both connectors in one workspace using volumeAttributes.connectors.
Usage Instructions
After confirming that your Tekton Task can use Maven Connector, add both connectors to the TaskRun YAML.
For example:
In this example:
maven-mirror-connectoris used for pulling dependencies from the configured mirror.maven-deploy-connectoris used whenmvn deployuploads artifacts to the private repository.settings.xmlandca.certare mounted from the samesettingsconfiguration.
For workspaces parameters, please refer to:
For more information about Connectors CSI Driver, please refer to Connectors CSI Configuration.
Further Reading
- Using Maven Connectors as Distribution Management Repository
- Using Maven Connectors as Maven Registry Mirror