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.
Information noteNote: The example is adapted for Unix environments. If you are using Windows,
replace sh with bat in the
example.