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

Support labels to run build on Mesos. #30

Merged
merged 17 commits into from Apr 24, 2019

Conversation

jeschkies
Copy link

@jeschkies jeschkies commented Apr 16, 2019

Summary:
This enables the plugin to actually run builds on Mesos. I validated the
behavior manually since a full integration test requires some work with
the Jenkins fixture. To get everything working I added a template for
pod specs that is configured by users and introduced the provisioning
strategy.

We also go back to Java 8 since some Jenkins components do not
support Java 11 yet.

JIRA issues: DCOS_OSS-5056

@jeschkies
Copy link
Author

It's still failing with

java.lang.IllegalArgumentException
	at org.kohsuke.asm5.ClassReader.<init>(ClassReader.java:170)
	at org.kohsuke.asm5.ClassReader.<init>(ClassReader.java:153)
	at org.kohsuke.asm5.ClassReader.<init>(ClassReader.java:424)
	at org.kohsuke.stapler.ClassDescriptor$ASM.loadParametersFromAsm(ClassDescriptor.java:352)
	at org.kohsuke.stapler.ClassDescriptor$ASM.access$100(ClassDescriptor.java:300)
	at org.kohsuke.stapler.ClassDescriptor.loadParameterNames(ClassDescriptor.java:233)
	at org.kohsuke.stapler.ClassDescriptor.loadConstructorParamNames(ClassDescriptor.java:267)
	at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:765)
	at org.kohsuke.stapler.RequestImpl.access$200(RequestImpl.java:83)
	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:678)
Caused: java.lang.IllegalArgumentException: Failed to instantiate class org.jenkinsci.plugins.mesos.MesosCloud from {"mesosMasterUrl":"http://127.0.0.1:5050","frameworkName":"JenkinsScheduler","role":"test","agentUser":"kjeschkies","jenkinsUrl":"http://localhost:8080/","stapler-class":"org.jenkinsci.plugins.mesos.MesosCloud","$class":"org.jenkinsci.plugins.mesos.MesosCloud"}
	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:681)

Super strange.

@jeschkies
Copy link
Author

jeschkies commented Apr 16, 2019

It seems that ClassReader wants JVM byte code. It should have been updated to ASM 6.2 https://issues.jenkins-ci.org/browse/JENKINS-46602 but ./gradlew dependenices says it's ASM 5.

@jeschkies
Copy link
Author

I cut a JIRA to Jenkins https://issues.jenkins-ci.org/browse/JENKINS-57024.

jeschkies and others added 6 commits April 16, 2019 16:30
Summary:
This patch simplifies the USI flow and avoids usage of the kill switch.
It's all been taken care of by USI.
* Introduce MesosAgentSpec for label configuration
@jeschkies
Copy link
Author

jeschkies commented Apr 17, 2019

It finally loads the plugin. However, jobs are not run. Here is the test flow so far. We will encode it at smome point:

  1. Start a minimal Mesos cluster
  2. Start Jenkins with rm -rf work && ./gradlew server --info
  3. Got to Configure -> Cloud and add a Mesos Cloud with the following parameters
    3.1 Mesos URL, probably http://127.0.0.1:5050
    3.2 The user you are running Mesos with.
    3.3 Jenkins URL, probably http://localhost:8080
  4. Add a Mesos agent with label mesos
  5. Create a free project with
    4.1 Restricted nodes for mesos
    4.2 Build shell script echo "Hello" && sleep 100
  6. Build the project

You should see that one node is pending but USI keeps launching new agents. So something is still wrong. If you look into the sandbox you see that the agent jar launches and connects but the Jenkins master has EOFExceptions.

@@ -20,7 +22,7 @@ dependencies {
api ('com.mesosphere.usi:core') { version { branch = usiBranch } }
api ('com.mesosphere.usi:core-models') { version { branch = usiBranch } }
api ('com.mesosphere.usi:mesos-client') { version { branch = usiBranch } }
api group: 'org.slf4j', name: 'slf4j-api', version: '1.7.26'
api group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
Copy link

Choose a reason for hiding this comment

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

why the downgrade here? is that version only supported in java 11?

Copy link
Author

Choose a reason for hiding this comment

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

I changed the plugin to use its class loader first. This resulted in a version conflict with Jenkins. So I downgraded it. I since dropped it.

build.gradle Outdated

jenkinsPlugin {
coreVersion = "2.155"
coreVersion = "2.173"
Copy link

Choose a reason for hiding this comment

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

can we set to 2.164? that maps to the next jenkins version we have queued up for release to the universe. Jenkins doesn't garuntee downgrade

https://github.com/mesosphere/dcos-jenkins-service/blob/3.5.x/Dockerfile#L1

Copy link
Author

Choose a reason for hiding this comment

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

I'll try.

@@ -30,9 +30,9 @@
import org.slf4j.LoggerFactory;

/** Representation of a Jenkins node on Mesos. */
public class MesosSlave extends AbstractCloudSlave implements EphemeralNode {
public class MesosAgent extends AbstractCloudSlave implements EphemeralNode {
Copy link

Choose a reason for hiding this comment

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

maybe MesosJenkinsAgent is a better name? I suppose the name MesosAgent gets confusing in the context of mesos

Copy link
Author

Choose a reason for hiding this comment

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

I renamed it but we also have MesosAgentSpecTemplate. We probably need a few more iterations on naming 🙂

@jeschkies jeschkies changed the title Test simple Jenkins build on Mesos. Support labels to run build on Mesos. Apr 23, 2019
@jeschkies jeschkies marked this pull request as ready for review April 23, 2019 16:22
@kvish
Copy link

kvish commented Apr 23, 2019

lgtm after comments

@jeschkies jeschkies merged commit 3107100 into usi-jenkins Apr 24, 2019
@jeschkies jeschkies deleted the karsten/test-jenkins-job branch April 24, 2019 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants