On Monday, August 12, 2024 at 3:09:19 PM UTC-6 Doug Whitfield wrote:

I think I see that you can disable shortening in the code of 
https://github.com/jenkinsci/branch-api-plugin/blob/master/src/main/java/jenkins/branch/WorkspaceLocatorImpl.java#L333

 static /* not final */ Mode MODE = 
Mode.valueOf(System.getProperty(WorkspaceLocatorImpl.class.getName() + 
".MODE", Mode.MULTIBRANCH_ONLY.name()));

    enum Mode {
        DISABLED,
        MULTIBRANCH_ONLY,
        ENABLED
    }

I understand that I could recompile and set DISABLED, but how do I pass 
that at startup?


You can either define it as a property on the Java command line that starts 
your Jenkins controller or you can set it from a system groovy script 
during Jenkins startup.

As a command line property, the command line would look like this:

# Set to DISABLED
java -Djenkins.branch.WorkspaceLocatorImpl.MODE=DISABLED -jar jenkins.war

# Set to MULTIBRANCH_ONLY
java -Djenkins.branch.WorkspaceLocatorImpl.MODE=MULTIBRANCH_ONLY   -jar 
jenkins.war

# Set to ENABLED
java -Djenkins.branch.WorkspaceLocatorImpl.MODE=ENABLED   -jar jenkins.war

As a system groovy init script, create a file in the JENKINS_HOME directory 
init.groovy.d/branch-api.groovy and use this text

import jenkins.branch.WorkspaceLocatorImpl.Mode
jenkins.branch.WorkspaceLocatorImpl.MODE = Mode.ENABLED

Mark Waite

-- 
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/277badfc-7cae-4048-995f-5f636871beban%40googlegroups.com.

Reply via email to