jenkinsci / artifact-promotion-plugin

A simple Jenkins plugin to promote artifacts.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pipeline example doesn't quite work

keirlawson opened this issue · comments

The exampl in the README doesn't quite work for me, I found I needed to enclose the artifactPromotion section in a steps block and also add promoterClass and debug options explicitly, giving final code of the form:

stage('example') {
    steps {
        artifactPromotion (
            promoterClass: 'org.jenkinsci.plugins.artifactpromotion.NexusOSSPromotor',
            debug: true,
            groupId: 'com.example.test',
            artifactId: 'my-artifact',
            version: '1.0.0',
            extension: 'zip',
            stagingRepository: 'http://nexus.myorg.com:8080/content/repositories/release-candidates',
            stagingUser: 'foo',
            stagingPW: 's3cr3t',
            skipDeletion: true,
            releaseRepository: 'http://nexus.myorg.com:8080/content/repositories/releases',
            releaseUser: 'foo',
            releasePW: 's3cr3t'
        )
    }
}

Am happy to produce a PR to update the README but seems to be like the debug and promotorClass values should be defaulted but are not, which may be a bug?

Thank you submitting this.

Can you tell me which version of Jenkins and the Pipeline Plugin's you are using?
I've tested it in my environment as written in the README so I would like to reproduce the behavior you observe.

Jenkins 2.125, Pipeline 2.5

Did you used the decleratice pipeline? Pls try the scripted pipeline.
The example is for the scripted pipeline and we've developed and tested only agains this one.
But sure, we should clarify this in the documentation and add examples for both cases.

You're right, we've to provide promoterClass. If not, we run into a NullPointer Exception because there is no default defined.
debug can be omitted without problems.

@keirlawson Feel free to provide a PR with updates to the readme. Could you cover both pipeline flavors (scripted and declerative)?

For declarative pipeline it looks like debug is required, without it I get

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 7: Missing required parameter: "debug" @ line 7, column 13.
               artifactPromotion (
               ^