Uploaded image for project: 'Infrastructure'
  1. Infrastructure
  2. INFRA-2875

Sync Jenkins job with Jenkinsfile in SCM without having to trigger it?

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: github
    • Labels:
      None
    • Similar Issues:

      Description

      As described in https://stackoverflow.com/questions/44422691/how-to-force-jenkins-to-reload-a-jenkinsfile

      My pipeline is created with the define in SCM way.

      After I made some change(Say I added an extra parameter) to the pipeline script I push my code to SCM, in my case github.

      I want my pipeline to be sync with my github source so I always get the up to date pipeline to run. It can't be achieved now because it has to be triggered once to get the pipeline updated.

       

      This also applies to the multiple branch jobs. Say I created a job that listens to my repo's event. A new job is automatically generated after a new tag is created. However, the first time the pipeline has no parameters whereas they are defined in my Jenkinsfile.

       

      Expectation:

      Can we have the Jenkins job always sync with the source code in SCM without having to trigger/build it?

        Attachments

          Activity

          Hide
          unclerayray Roger Lei added a comment - - edited

          I'd love to contribute to any possible code change required. If there's any document on how the SCM jenkins pipeline works under the hood to sync changes.

          Show
          unclerayray Roger Lei added a comment - - edited I'd love to contribute to any possible code change required. If there's any document on how the SCM jenkins pipeline works under the hood to sync changes.
          Hide
          olblak Olivier Vernin added a comment -

          Hi Roger Lei, the problem you are experiencing is the problem of the egg and chicken, similar issues have already been open

          https://issues.jenkins.io/browse/JENKINS-41929
          https://issues.jenkins.io/browse/JENKINS-34876

          Show
          olblak Olivier Vernin added a comment - Hi Roger Lei , the problem you are experiencing is the problem of the egg and chicken, similar issues have already been open https://issues.jenkins.io/browse/JENKINS-41929 https://issues.jenkins.io/browse/JENKINS-34876
          Hide
          unclerayray Roger Lei added a comment -

          Hi Olivier Vernin, thanks for your reply! I understand this checken and egg problem is caused by order of the current flow where the git fetch opration is triggered after a build is submitted.

          1. User clicks the "Build"/"Build with parameter" button
          2. User fills in the parameters of the job and click the "Build" button to submit a job (omitted if its first build)
          3. A git fetch operation is fired
          4. The build is running with the fetched pipeline

          Can we do anything in the Jenkins core to update the order of this flow by switch the 2nd and 3rd step. We can ensure the parameter input page is always up to date?

          It would be working like this

          1. The "Build"/"Build with parameter" button is clicked
          2. A git fetch is triggered
          3. The pipeline is updated
            1. If it's the first build, display the parameters if there is any
            2. If it's not the first build and there's update to the pipeline comparing to the last one, load the updated parameter input page
            3. Else, load the parameter input page as usual
          4. The build is running with the fetched pipeline and with the up to date parameters
          Show
          unclerayray Roger Lei added a comment - Hi Olivier Vernin , thanks for your reply! I understand this checken and egg problem is caused by order of the current flow where the git fetch opration is triggered after a build is submitted. User clicks the "Build"/"Build with parameter" button User fills in the parameters of the job and click the "Build" button to submit a job (omitted if its first build) A git fetch operation is fired The build is running with the fetched pipeline Can we do anything in the Jenkins core to update the order of this flow by switch the 2nd and 3rd step. We can ensure the parameter input page is always up to date? It would be working like this The "Build"/"Build with parameter" button is clicked A git fetch is triggered The pipeline is updated If it's the first build, display the parameters if there is any If it's not the first build and there's update to the pipeline comparing to the last one, load the updated parameter input page Else, load the parameter input page as usual The build is running with the fetched pipeline and with the up to date parameters

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            unclerayray Roger Lei
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: