jenkinsci / jenkinsci/gitlab-plugin

Checkout step doesn't respect the parameters

Open
#1,128 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
1.4k
Forks
615
Avg merge
4h 32m
Merged PRs (30d)
10

Description

### Version report

Jenkins and plugins versions report:

```
Jenkins 2.277.2
GitLab Plugin 1.5.20
Git Plugin 4.7.1
Git client plugin 3.7.1
(Up to date at the time of writing, only listing the probable culprits)
```

- What Operating System are you using (both controller, and any agents involved in the problem)?

```
Windows (10, and server 2019)
```

### Reproduction steps

Simply put I have this pipeline:
```
pipeline {
agent any
stages {
stage('Checkout') {
steps {
checkout([$class: 'GitSCM', branches: [[name: 'refs/remotes/origin/master']],
extensions: [[$class: 'CloneOption', depth: 10, noTags: true, reference: '', shallow: true],
[$class: 'RelativeTargetDirectory', relativeTargetDir: 'repo'],
[$class: 'LocalBranch', localBranch: 'merge_result'],
[$class: 'CleanBeforeCheckout'], [$class: 'PruneStaleBranch']],
userRemoteConfigs: [[credentialsId: '*****', name: 'origin', refspec: '+refs/heads/master:refs/remotes/origin/master', url: 'git@gitlab.************']]])
}
}
}
}
```

### Results

Expected result:

Checked out merge_result on origin/master both when launched via GitLab plugin and or manually.

Actual result:

When launched manually I have checked out local branch merge_result on origin/master.
But when launched via GitLab plugin (via a comment on MR) no matter what is in checkout() params the local merge_result is on origin/$gitlabSourceBranch.

I couldn't find the described behavior in either GitLab plugin or Git plugin documentation (thus reporting it as bug) neither is this behavior desired for us.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.