SCM plugin not appearing as SCM option in project configuration

30 views
Skip to first unread message

José Lamas Ríos

unread,
Nov 23, 2017, 7:40:14 PM11/23/17
to Jenkins Developers
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

Stephen Connolly

unread,
Nov 24, 2017, 3:13:45 AM11/24/17
to jenkin...@googlegroups.com
On Fri 24 Nov 2017 at 00:40, José Lamas Ríos <j...@genexus.com> 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

--
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/a156f150-cd96-4d59-b54e-70d17f7b1963%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Sent from my phone

Stephen Connolly

unread,
Nov 24, 2017, 3:17:23 AM11/24/17
to jenkin...@googlegroups.com
On Fri 24 Nov 2017 at 08:13, Stephen Connolly <stephen.al...@gmail.com> wrote:

On Fri 24 Nov 2017 at 00:40, José Lamas Ríos <j...@genexus.com> 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”

José Lamas Ríos

unread,
Nov 24, 2017, 8:47:53 AM11/24/17
to Jenkins Developers
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:
 

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


José Lamas Ríos

unread,
Nov 24, 2017, 9:54:44 AM11/24/17
to Jenkins Developers


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"
 

Reply all
Reply to author
Forward
0 new messages