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

Fixes #17 make pipeline-compatible #18

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

happyviral
Copy link

@happyviral happyviral commented May 1, 2019

Fixes #17 make pipeline-compatible

  1. Need input on RpmSignPlugin.GpgSignerDescriptor#doCheckIncludes.
    I've passed validation for now without any check.
  2. Please suggest on the jenkins version.
    I've tried with <jenkins.version>2.138.2</jenkins.version>

Copy link

@schwede schwede left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together! Since I am also interested in rpm signing in jenkinsfiles I wanted to pitch in with a code review.

This PR should also update the README with a basic example using this plugin in a jenkinsfile.

Do this changes still allow the plugin to work with the old style of jenkins job configurations?

result = 31 * result + (privateKey.getPlainText() != null ? privateKey.getPlainText().hashCode() : 0);
result = 31 * result + (passphrase.getPlainText() != null ? passphrase.getPlainText().hashCode() : 0);
result = 31 * result + privateKey.getPlainText().hashCode();
result = 31 * result + passphrase.getPlainText().hashCode();
Copy link

Choose a reason for hiding this comment

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

Why remove this null check?

Copy link
Author

Choose a reason for hiding this comment

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

It can not be null.
getPlainText() method of Secret class uses value field and it is annotated as @nonnull.

this.cmdlineOpts = "";
}

@Deprecated
public Rpm(String gpgKeyName, String includes, String cmdlineOpts, boolean resign) {
Copy link

Choose a reason for hiding this comment

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

Why deprecate the old constructor? Do pipeline uses of this plugin use the setters instead of the constructor? Wouldn't this constructor still be appropriate for non-pipeline configurations?

Copy link
Author

Choose a reason for hiding this comment

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

pipeline uses constructor, and setter annotated with @DataBoundConstructor, @DataBoundSetter annotations respectively.
that's a valid point. We'll have to check if it's required for non-pipeline configurations.

src/main/java/jenkins/plugins/rpmsign/RpmSignPlugin.java Outdated Show resolved Hide resolved
@happyviral happyviral marked this pull request as ready for review May 22, 2019 02:42
Copy link

@schwede schwede left a comment

Choose a reason for hiding this comment

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

Thanks for the updates. As long as this still works on both pipeline and freestyle projects I think this should be merged.

Any comments on @elibus? What's the process for getting this released?

@elibus
Copy link
Contributor

elibus commented May 23, 2019

@happyviral Still changes to be added?

@happyviral
Copy link
Author

@happyviral Still changes to be added?

Changes are done. (review comments are addressed, and updated README.)

Let me know if specific scenario required to be verified.

@schwede
Copy link

schwede commented Jun 6, 2019

@elibus What's the next step?

@elibus
Copy link
Contributor

elibus commented Jun 6, 2019

Next is me reviewing and testing it. Unfortunately are busy times. Have you tested the build?

@schwede
Copy link

schwede commented Jun 8, 2019

No worries, I definitely understand. I haven't yet, I got a jenkins install going in docker so I could test but still need a git repo, rpm, and gpg key setup to try this out end-to-end. I'll give it a shot though when I get a chance.

@tony-sweeney
Copy link

tony-sweeney commented Jun 10, 2019

I have a test Jenkins instance with this plugin built and installed from the branch, with a developer eager to test it. It seems the snippet generator hasn't been updated to generate a snippet for this step, unless I've missed it, so it's not obvious what the pipeline syntax should be.

@schwede
Copy link

schwede commented Jun 11, 2019

Screenshot from 2019-06-10 21-11-59

@tony-sweeney Is this what you are seeing? The form for rpmsign shows up, but the "Generate Pipeline Script" button doesn't print out anything. Is there another interface that needs to be implemented to support the generation part? I would have thought that Jenkins knows enough to just fill in the parameters.

@schwede
Copy link

schwede commented Jun 11, 2019

Well I spoke too soon, the button click is causing an HTTP 500 response. Here's the stack trace in the response:

java.lang.AssertionError: class jenkins.plugins.rpmsign.Rpm is missing its descriptor
at jenkins.model.Jenkins.getDescriptorOrDie(Jenkins.java:1541)
at hudson.model.AbstractDescribableImpl.getDescriptor(AbstractDescribableImpl.java:42)
at org.jenkinsci.plugins.structs.SymbolLookup.getSymbolValue(SymbolLookup.java:218)
at org.jenkinsci.plugins.structs.describable.DescribableModel.symbolOf(DescribableModel.java:685)
at org.jenkinsci.plugins.structs.describable.DescribableModel.uninstantiate2(DescribableModel.java:670)
at org.jenkinsci.plugins.structs.describable.DescribableModel.uninstantiate2_(DescribableModel.java:706)
at org.jenkinsci.plugins.structs.describable.DescribableParameter.uncoerce(DescribableParameter.java:196)
at org.jenkinsci.plugins.structs.describable.DescribableParameter.uncoerce(DescribableParameter.java:190)
at org.jenkinsci.plugins.structs.describable.DescribableParameter.inspect(DescribableParameter.java:142)
at org.jenkinsci.plugins.structs.describable.DescribableModel.uninstantiate2(DescribableModel.java:609)
at org.jenkinsci.plugins.structs.describable.DescribableModel.uninstantiate2_(DescribableModel.java:706)
at org.jenkinsci.plugins.structs.describable.DescribableParameter.uncoerce(DescribableParameter.java:196)
at org.jenkinsci.plugins.structs.describable.DescribableParameter.inspect(DescribableParameter.java:142)
at org.jenkinsci.plugins.structs.describable.DescribableModel.uninstantiate2(DescribableModel.java:609)
at org.jenkinsci.plugins.structs.describable.DescribableModel.uninstantiate2_(DescribableModel.java:706)
at org.jenkinsci.plugins.workflow.steps.StepDescriptor.uninstantiate(StepDescriptor.java:252)
at org.jenkinsci.plugins.workflow.cps.Snippetizer.object2Groovy(Snippetizer.java:139)
at org.jenkinsci.plugins.workflow.cps.Snippetizer.step2Groovy(Snippetizer.java:81)
at org.jenkinsci.plugins.workflow.cps.Snippetizer.doGenerateSnippet(Snippetizer.java:513)
at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:212)
at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:145)
at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:535)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
Caused: javax.servlet.ServletException
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:797)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:878)
at org.kohsuke.stapler.MetaClass$9.dispatch(MetaClass.java:456)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:878)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:676)
at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:873)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
at org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:243)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
at io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
at io.jenkins.blueocean.auth.jwt.impl.JwtAuthenticationFilter.doFilter(JwtAuthenticationFilter.java:61)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
at jenkins.telemetry.impl.UserLanguages$AcceptLanguageFilter.doFilter(UserLanguages.java:128)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:157)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:99)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:135)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1701)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1668)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:502)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
at java.lang.Thread.run(Thread.java:748)

@schwede
Copy link

schwede commented Jun 11, 2019

@happyviral Does this exception mean anything to you?

java.lang.AssertionError: class jenkins.plugins.rpmsign.Rpm is missing its descriptor

Edit: Found this description of the issue with the 500 error I think: https://wiki.jenkins.io/display/JENKINS/My+class+is+missing+descriptor

@tony-sweeney
Copy link

@schwede I simply don't see an RPM sign entry in the Snippet Generator Sample Step dropdown.
image

@tony-sweeney
Copy link

As an experiment I tried to build the pipeline-compatible branch of happyviral's fork on GitHub:
https://github.com/happyviral/rpmsign-plugin/tree/pipeline-compatible
Installing this in my test server, I now do have rpmSign available in the dropdown, and it does generate Pipeline syntax on button press:
image

@happyviral
Copy link
Author

As an experiment I tried to build the pipeline-compatible branch of happyviral's fork on GitHub:
https://github.com/happyviral/rpmsign-plugin/tree/pipeline-compatible
Installing this in my test server, I now do have rpmSign available in the dropdown, and it does generate Pipeline syntax on button press:
image

sorry for the late reply.
I also had tested out with https://github.com/happyviral/rpmsign-plugin/tree/pipeline-compatible branch using jenkins 2.138.2 version before raising pull request.
Is it the case that it's not working with latest jenkins version? Please suggest on the jenkins version to test out the changes.

@mimecast-tsweeney
Copy link

I have tested on Jenkins 2.164.3 In my case a plugin built from:
https://github.com/jenkinsci/rpmsign-plugin/tree/pipeline-compatible
Did not seem to be any different than the standard install, other than the snapshot version.
However, a direct build of happyviral's forked repo resulted in a functional plugin that was 400 or so bytes larger than the jenkinsci version.

@fuzzybair
Copy link

Is there any updates on this? or anything I can do to help move it along?

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.

Make it Pipeline-Compatible
6 participants