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

Tag slave instances to their jenkins master #274

Closed
wants to merge 1 commit into from
Closed

Tag slave instances to their jenkins master #274

wants to merge 1 commit into from

Conversation

dblanchette
Copy link

This replaces PR #271 that had the wrong starting branch.

In the case where you have multiple Jenkins masters using the same configuration (same AMI for multiple clouds), the instance cap is shared between all instances and clouds. The workaround is to add an additional tag with the Jenkins url to have this instance cap unique per Jenkins master.

@Jimilian
Copy link
Contributor

Even so it creates a very big conflict with my PR (#252), it would be very good to have something like this in place.

Few things on top of review:

  • it would be nice to update instanceCap documentation to refer to the new state.
  • jenkins server url can be empty in some installations (it's not mandatory field)

At the end, in current state PR should work if user does not:

  • re-use jenkins url
  • override EC2Tag.TAG_NAME_JENKINS_SERVER_URL on his own

Copy link
Contributor

@Jimilian Jimilian left a comment

Choose a reason for hiding this comment

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

As I'm not a maintainer, my comments can be easily ignored :)

Let's wait feedback from @francisu

@@ -383,6 +389,9 @@ private int countCurrentEC2Slaves(SlaveTemplate template) throws AmazonClientExc
filters.add(new Filter("launch.image-id", values));
}

// The instances must match the jenkins server url
filters.add(new Filter("tag:" + EC2Tag.TAG_NAME_JENKINS_SERVER_URL + "=" + jenkinsServerUrl));
Copy link
Contributor

Choose a reason for hiding this comment

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

if user specified EC2Tag.TAG_NAME_JENKINS_SERVER_URL manually, this line will break instance cap calculation.

@@ -475,6 +484,15 @@ private int countCurrentEC2Slaves(SlaveTemplate template) throws AmazonClientExc
return n;
}

private boolean isEc2ProvisionedJenkinsSlave(List<Tag> tags, String serverUrl) {
Copy link
Contributor

Choose a reason for hiding this comment

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

imho, it would be better to use getCustomInstanceTags here and compare list of tags from instance with expected tags.

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.

4 participants