Thanks Richard,
I have defined the Symbol using @Symbol("TestUploader") annotation but it
was not working. Now that I have changed the parameter of annotation to
@Symbol("testUploader"), it is working with the following syntax.
pipeline {
agent any
stages {
stage('Build and Run Tests') {
steps {
testUploader name:'admin', lastname: 'admin', endPoint: '
http://localhost:8080/', file:'path/to/myfile.txt'
}
}
}
}
Thanks for the help :)
On Monday, February 25, 2019 at 11:29:25 PM UTC+5:30, Richard Bywater wrote:
>
> You'll need to provide some idea of what error/behaviour you are seeing as
> otherwise it's hard to help point you in the right direction.
>
> Richard
>
> On Tue, 26 Feb 2019, 1:17 AM prasad.pofali via Jenkins Users, <
> [email protected] <javascript:>> wrote:
>
>> Hello,
>>
>> I have created a Symbol in TestRunPublisher for descriptor. The code now
>> looks like following:
>>
>>
>> public class TestUploader extends Publisher implements SimpleBuildStep {
>> private final String name;
>> private final String password;
>> //getters are there for above variables.
>> @DataBoundConstructor
>> public TestUploader (String name, String password){
>> //set the data to class members.
>> }
>> @Symbol("TestUploader")
>> @Extension
>> ublic static final class DescriptorImpl extends
>> BuildStepDescriptor<Publisher> {
>> public DescriptorImpl () {
>> load();
>> }
>> }
>> public boolean isApplicable (Class<? extends AbstractProject>
>> aClass) {return true;}
>>
>> public String getDisplayName () {return "TestUploader";}
>>
>> @Override
>> public boolean configure (StaplerRequest req, JSONObject formData) throws
>> FormException {
>> save();
>> return super.configure(req, formData);
>> }
>> }
>>
>> I think I am missing out on something.
>>
>>
>> On Sunday, February 24, 2019 at 12:19:56 PM UTC+5:30, Richard Bywater
>> wrote:
>>>
>>> You need to define a Symbol in your plugin. See Defining Symbols
>>> section at
>>> https://jenkins.io/doc/developer/plugin-development/pipeline-integration/
>>>
>>> Richard
>>>
>>> On Sat, 23 Feb 2019, 11:25 AM prasad.pofali via Jenkins Users, <
>>> [email protected]> wrote:
>>>
>>>> I have developed a custom Jenkins plugin which extends *Recorder *and
>>>> implements *SimpleBuildStep*. I was calling this plugin using the
>>>> syntax:
>>>>
>>>> pipeline {
>>>> agent any
>>>> stages {
>>>> stage('Build and Run Tests') {
>>>> steps {
>>>> step([$class : 'TestClass', name: 'admin', lastname:
>>>> 'admin', endPoint:'http://localhost:8080/', file:'path/to/myfile.txt'])
>>>> }
>>>> }
>>>> }
>>>> }
>>>>
>>>>
>>>> With this the plugin is executed, but now my requirement is to call
>>>> this plugin with the different pipeline syntax which is our primary
>>>> requirement. The required syntax is as follows:
>>>>
>>>> pipeline {
>>>> agent any
>>>> stages {
>>>> stage('Build and Run Tests') {
>>>> steps {
>>>> TestClass name:'admin' lastname: 'admin' endPoint: '
>>>> http://localhost:8080/', file:'path/to/myfile.txt'
>>>> }
>>>> }
>>>> }
>>>> }
>>>>
>>>>
>>>> But I am not able to call the same plugin with the above syntax. Can
>>>> anyone please help me?
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Jenkins Users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/jenkinsci-users/db5c1523-75e2-4969-ba26-54dede193291%40googlegroups.com
>>>>
>>>> <https://groups.google.com/d/msgid/jenkinsci-users/db5c1523-75e2-4969-ba26-54dede193291%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-users/a882d3ba-768b-43f0-8c63-4dcc7f82ba3e%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/jenkinsci-users/a882d3ba-768b-43f0-8c63-4dcc7f82ba3e%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/9a0eb354-adb9-4053-8253-ee98b8701909%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.