If you know your project artifacts are valid and ready to be published, you might
want to edit the pipeline script provided by Talend to deploy the artifacts of a
project both to an artifact repository (Nexus for example) and to a Docker registry.
Procedure
-
Open the Talend_Pipeline configuration page and go to
the Script editor.
-
To deploy the artifacts , replace the 'Build, Test and Publish
artifacts to artifact repository' and 'Push to a
Docker registry' stages defined in the default script provided
by Talend with the
following unique stage.
Example
stage ('Push to artifact repository and Docker) {
withCredentials([usernamePassword(credentialsId: 'docker', usernameVariable: 'Dusername', passwordVariable: 'Dpassword')]) {
// Docker credentials stored in Jenkins Credentials
withMaven(
maven: 'M3',
mavenSettingsConfig: 'maven-file',
mavenOpts: "-Dlicense.path=${LICENSE} -Dupdatesite.path=${UPDATESITE_URL} -DaltDeploymentRepository=releases::default::http://XXX:8081/repository/XXX/ -Ddocker.push.registry=XXX -Ddocker.push.username=${env.Dusername} -Ddocker.push.password=${env.Dpassword} -Xms1024m -Xmx3096m") {
// Run the maven build
sh "mvn -f $PROJECT_GIT_NAME/poms/pom.xml deploy -Pnexus -Pdocker -e -pl jobs/process${TYPE}/${ARTIFACT}_${VERSION} -am -Dtalend.docker.name=${env.IMAGE_NAME}"
}
}
}
allows you to deploy the filtered artifact to both Nexus and
Docker. You need to specify your own Nexus repository and Docker registry in
which you want to deploy your artifacts. The Docker credentials refer to the
credentials you have previously stored in Jenkins.
Note: The example is adapted for Unix environments. If you are using Windows,
replace sh with bat in the
example.
-
Click Save to take your changes into account.