node-ci / nci

Flexible, open source continuous integration server written in node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When `withScmChangesOnly` flag is not set doesn't update repo

tailhook opened this issue · comments

I think this flag should only skip build if there are no changes. But it looks like if the withScmChangesOnly is false, nci doesn't even update the repo to find out whether the latter has any changes.

In particular, I have a problem with git webhook, where I can't set withScmChangesOnly flag at all (it's always false). So it always rebuilds old version when webhook is triggered (builds from scheduler are okay, though)

withScmChangesOnly flag doesn't prevent pulling from repository.
nci tries to get new changes and then skip build if only withScmChangesOnly is true and no scm changes.

There should another reason e.g. maybe it's wrong hook and when nci checks for changes they are absent.

Well, I assumed this from this line of code

Also nci-base-webhook just does builds.create, and I clearly see that builds triggered by user do git pull and builds triggered by scheduler too. But not builds from webhook.

Any other pointers? Should I close this one and open an issue in nci-base-webhook?

Scheduler also does only builds.create

I just checked github-webhook:
image
git pull works fine

Okay, here are three builds:

  1. This one is initiated from webhook and is wrong: http://mglawica.org:7000/builds/38 The message package verwalter-render-0.3.4-3-g94dfaba-amd64 is already in repository means we have already built it (you can see the whole log at the link). The version is got from git describe in the build
  2. This one is a subsequent from the scheduler: http://mglawica.org:7000/builds/39 which builds an new version and shows the changelog
  3. This one has been done yesterday, so you can see that it has a revision 94dfaba from error message in build 38 linked above: http://mglawica.org:7000/builds/37

In github logs I see hook with code 200 that initiated the build, webhook request content follows. Headers:

Request URL: http://mglawica.org:7000/webhooks/verwalter/github/xxxx
Request method: POST
content-type: application/json
Expect: 
User-Agent: GitHub-Hookshot/0b0c52f
X-GitHub-Delivery: 34db4680-33bd-11e6-95f2-f0a6c5e21353
X-GitHub-Event: push

Body (partial, note revisions):

{
  "ref": "refs/heads/master",
  "before": "94dfabaf8baf45ad9490dea68c5c403b233b4980",
  "after": "2b8c9557e444ea6dc98b670f1086b9524d93f4cf",
...

The only issue I see at github log is the following "push" event with a tag, which returns error code 406. I assume that it's fine.

Well, there is a git pull in the log, so I'm not sure what the issue here. Maybe it tries to pull too fast? I.e. we need to sleep a little? :) Any ideas how to debug the issue?

@tailhook could you check that with latest nci (1.0.9 currently)?
Some things changed, especially the way nci implements work with git scm.

Yes, it works now. Not sure since what version, but I'm closing it anyway.