SCM plugin not appearing as SCM option in project configuration

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

SCM plugin not appearing as SCM option in project configuration

José Lamas Ríos
Hi,

Newbie here, newbie on Jenkins and even newbie on Java :)

I'm trying to write a new SCM plugin.

// com.genexus.gxserver/GeneXusServerSCM.java
public class GeneXusServerSCM extends SCM implements Serializable{

    [...]

    @Override
    public DescriptorImpl getDescriptor() {
        return (DescriptorImpl) super.getDescriptor();
    }

    @Extension
    public static class DescriptorImpl extends SCMDescriptor<GeneXusServerSCM> {

        @Override
        public boolean isApplicable(Job project) {
            return true;
        }
           
        public DescriptorImpl() {
            super(GeneXusServerSCM.class, null);
            load();
        }

    [...]

}

I can see my plug-in appear as installed on http://localhost:8080/jenkins/pluginManager/installed but don't see it as an option on the Source Code Management section of a project configuration (ie: http://localhost:8080/jenkins/job/GXserverProjectTest/configure).

My project includes a config.jelly

// com.genexus.gxserver.GeneXusServerSCM/config.jelly
<?xml version="1.0" encoding="UTF-8"?>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
    <f:section title="${%GeneXus Server}">
        <f:entry field="label" title="${%Label}">
            <f:textbox/>
        </f:entry>
    </f:section>
</j:jelly>

It only includes a simple 'Label' for now, but as I said above it doesn't even appear as an available SCM option ("None" and "Subversion" do appear).

I guess I'm missing some very basic thing, I've been looking at SVN and TFS implementations, but couldn't figure it out.

Any hint? How does Jenkins gets the list of available SCMs? Do I have a chance to debug that code?

Thanks in advance,



-- 
JLR

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/a156f150-cd96-4d59-b54e-70d17f7b1963%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: SCM plugin not appearing as SCM option in project configuration

stephenconnolly

On Fri 24 Nov 2017 at 00:40, José Lamas Ríos <[hidden email]> wrote:
Hi,

Newbie here, newbie on Jenkins and even newbie on Java :)

I'm trying to write a new SCM plugin.

// com.genexus.gxserver/GeneXusServerSCM.java
public class GeneXusServerSCM extends SCM implements Serializable{

    [...]

    @Override
    public DescriptorImpl getDescriptor() {
        return (DescriptorImpl) super.getDescriptor();
    }

    @Extension
    public static class DescriptorImpl extends SCMDescriptor<GeneXusServerSCM> {

Override getDisplayName() and return a name... otherwise it is “invisible” and cannot be selected.

Are you following the implementation guide in scm-api https://github.com/jenkinsci/scm-api-plugin/blob/master/docs/implementation.adoc because if I missed mentioning that it would be great if you could file a PR to update the docs


        @Override
        public boolean isApplicable(Job project) {
            return true;
        }
           
        public DescriptorImpl() {
            super(GeneXusServerSCM.class, null);
            load();
        }

    [...]

}

I can see my plug-in appear as installed on http://localhost:8080/jenkins/pluginManager/installed but don't see it as an option on the Source Code Management section of a project configuration (ie: http://localhost:8080/jenkins/job/GXserverProjectTest/configure).

My project includes a config.jelly

// com.genexus.gxserver.GeneXusServerSCM/config.jelly
<?xml version="1.0" encoding="UTF-8"?>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
    <f:section title="${%GeneXus Server}">
        <f:entry field="label" title="${%Label}">
            <f:textbox/>
        </f:entry>
    </f:section>
</j:jelly>

It only includes a simple 'Label' for now, but as I said above it doesn't even appear as an available SCM option ("None" and "Subversion" do appear).

I guess I'm missing some very basic thing, I've been looking at SVN and TFS implementations, but couldn't figure it out.

Any hint? How does Jenkins gets the list of available SCMs? Do I have a chance to debug that code?

Thanks in advance,



-- 
JLR

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/a156f150-cd96-4d59-b54e-70d17f7b1963%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Sent from my phone

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CA%2BnPnMzJE_UVPLfN8Y0Z9TQscOTTd4cQAwayAuV_exuT-F8sSg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: SCM plugin not appearing as SCM option in project configuration

stephenconnolly

On Fri 24 Nov 2017 at 08:13, Stephen Connolly <[hidden email]> wrote:

On Fri 24 Nov 2017 at 00:40, José Lamas Ríos <[hidden email]> wrote:
Hi,

Newbie here, newbie on Jenkins and even newbie on Java :)

I'm trying to write a new SCM plugin.

// com.genexus.gxserver/GeneXusServerSCM.java
public class GeneXusServerSCM extends SCM implements Serializable{

    [...]

    @Override
    public DescriptorImpl getDescriptor() {
        return (DescriptorImpl) super.getDescriptor();
    }

    @Extension
    public static class DescriptorImpl extends SCMDescriptor<GeneXusServerSCM> {

Override getDisplayName() and return a name... otherwise it is “invisible” and cannot be selected.

Are you following the implementation guide in scm-api https://github.com/jenkinsci/scm-api-plugin/blob/master/docs/implementation.adoc because if I missed mentioning that it would be great if you could file a PR to update the docs

The section applicable to this case is “Implementing hudson.scm.SCM”


        @Override
        public boolean isApplicable(Job project) {
            return true;
        }
           
        public DescriptorImpl() {
            super(GeneXusServerSCM.class, null);
            load();
        }

    [...]

}

I can see my plug-in appear as installed on http://localhost:8080/jenkins/pluginManager/installed but don't see it as an option on the Source Code Management section of a project configuration (ie: http://localhost:8080/jenkins/job/GXserverProjectTest/configure).

My project includes a config.jelly

// com.genexus.gxserver.GeneXusServerSCM/config.jelly
<?xml version="1.0" encoding="UTF-8"?>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
    <f:section title="${%GeneXus Server}">
        <f:entry field="label" title="${%Label}">
            <f:textbox/>
        </f:entry>
    </f:section>
</j:jelly>

It only includes a simple 'Label' for now, but as I said above it doesn't even appear as an available SCM option ("None" and "Subversion" do appear).

I guess I'm missing some very basic thing, I've been looking at SVN and TFS implementations, but couldn't figure it out.

Any hint? How does Jenkins gets the list of available SCMs? Do I have a chance to debug that code?

Thanks in advance,



-- 
JLR

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/a156f150-cd96-4d59-b54e-70d17f7b1963%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Sent from my phone
--
Sent from my phone

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CA%2BnPnMxmLS1SucNCq94G7nwge-oumK0XbRXx2pQNfKPfzDWSew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: SCM plugin not appearing as SCM option in project configuration

José Lamas Ríos
In reply to this post by stephenconnolly
Hi Stephen, thanks for your help

On Friday, November 24, 2017 at 5:13:45 AM UTC-3, Stephen Connolly wrote:


Override getDisplayName() and return a name... otherwise it is “invisible” and cannot be selected.

Yep, I do have an override returning a string. Here's the entire DescriptorImpl class..

    @Extension
    public static class DescriptorImpl extends SCMDescriptor<GeneXusServerSCM> {

        @Override
        public boolean isApplicable(Job project) {
            return true;
        }
           
        public DescriptorImpl() {
            super(GeneXusServerSCM.class, null);
            load();
        }

        @Override
        public SCM newInstance(StaplerRequest req, final JSONObject formData) throws FormException {
            return super.newInstance(req, formData);
        }
        
        @Override
        public String getDisplayName() {
            return "GeneXus Server";
        }

        @Override
        public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
            // Save configuration
            save();
            return super.configure(req, formData);
        }
        
    }

I've set breakpoints in the constructor, and the newInstance() and getDisplayName() methods, but one of them gets hit.

BTW, the entire project is available here if you want to take a closer look:
https://drive.google.com/open?id=1GNQDH4klYvHfCrmy-NFs6HSjeQqqalfe
 

Are you following the implementation guide in scm-api <a href="https://github.com/jenkinsci/scm-api-plugin/blob/master/docs/implementation.adoc" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fscm-api-plugin%2Fblob%2Fmaster%2Fdocs%2Fimplementation.adoc\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGHSudQM3YmZG8s8qrlrYTS35jZzQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fscm-api-plugin%2Fblob%2Fmaster%2Fdocs%2Fimplementation.adoc\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGHSudQM3YmZG8s8qrlrYTS35jZzQ&#39;;return true;">https://github.com/jenkinsci/scm-api-plugin/blob/master/docs/implementation.adoc because if I missed mentioning that it would be great if you could file a PR to update the docs


Yes, I'm following that and also these:

https://wiki.jenkins.io/display/JENKINS/Plugin+tutorial#Plugintutorial-PluginImplapproach
https://wiki.jenkins.io/display/JENKINS/Writing+an+SCM+plugin
https://wiki.jenkins.io/display/JENKINS/SCM+plugin+architecture

Anyway, I'll re-read the implementation guide trying to find something I may have overlooked.

Thanks!

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/939bb514-1bbf-4dc0-af5b-405882a63a3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: SCM plugin not appearing as SCM option in project configuration

José Lamas Ríos


On Friday, November 24, 2017 at 10:47:53 AM UTC-3, José Lamas Ríos wrote:

I've set breakpoints in the constructor, and the newInstance() and getDisplayName() methods, but one of them gets hit.

Sorry, meant to say "but *none* of them get hit"
 

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/a3b6ccd9-51bd-4cf9-9ab9-2218e2d3bd81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.