Hi , I am using Jenkins ver. 2.176.2 <https://jenkins.io/> and deployed in EC2 (Ubuntu) . I am using multi branch pipeline . The jenkins file is as below . While I am creating a new branch or tag I was expecting to start a build. But it is not happening .
What I want that in creation of tags or branch (even if no change in tags/branch) , there need to be a build triggered automatically . Pls help In creation of new tag - it is showing below and no build is triggering No changes in any of the builds, or multiple SCMs in use. In creation of new branch - it is showing below and build is falling > git fetch --no-tags --progress > g...@gitlab.com:tcscmiiag/nextgenordermgmt/frameworkcode.git > +refs/heads/*:refs/remotes/origin/* Checking out Revision fc72acd2362cc1dd00d4b1ba0125da7c9e2d3aca (feature_Z_branch) > git config core.sparsecheckout # timeout=10 > git checkout -f fc72acd2362cc1dd00d4b1ba0125da7c9e2d3aca Commit message: "updated jenkins File" First time build. Skipping changelog. #!groovy pipeline { agent none stages { stage("Checkout") { agent any steps { checkout scm } } stage('Maven Install and Code Build') { agent any environment { def GIT_TAG = sh(returnStdout: true, script: 'git log -n 1 --pretty=format:\'%H\'').trim() } steps { sh "mvn clean package -DskipTests --settings settings.xml" } /*agent { docker { image 'maven:3.5.0' } } steps { sh "mvn clean package --settings settings.xml" }*/ } stage('Unit Test') { agent any steps { sh "mvn test --settings settings.xml" } } stage('Docker Build') { agent any steps { sh 'docker build --build-arg jarfile=framework-0.0.1-SNAPSHOT.jar ' + '-t registry.gitlab.com/tcscmiiag/nextgenordermgmt/frameworkcode'+":$BUILD_NUMBER"+' --pull=true --file=Dockerfile .' sh 'sh clear-dangling-builds.sh' } } stage('Automated Integration Test') { agent any steps { echo 'Ship to Integration test Env' echo 'Deploy the docker here ' echo 'Run Integration test suite' input message: 'Finished Integration Test ? (Click "Proceed" to continue)' echo 'Stop docker in the integration env #################' } } stage('Publish Docker image On Tag') { agent any when { buildingTag() } steps { withCredentials([usernamePassword(credentialsId: 'gitlabRepo', passwordVariable: 'dockerRepoPassword', usernameVariable: 'dockerRepoUser')]) { sh "docker tag registry.gitlab.com/tcscmiiag/nextgenordermgmt/frameworkcode:$BUILD_NUMBER registry.gitlab.com/tcscmiiag/nextgenordermgmt/frameworkcode:$GIT_TAG" sh "docker login registry.gitlab.com -u $dockerRepoUser -p $dockerRepoPassword" sh "docker push registry.gitlab.com/tcscmiiag/nextgenordermgmt/frameworkcode:$GIT_TAG" } } } stage('Deploy in Dev Environment') { agent any steps { input message: 'You want to deploy in which env (dev) ? (Click "Proceed" to continue)' echo 'Checkout docker from registry' echo 'Connect to the desired environment' echo 'Deploy here .. probaly use some plugin to deploy in the container or container orchestration' } } stage('Deploy in CIT/E2E/Prod Environment') { agent any when { buildingTag() } steps { script { // Show the select input modal def INPUT_PARAMS = input message: 'Please Provide Parameters', ok: 'Next', parameters: [ choice(name: 'ENVIRONMENT', choices: ['CIT','E2E','PROD','NONE'].join('\n'), description: 'Please select the Environment'), string(defaultValue: "NONE", description: 'What is the tag id?', name: 'TAG_ID')] env.ENVIRONMENT = INPUT_PARAMS.ENVIRONMENT env.TAG_ID = INPUT_PARAMS.TAG_ID } input message: 'You want to deploy in $env.ENVIRONMENT for commit-id $env.TAG_ID ? (Click "Proceed" to continue)' echo 'Checkout docker from registry' echo 'Connect to the desired environment' echo 'Deploy here .. probaly use some plugin to deploy in the container or container orchestration' } } } } -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4c17a4c7-6244-49b0-b2ea-59a926247b10%40googlegroups.com.