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

replace checkin jobs with scabot logic #45

Merged
merged 8 commits into from
Jun 30, 2015
Merged

Conversation

adriaanm
Copy link
Contributor

[Haven't tested this yet.]

Run PR validation on pushes to master-like branches, and post status to commit.

The goal is to retire the scala-checkin jobs at EPFL (the 2.12.x is failing because no java 8)

So we can reuse it to build merge commits,
which are not tied to a particular PR.
TODO:
  - see if this works :-)
  - handle jobs without _scabot_pr param (commits built on push above),
    and post commit status to appropriate commit (put branch name into pr param?)
@adriaanm
Copy link
Contributor Author

preview by @SethTisue

@adriaanm adriaanm changed the title WIPpy: replace checkin jobs with scabot logic replace checkin jobs with scabot logic Jun 30, 2015
@SethTisue
Copy link
Member

extends everywhere instead of self-types is to avoid confusing IntelliJ, says Adriaan in chat, but I like it stylistically too

@adriaanm
Copy link
Contributor Author

(I said it confuses intellij in the commit message, btw)

// - PARAM_PR's value is an integer ==> assumed to be PR number,
// - otherwise, it's assumed to be the branch name of a job launched for a pushed commit (e.g., a merge or a direct push)
// TODO: report failure
case js@JobState(name, _, BuildState(number, _, _, _, _, _, _)) =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the nested fors and nested Futures here took me quite a while to puzzle through and figure out what was going on. would something like the following match your intent? if so, I think it reads much easier

case js @ JobState(name, _, BuildState(number, _, _, _, _, _, _)) =>
  for (bs <- jenkinsApi.buildStatus(name, number)) {
    log.debug(s"Build status for $name #$number: $bs")
    val jobRes = JenkinsJobResult(name, bs)
    val prParam = bs.parameters(PARAM_PR)
    Try(prParam.toInt) match {
      case Success(pr) =>
        prActor(pr) ! jobRes
      case Failure(_) =>
        for (_ <- milestoneForBranch(prParam))
          postStatus(new BaseRef(prParam), jobRes)
    }
  }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's close, but would behave differently if bs.parameters(PARAM_PR) throws, which would kill the actor.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at the end I think that should be

for {
  _ <- milestoneForBranch(prParam)
  _ <- postStatus(new BaseRef(prParam), jobRes)
} yield ()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a simplification based on your suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked your original suggestion better. Foreach is the right combinator here, no need to flatMap

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it still feels a bit weird to me that we're just firing up the Future and ignoring the result, without any explicit indication in the source code, but I think you're right that switching combinators isn't the right way to address it. merging.

@SethTisue
Copy link
Member

comments left inline. otherwise LGTM

SethTisue added a commit that referenced this pull request Jun 30, 2015
replace checkin jobs with scabot logic
@SethTisue SethTisue merged commit 3de05d4 into scala:master Jun 30, 2015
@SethTisue
Copy link
Member

fwiw, I checked just now and this is still working — I merged a PR onto 2.11.x, and a validate-main job was triggered.

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

Successfully merging this pull request may close these issues.

2 participants