-
Notifications
You must be signed in to change notification settings - Fork 76
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
[JENKINS-57439 ] - Add declarative support #77
Conversation
What's the usual proces for getting a PR like this reviewed? I see that most PRs are usually reviewed by @jglick, @jvz or @dwnusbaum? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Dependency updates are no problem. Would be good for @abayer to take a look to make sure the Declarative extension looks ok. Requesting changes just because you need @Extension(optional = true)
to be able to mark the dependency as optional.
pom.xml
Outdated
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jenkins-ci.plugins.workflow</groupId> | ||
<artifactId>workflow-cps</artifactId> | ||
<version>2.39</version> | ||
<version>2.67</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: It would be good to introduce properties for the versions of workflow-step-api, workflow-cps, and workflow-support, since they are each used twice and we don't want them to get out of sync.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion, I created a few properties for those deps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Minor nits but workflow-step-cps
and workflow-step-support
should just be workflow-cps
and workflow-support
(workflow-step-api
is correct), so it would be great to go ahead and fix that.
...in/java/org/jenkinsci/plugins/docker/commons/credentials/DockerServerCredentialsHandler.java
Outdated
Show resolved
Hide resolved
Thanks for your quick review @dwnusbaum 😄 |
Whoops, committing without running a local build is a bad idea 🙈 Anyway, the lowest compatible Jenkins version seems to be 2.150.1. |
By the way, the build fails with a |
I've kicked off a new build which should get a new agent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable to me.
The build still fails with the same error 😢 |
There was one agent that just didn’t want to go away despite being out of disk space - I’ve nuked it by hand and rerun. |
My next (probably obvious) question: how are things normally merged? Does a contributor merge this PR? And how/when are changes like this usually released and made available in the Jenkins plugin portal? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no test here, though DockerServerCredentialsBindingTest
covers most of the logic.
Is this feature really necessary? You can already use withDockerServer
in steps
, which has the advantage of better localizing the use of the credentials to a particular block.
@@ -114,7 +115,8 @@ public DockerTool forNode(Node node, TaskListener log) throws IOException, Inter | |||
} | |||
} | |||
|
|||
@Extension public static class DescriptorImpl extends ToolDescriptor<DockerTool> { | |||
@Extension @Symbol("docker") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a separate PR. See #52.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, especially after reading the discussion in #52 . It looked like a simple change so I just included it in this PR. But I will move it to a separate PR.
I'll try to add a test that tests the new class explicitly instead of relying on As for whether this change is really necessary: it depends I geuss. In our workflow we try to stick as much as possible to declarative pipelines to keep things simple and understandable (writing this comment reminds me of https://xkcd.com/1172/). Its true that we could use What I'm trying to archieve is running a multi-stage build on a Docker EE UCP cluster. Most of our build tool logic (we're using Gradle) is inside the |
The To be clear, I am not trying to block this PR, just clarify the use case vs. alternatives. |
…tive pipeline" This reverts commit c5b21d7
Hmm, the only steps that seem to be usable in an No offense taken in your earlier comment btw, I totally agree that it's better to discuss alternatives before blindly merging changes. On a sidenote, if the |
I added a test for the new functionality. I did have to add some dependencies to allow the usage of a declarative pipeline in the test code. As a practical alternative I attached our UCP manager node as an agent to Jenkins. This way both the |
Are there any plans to merge this soon? Just hoping this PR won't die a silent death 😛 |
resolved the conflict. Will review ASAP and merge if everything is fine from my PoV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is good to go. Thanks @lion7 !
Thanks @oleg-nenashev 😄 |
@lion7 is there a Jenkins JIRA ticket for it so that I reference it in the changelog? |
@lion7 my plan is to cut the release today unless there is a negative feedback. |
@oleg-nenashev I added the example in this PR to the README. |
Created https://issues.jenkins-ci.org/browse/JENKINS-57439 . Not sure what causes the JIRA access issue tho, maybe it makes sense to contact the Jenkins INFRA team |
This PR implements the credentials handler for a declarative pipeline, similiar to jenkinsci/aws-credentials-plugin#50 and inspired by FileCredentialsHandler.java
The dependency on
pipeline-model-extensions
is made optional as suggested by @jglick in jenkinsci/aws-credentials-plugin#50,Additionally I also added a symbol annotation to the
DockerTool
descriptor so it can be used in the tools section of a declarative pipeline (inspired by GradleInstallation.java)This allows to use the Docker tool and Docker credentials like this:
Note that I had to bump a lot of dependency versions due to the enforcer plugin. I hope this is ok.