Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic CI kickoff #82

Closed
jasnell opened this issue Sep 30, 2016 · 29 comments
Closed

Automatic CI kickoff #82

jasnell opened this issue Sep 30, 2016 · 29 comments

Comments

@jasnell
Copy link
Member

jasnell commented Sep 30, 2016

It would be fantastic if the bot could automatically kick off a new CI run based on a request in comments. For instance, if I posted a comment like: @nodejs-github-bot run CI please.

@addaleax
Copy link
Member

How about letting the bot do that when there has not been a previous CI run and the first “approved” review is made? That seems like a reasonably automated way of implementing this to me, but I can’t really tell how tricky that would be.

@phillipj
Copy link
Member

That's not too difficult, as far as I know Jenkins has a decent API for triggering builds. My only concern is the reasoning behind the CERTIFY_SAFE option we have to manually check when starting a PR build:

screen shot 2017-01-30 at 21 08 19

Maybe as long as the approval comes from a collaborator, that is as good as checking the CERTIFY_SAFE option?

@addaleax
Copy link
Member

Maybe as long as the approval comes from a collaborator, that is as good as checking the CERTIFY_SAFE option?

Yeah, that’s what I had in mind. Sorry, forgot for a minute that non-collaborators can approve, too ;)

@jbergstroem
Copy link
Member

The logical next step would be just starting a job if a committer files a pr, no?

@gdams
Copy link
Member

gdams commented Jan 31, 2017

could we not just go down the route of using https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin though? You an admin simply types ok to test and then the CI runs

@gibfahn
Copy link
Member

gibfahn commented Jan 31, 2017

This is something we're looking at for citgm as well. I think what's been suggested so far makes sense, triggering a build when:

  • The person who raised the PR has commit access to the project
  • Someone who has commit access approves the PR.

I think it would probably be worth having a manual trigger again (e.g. for rerunning CI). Maybe something like github-bot run CI as a comment from someone with commit access?

@jbergstroem
Copy link
Member

@gibfahn ..or we could rebuild on any pushes to the branch [again, making the assumption that a committer filed the PR]?

@gibfahn
Copy link
Member

gibfahn commented Jan 31, 2017

@jbergstroem we could definitely do that (I guess as well as the above options rather than instead of?), the only issue would be whether we'd end up doing too many CI runs for branches that are updated frequently.

I guess the other part of this would be for @evanlucas's core-validate-commit module to check whether CI passed (or at least was run). That would help people make sure that CI is run before they merge PRs (assuming people use it).

@gibfahn
Copy link
Member

gibfahn commented Feb 1, 2017

@jbergstroem @phillipj @Fishrock123 So @gdams and I would like to start looking at implementing this for citgm. Is there any Jenkins access we'd need to get this set up?

The plan was to trigger CI runs of this job on new citgm PRs.

@phillipj
Copy link
Member

phillipj commented Feb 2, 2017

Fantastic!

Yes, sounds like we will have to grant the bot access to Jenkins. The only communication between Jenkins and the bot ATM, is when Jenkins sends requests the bot reporting build statuses for PRs. In other words, there is no communication initiated from the bot to Jenkins.

@gdams
Copy link
Member

gdams commented Feb 3, 2017

okay so what's the main steps that we need to follow to set up jenkins to report back to github?

@phillipj
Copy link
Member

phillipj commented Feb 3, 2017

@jbergstroem knowns what is needed for a Jenkins build to report back to the bot

@gdams
Copy link
Member

gdams commented Feb 3, 2017

brilliant thanks

@jbergstroem
Copy link
Member

We basically inject a lot of curl as part of the build steps. It's non optimal and at times I actually don't understand why it doesn't work. My preferred approach would be pinging at start/end but also having a process actually monitoring this to verify its results.

@phillipj
Copy link
Member

phillipj commented Feb 3, 2017

My preferred approach would be pinging at start/end but also having a process actually monitoring this to verify its results.

Pinging as in the bot continuously polling the Jenkins REST API for build updates?

@jbergstroem
Copy link
Member

Yes; once a job starts we have a pretty good idea on how long it will take based on previous jobs.

@phillipj
Copy link
Member

phillipj commented Feb 3, 2017

@jbergstroem would you mind setting up citgm with curl to get that going, and do a separate issue refactoring adding Jenkins pulling as you suggest?

@jbergstroem
Copy link
Member

do i post to the same endpoint? a new?

@gdams
Copy link
Member

gdams commented Feb 22, 2017

@jbergstroem what else needs to be set up to get this working for citgm?

@jbergstroem
Copy link
Member

@phillipj: do you perhaps want to set this up now that you have access?

@phillipj
Copy link
Member

Sure, I'll open a issue over at citgm for further discussions.

@gdams
Copy link
Member

gdams commented Feb 22, 2017

Sgtm

phillipj added a commit to phillipj/github-bot that referenced this issue Apr 14, 2017
This is the initial shot at triggering a Jenkins build when a repository
collaborator mentions the bot in a comment with the following content:

`@nodejs-github run CI`

In addition the bot has to be explicitly configured with $ENV variables
per repo and related Jenkins build for this to be enabled.

At first we'll start with https://github.com/nodejs/citgm which has been
the biggest driver for getting this implemented. If that test run succeeds
we can enable it on other repos as we see fit in collaboration with their
corresponding working group.

Refs nodejs#82
phillipj added a commit to phillipj/github-bot that referenced this issue Apr 14, 2017
This is the initial shot at triggering a Jenkins build when a repository
collaborator mentions the bot in a comment with the following content:

`@nodejs-github run CI`

In addition the bot has to be explicitly configured with $ENV variables
per repo and related Jenkins build for this to be enabled.

At first we'll start with https://github.com/nodejs/citgm which has been
the biggest driver for getting this implemented. If that test run succeeds
we can enable it on other repos as we see fit in collaboration with their
corresponding working group.

Refs nodejs#82
phillipj added a commit to phillipj/github-bot that referenced this issue Apr 14, 2017
This is the initial shot at triggering a Jenkins build when a repository
collaborator mentions the bot in a comment with the following content:

`@nodejs-github-bot run CI`

In addition the bot has to be explicitly configured with $ENV variables
per repo and related Jenkins build for this to be enabled.

At first we'll start with https://github.com/nodejs/citgm which has been
the biggest driver for getting this implemented. If that test run succeeds
we can enable it on other repos as we see fit in collaboration with their
corresponding working group.

Refs nodejs#82
phillipj added a commit that referenced this issue Apr 14, 2017
This is the initial shot at triggering a Jenkins build when a repository
collaborator mentions the bot in a comment with the following content:

`@nodejs-github-bot run CI`

In addition the bot has to be explicitly configured with $ENV variables
per repo and related Jenkins build for this to be enabled.

At first we'll start with https://github.com/nodejs/citgm which has been
the biggest driver for getting this implemented. If that test run succeeds
we can enable it on other repos as we see fit in collaboration with their
corresponding working group.

Refs #82
@phillipj
Copy link
Member

Status update on this: first iteration on this has been deployed and is currently being used by the CITGM crew.

After a test periode on CITGM, and possibly doing some fixes, we can consider enabling this on other repos in collaboration with their governing WG.

@BridgeAR
Copy link
Member

Is there something that can be done to push this forward? I guess the testing period has been long enough? Have there been any issues so far that still have to be addressed?

@jasnell
Copy link
Member Author

jasnell commented Mar 12, 2018

Small refinement on the request here... running CI automatically for all PRs definitely is not ideal. Perhaps a label like ci-ready can be used to flag PRs that should be submitted to CI? If a light CI run is required, then something like ci-lite-ready, and an equivalent citgm-ready for citgm runs, would be a good approach?

@targos
Copy link
Member

targos commented Mar 12, 2018

I would prefer to have to write a comment @-mentioning the bot. It gives more flexibility and allows to easily trigger new runs.

@BridgeAR
Copy link
Member

I think the suggestion from @addaleax is nice but I would like to be a bit more conservative about it. We all can make mistakes and if someone would really want to harm us, it would probably be possible to obfuscate some code good enough to maybe get at least a single LG. We should also not trigger the CI on a update without a new LG.

So maybe we can use a combination of labels and LGs?

As in triggering a build when:

  • The person who raised the PR has commit access to the project
  • Two persons who have commit access approved the PR
  • The code was updated (a rebase, new commit...) and the code got two new approvals from collaborators
  • A author-ready label is applied
  • A ci-ready label is applied (and the label would be removed as soon as the CI run is done)

I guess in this case there would not be to many CI runs even though we will have some obsolete runs. To reduce the overhead on our machines it would be great if the bot stops all still running CIs in case a new one is started.

I think the bot is capable of detecting a CI-Lite and a regular CI well enough by just checking if only doc changes were applied or anything else. There might be a few false-positives but I think auto detecting this is still best.

I am also definitely +1 on having a label to start the CITGM.

@bnoordhuis
Copy link
Member

^ feels overly conservative. If you have push access, you're implicitly trusted anyway.

I'd be good with kicking off CI right away rather than after first review. If the CI is angry red, you know you can hold off on reviewing because the author has some fixing up to do.

@Trott
Copy link
Member

Trott commented Jun 8, 2018

Seems like this is (partially?) implemented now in #173. Closing, but if you think that's totally wrong, by all means, re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants