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

Various fixes #23

Merged
merged 6 commits into from
Nov 14, 2016
Merged

Various fixes #23

merged 6 commits into from
Nov 14, 2016

Conversation

jimmidyson
Copy link
Contributor

Sorry for combining into one PR - just easier...

Includes:

  1. Only queue Jenkins builds for Builds in New state
  2. Ensure handling cancellations and new requests are properly synchronized
  3. Set OpenShift Build to Pending once build is queued in Jenkins

private synchronized void buildModified(Build build) {
if ((build.getStatus().getPhase().equals(NEW) || build.getStatus().getPhase().equals(RUNNING)) &&
private static synchronized void buildModified(Build build) {
if ((build.getStatus().getPhase().equals(NEW) || build.getStatus().getPhase().equals(PENDING) || build.getStatus().getPhase().equals(RUNNING)) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

may be cleaner to only get status once...before the and use later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -162,6 +164,10 @@ public static synchronized void buildAdded(Build build) throws IOException {
return;
}

if (!build.getStatus().getPhase().equals(NEW)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -270,6 +271,14 @@ public static void cancelOpenShiftBuild(Build build) {
.done();
}

public static void updateOpenShiftBuildToPending(Build build) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you can create a generic function that takes the Phase to set it to...PENDING, CANCELLED, etc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

public static void cancelOpenShiftBuild(Build build) {
logger.info("cancelling build in namespace " + build.getMetadata().getNamespace() + " with name: " + build.getMetadata().getName());
public static void updateOpenShiftBuildPhase(Build build, String phase) {
logger.info("setting build to pending in namespace " + build.getMetadata().getNamespace() + " with name: " + build.getMetadata().getName());
Copy link
Contributor

Choose a reason for hiding this comment

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

should you be outputting the "phase" here instead of pending?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doh thanks! Done.

@jimmidyson jimmidyson merged commit ce22080 into jenkinsci:master Nov 14, 2016
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