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

Use LocalBranch class to avoid the default detached HEAD status #107

Closed orviz closed 3 years ago

orviz commented 3 years ago

By default, checkout scm leaves the repo status in a detached HEAD. This behaviour can lead to errors when the pipeline execution implies updating (modifying & pushing) files in the current branch (that triggered the build). This PR changes the default behaviour in JePL so a local branch with the same name as the remote is used.

As an example of this requirement, the sqaaas-api-spec updates the build/dist.yaml (in-one-file OpenAPI spec) whenever the specification changes, for any given branch.

I've created the PR for the release/2.1.0, but I am happy to change this for a future release.

orviz commented 3 years ago

+1 need to find out what is the most common (or less invasive) use case in order to set it as the default behavour