Skipping commits using [CI SKIP] no longer works

Hi!

I’m testing using drone 0.8.0, as documented here: https://0-8-0.docs.drone.io/hooks/#skip-commits

I have a commit marked [CI SKIP], yet it still triggers a PR build. See: https://github.com/rchain/buildenv/pull/4

Am I doings sth wrong? Or did the feature stop working?
Is there a workaround?

Thanks!
Artur

Any hints? Should I open an issue for that?

hmmm, I am unable to reproduce any issues with [CI SKIP] (I am using 1.0 but 0.8 has been largely frozen from changes for around 6 months). I see the following in my server logs when I include the skip directive in the commit message:

{
  "commit": "803d3d8fb13a149b022c61e7f7b4b1300dd48dd5",
  "event": "push",
  "level": "info",
  "msg": "trigger: skipping hook. found skip directive",
  "ref": "refs/heads/master",
  "repo": "bradrydzewski/drone-test-go",
  "time": "2018-12-31T07:54:13-08:00"
}

edit: I also tested for a pull request and was unable to reproduce the problem:

{
  "commit": "dbd4b1f7031d53fb15c75979c0addfde6addb004",
  "event": "pull_request",
  "level": "info",
  "msg": "trigger: skipping hook. found skip directive",
  "ref": "refs/pull/4/head",
  "repo": "bradrydzewski/drone-test-go",
  "time": "2018-12-31T09:00:46-08:00"
}

Apparently for pull request events, Drone looks at the PR title, not the commit message, for the presence of [ci skip].

Not sure if this is intended (the old docs only talk about commit messages), but this would explain the behavior @ArturGajowy was seeing.

Apparently for pull request events, Drone looks at the PR title, not the commit message

It uses both. You can see the relevant code here: https://github.com/drone/drone/blob/master/trigger/skip.go#L40:L62

I have tested this and am unable to reproduce issues, however, I would be happy to accept a pull request that improves the implementation as needed.

I was able to reproduce this on PRs. It looks like Drone stores the PR body message in builds.build_message, not the commit message. Sometimes on quick PRs these might be the same, but it is not always the case. This is on 1.2.3. I’ll try to work on a fix when I have some time

1 Like

For GitHub the problem seems to be here: https://github.com/drone/drone/blob/master/service/hook/parser/parse.go#L253

v.PullRequest.Body is indeed the body message of the PR. For this to work on GitHub PR commits, we’d need to pull the commits on that PR, check the latest one, and see if it has a [CI SKIP] in the message. This is a bit above my head at the moment, so I’m just leaving what I found here in case someone wants to pick it up.

2 Likes