gvalkov / jenkins-autojobs

Automatically create Jenkins jobs from template jobs and branches in a SCM repository
http://jenkins-autojobs.rtfd.org
Other
49 stars 39 forks source link

git script: correct erased branch substitution #51

Closed quetzai closed 6 years ago

quetzai commented 8 years ago

During the extraction of a job configuration, the substitution of variables is done before git script starts looking for existing branches in the git repo. If the template has already a branch or a commit specified, it is automatically erased without checking.

This commit checks if such a treeish exists and avoid erasing it.

gvalkov commented 8 years ago

Hi and thanks for looking into this. Accepting this PR would break the expectations of everyone who assumes the old behavior (i.e. always update the branchSpec/name).

I can think of two alternative solutions:

  1. Add an ignore-jobs config key, which would list job names that jenkins-autojobs should not touch.
  2. Make jenkins-autojobs ignore jobs with (jenkins-autojobs-ignore) in their description.

These have the added benefit of working for all SCM plugins.

quetzai commented 8 years ago

Hi,

I'm not sure this new commit is what you had in mind. Since I'm far from an expert in svn and mercurial, I didn't touch these (not sure this feature would be usefull for svn).

Regards