indigo-dc / jenkins-pipeline-library

Jenkins pipeline library with common functionalities for CI/CD environments, mainly targeted for the implementation of the SQA baseline requirements from https://indigo-dc.github.io/sqa-baseline/
Apache License 2.0
11 stars 6 forks source link

Unexpected(?) behaviour when defining repo branch as an empty string #178

Open orviz opened 2 years ago

orviz commented 2 years ago

Just noticed the following behaviour in JePL-2.1.1 (probably related to scm step). If I set repo's branch as an empty string:

config:
  project_repos:
    github.com/jupyter/nbgrader:
      repo: https://github.com/jupyter/nbgrader
      branch: ''     

the pipeline gets an origin/0.4.x branch, which surprisingly (at least for me) is not the default branch set for this repo (it is origin/master).

However, the default branch (origin/master) is indeed used when the property is removed, such as:

config:
  project_repos:
    github.com/jupyter/nbgrader:
      repo: https://github.com/jupyter/nbgrader
orviz commented 2 years ago

Update on this: found a repo where an error happens also in the case that branch is not defined. In config.yml:

  project_repos:
    github.com/lisc-tools/lisc:
      repo: https://github.com/lisc-tools/lisc

The exception message:

hudson.AbortException: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
    at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1157)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1303)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:97)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:84)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)