[JENKINS-75902] Always save a timestamp of the latest GitLab project configurations into the config, signalling this plugin has done some work#1
Conversation
…e fetching initial repo info
…e config, signalling this plugin has done some work
|
do you want to point this branch onto the jenkinsci project or merge it into your existing PR? 😅 |
4f61541 to
b4406c1
Compare
Hello @jetersen! This PR was an initial experimentation that should be merged only after jenkinsci#495 was merged. Can you please take a look at that, by the way? 🙂 I will be moving this to target the jenkinsci project shortly. |
I am not sure I follow the issue with
This also sounds suspicious. Running |
Hello @jglick, thanks for your input! If I recall correctly, this plugin does modify the This I was very wary of changing that behaviour, as I am not aware of its side-effects. Do you think a better fix should be to address that instead? How? |
|
It is hard to follow the history without being very familiar with this plugin, but it looks like jenkinsci#53 may have been the first time that Again, I am not very familiar with |
This change continues the work done in jenkinsci#495.
We found that this plugins'
GitLabSCMSource#retrieve()methods are called when the job-dsl-plugin'sjobDsl()method is called.If at those points the code in this plugin fails to communicate with GitLab, the
config.xmlfile corresponding to the pipeline being parsed is saved without any information that would come from this project's GitLab project (i.e.:sshRemote,httpRemote,projectIdwill not exist). The contents of that file will be the same as if this plugin hadn't executed.When the
jobDsl()method is called again at a later time, it compares the savedconfig.xmlto theconfig.xmlit expects to save at that point. See https://github.com/jenkinsci/job-dsl-plugin/blob/master/job-dsl-plugin/src/main/java/javaposse/jobdsl/plugin/JenkinsJobManagement.java#L453.Note that at that point, the new expected
config.xmlthat the job-dsl-plugin uses for that diff does not have any information that should come from the gitlab-branch-source-plugin.As such, at that point both the base
config.xmlas well as the expected-to-saveconfig.xmlare equal.This change adds a new field to the pipeline's configuration,
lastRetrieveTimestamp, that is updated at every attempt to update it, regardless of the GitLab communication having succeeded or not. In this way, the attempteddiffby the job-dsl-plugin will always trigger an update and corresponding reattempt at communicating with GitLab, preventing previous failures from avoiding that.Testing done
Similarly to jenkinsci#495, we deployed a patched gitlab-branch-source-plugin with both that and this change into our running Jenkins. We have not seen the issue reoccurring and will keep on observing it in the next weeks. We will notify if we see this wasn't effective.
Submitter checklist