Is there any difference in plugin development of pipeline and freestyle project

40 views
Skip to first unread message

varun vikas

unread,
Jun 14, 2019, 2:53:07 AM6/14/19
to Jenkins Developers
Hi,

I am developing a plugin which reads xml file and do copy,zip,delete file and also execute commands on slave/master machine.
It is working fine on freeStyle project. what chnages I have to do to work this plugin on pipeline projects.

Thanks,
Varun

Ulli Hafner

unread,
Jun 14, 2019, 3:22:04 AM6/14/19
to jenkin...@googlegroups.com
Which extension point does your plugin implement? Typically you can simply implement a SimpleBuildStep, then your recorder works out of the box for pipelines. See https://jenkins.io/doc/developer/plugin-development/pipeline-integration/ for details
--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/d5749f61-46c9-49e4-a24a-7f804c1902a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

varun vikas

unread,
Aug 24, 2019, 5:55:58 PM8/24/19
to Jenkins Developers
Hi Ulli,

I have extended Builder .
e.g

public class FileOperationsBuilder extends Builder
and override
@Override
public boolean perform(final AbstractBuild<?, ?> build, final Launcher launcher, final BuildListener listener)
throws InterruptedException, IOException

Here I need AbstractBuild<?,?> because I have to call getBuiltOn function to execute batch and sh scripts on slave.

if I implement SimpleBuildStep, I have to override
   @Override
    public void perform(Run build,
                        FilePath workspace,
                        Launcher launcher,
                        TaskListener listener) throws InterruptedException, IOException {
        listener.getLogger().println("What was " + what + "?");
    }

and I will not get AbstractBuild<?,?> which I need for running commands on slave.

Should I use SimpleBuildStep or extending Builder will also handle pipeline plugin development.
please help.

Thanks,
Varun
On Friday, 14 June 2019 12:52:04 UTC+5:30, Ulli Hafner wrote:
Which extension point does your plugin implement? Typically you can simply implement a SimpleBuildStep, then your recorder works out of the box for pipelines. See https://jenkins.io/doc/developer/plugin-development/pipeline-integration/ for details


Am 14.06.2019 um 07:57 schrieb varun vikas <varun...@gmail.com>:

Hi,

I am developing a plugin which reads xml file and do copy,zip,delete file and also execute commands on slave/master machine.
It is working fine on freeStyle project. what chnages I have to do to work this plugin on pipeline projects.

Thanks,
Varun

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkin...@googlegroups.com.

Slide

unread,
Aug 24, 2019, 7:02:39 PM8/24/19
to jenkin...@googlegroups.com
Why can't you run things on an agent without AbstractBuild? You MUST either implement SimpleBuildStep as you have specified, or provide a separate implementation for Pipeline that implements a step. I highly recommend doing the former so you can share code between FreeStyle and Pipeline were appropriate. 

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/29a9a613-5766-4b14-840b-c40cac5bc0d0%40googlegroups.com.


--

varun vikas

unread,
Aug 25, 2019, 12:32:57 AM8/25/19
to Jenkins Developers
Hi Slide,

    Thanks alot for your valuable suggestion. I have made changes in my code to implement SimpleBuildStep and its working fine.

-Varun 
Reply all
Reply to author
Forward
0 new messages