jenkinsci / jenkinsci/gitlab-plugin

Multibranch Pipeline Jobs ignores ciSkip

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

Description

## Issue
Multibranch Pipelines ignore the ciSkip field and trigger themselves if they push changes back to GitLab

### Context
- **Gitlab plugin version**: 1.4.4
- **Gitlab version**: 8.16.3 d225908
- **Jenkins version**: 2.32.1
- **Job type**: Multibranch Pipeline

### Logs & Traces

```groovy
// ... in preparation stage
def gitLabTrigger = [
$class: "GitLabPushTrigger",
triggerOnPush: true,
triggerOnMergeRequest: true,
acceptMergeRequestOnSuccess: true,
branchFilterType: "All",
ciSkip: true, // this is the relevant bit
triggerOpenMergeRequestOnPush: "both",
mergeRequestLabelFilterConfig: [
$class: "com.dabsquared.gitlabjenkins.trigger.filter.MergeRequestLabelFilterConfig",
include: "master, develop",
exclude: ""
]
]
// ... more triggers combined in a list "pipelineTriggerCollection"
properties([
pipelineTriggers(pipelineTriggerCollection),
[$class: 'GitLabConnectionProperty', gitLabConnection: 'GitLab']
])
```
```bash
# in later stage execute this shellscript
git add .
git commit -m "version of ${JOB_NAME} changed to ${MAJOR_VERSION_NUMBER}.${BUILD_NUMBER} by jenkins [ci-skip]" # this commit should not be built because of [ci-skip]
git config credential.username ${GIT_USERNAME}
export tempFile="$(mktemp)"
echo "${GIT_PASSWORD}" > ${tempFile}
git config credential.helper '!f() { echo "password=`cat ${tempFile}`"; }; f' # this somehow fails with just echo ${GIT_PASSWORD}
git pull origin ${GIT_BRANCH#*/}
git push origin ${GIT_BRANCH#*/}
rm -f "${tempFile}"
unset tempFile
git config --unset credential.username
git config --unset credential.helper
```

### Problem description
After the `git push` instruction a new Build is triggered which should be ignored because of the `[ci-skip]` bit in the commit message yet it's executed like it weren't there.

------
### Possible other problem
A (possibly completely unrelated) Problem is that the jenkins.log is filled with this sort of stuff:
```
INFO: Retrieving gitlab project ids
Feb 01, 2017 1:28:13 PM com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
INFO: Retrieving the gitlab project id from remote url http://MY-GITLAB/GROUP/PROJECT.git
```
that is probably because i use `gitlabCommitStatus` over my entire `node` block and have a custom `stage` block that wraps `updateGitlabCommitStatus` around the code

```groovy
def call(stageName, Closure bodyParam) {
bodyParam.resolveStrategy = Closure.OWNER_ONLY
stage(stageName) {
try {
updateGitlabCommitStatus state: 'running', name: stageName
bodyParam()
updateGitlabCommitStatus state: 'success', name: stageName
} catch (e) {
updateGitlabCommitStatus state: 'failed', name: stageName
throw e
}
}
}
```

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.