Kent Lu
Kent Lu

Reputation: 211

Disable script from git SCM changelog in Jenkins pipeline job

I have a question when I use pipeline with git SCM, currently I push all Jenkinsfile script in git with master branch. But when I modify one Jenkinsfile script when the another pipeline job be trigger will only show the changes, It's very upset when I only when to check build changes.

for example:
I config pipeline with git SCM (git: xxx/jenkinsJob, branch: master, script: a.jenkinsfile)

# a.jenkinsfile
stage('Checkout external proj') {
    steps {
        git branch: 'my_specific_branch',
            credentialsId: 'my_cred_id',
            url: 'ssh://[email protected]/proj/test_proj.git'
    }
}

After I modify b.jenkinsJob in git://xxx/jenkinsJob, when I trigger e A pipeline job, the A job will show two git change for "xxx/jenkinsJob" and "[email protected]/proj/test_proj" like:

# changes
b.jenkinsfile change message 1
b.jenkinsfile change message 2
b.jenkinsfile change message 3
a.jenkinsfile change message 2
..
test_proj change message

I know how to disable changelog in jenkinsfile.

git changelog: false, branch: 'my_specific_branch', url: 'ssh://[email protected]/proj/test_proj.git'

But in jenkins job configuration page, can not find any way to do that..

https://plugins.jenkins.io/git/
https://plugins.jenkins.io/git/

Is there any way to avoid disable changelog in jenkins pipeline script for Git SCM ?, let only show test_proj changes.

thanks!

Upvotes: 1

Views: 612

Answers (1)

Kent Lu
Kent Lu

Reputation: 211

Currently I use this way to clear changeLog, use currentBuild.getChangeSets().clear()

pipeline {
  stages {
    stage('Checkout') {
      steps {       
        script {
          currentBuild.getChangeSets().clear()
        }
        git branch: "master", url: 'ssh://xxx/test.git'            
      }
    }  
  }
}

Upvotes: 0

Related Questions