GithubHelp home page GithubHelp logo

jenkinsci / parameter-separator-plugin Goto Github PK

View Code? Open in Web Editor NEW
13.0 103.0 13.0 578 KB

Jenkins plugin that allows users to add UI separators to help organize build parameters into sections

Home Page: https://plugins.jenkins.io/parameter-separator/

License: MIT License

Java 88.73% HTML 4.81% JavaScript 4.29% Groovy 2.17%
ui parameter jenkins-plugin jenkins

parameter-separator-plugin's Introduction

Parameter Separator Plugin

Build Status Coverage LOC Jenkins Plugin GitHub Release Jenkins Plugin Installs

Introduction

This is a simple plugin for Jenkins CI that allows one to clearly differentiate sets of parameters on a job build page. This can be useful for jobs with lots of parameters.

Specifically, the plugin creates a stylizable separator that consists of <hr /> tag with an optional section header. The styling of both the horizontal rule and the section header can be customized, both globally and for each individual separator.

Example "Build with Parameters" page with separators

Installing and configuring the plugin

Install this plugin from the Jenkins Update Center. Go to Manage Jenkins -> Plugin Manager -> Available tab. Search for "Parameter Separator".

Configure default styling for your parameters in the Jenkins global configuration page. Go to Manage Jenkins -> Configure System -> "Parameter Separator" section.

Using the plugin in freestyle jobs

Go to you job Configure page and add any number of parameter separator elements:

Optionally you can use HTML, customize styles, and click Preview to see how it will look:

Now, go to you job's Build with Parameters page. You'll see you parameter groups nicely separated:

When your build is ready and you go to its Parameters section, you'll also see separators:

Using in pipeline jobs

Note: It's recommended to provide an explicit name for each separator parameter, when using in pipeline. Otherwise, it will be redefined under a new random name during each build, which can cause some minor issues. For example, the "Job Configuration History" plugin will indicate that each has changed job configuration.


Example usage in declarative pipeline

pipeline {
	agent any
	parameters {
		separator(name: "building")
		choice(name: "java_vendor", choices: "Corretto")
		choice(name: "java_version", choices: "11")
		separator(name: "testing")
		choice(name: "browser", choices: "chrome")
		separator(name: "end")
	}
	stages {
		stage("Build") {
			steps {
				echo "Building using ${params.java_vendor}-${params.java_version}"
			}
		}
	}
}


Example usage in scripted pipeline, with section headers

properties([
	parameters([
		separator(name: "BUILD_ENVIRONMENT", sectionHeader: "Build Environment"),
		choice(name: "JAVA_VENDOR", choices: ["Coretto"]),
		choice(name: "JAVA_VERSION", choices: ["11"]),
		separator(name: "TEST_ENVIRONMENT", sectionHeader: "Test Environment"),
		choice(name: "OS", choices: ["Linux"]),
		choice(name: "BROWSER", choices: ["Chrome"])
	])
])


Example usage in scripted pipeline, with advanced custom styling

properties([
	parameters([
		separator(name: "BUILD_ENVIRONMENT", sectionHeader: "Build Environment",
			separatorStyle: "border-width: 0",
			sectionHeaderStyle: """
				background-color: #7ea6d3;
				text-align: center;
				padding: 4px;
				color: #343434;
				font-size: 22px;
				font-weight: normal;
				text-transform: uppercase;
				font-family: 'Orienta', sans-serif;
				letter-spacing: 1px;
				font-style: italic;
			"""
		),
		choice(name: "JAVA_VENDOR", choices: ["Coretto"]),
		choice(name: "JAVA_VERSION", choices: ["11"]),
		separator(name: "TEST_ENVIRONMENT", sectionHeader: "Test Environment",
			separatorStyle: "border-width: 0",
			sectionHeaderStyle: """
				background-color: #dbdb8e;
				text-align: center;
				padding: 4px;
				color: #343434;
				font-size: 22px;
				font-weight: normal;
				text-transform: uppercase;
				font-family: 'Orienta', sans-serif;
				letter-spacing: 1px;
				font-style: italic;
			"""
		),
		choice(name: "OS", choices: ["Linux"]),
		choice(name: "BROWSER", choices: ["Chrome"])
	])
])

parameter-separator-plugin's People

Contributors

ace-han avatar dependabot[bot] avatar github-actions[bot] avatar jlleitschuh avatar jonesbusy avatar mikec-bullhorn avatar olhado avatar pit3k avatar sghill-rewrite avatar t-8ch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

parameter-separator-plugin's Issues

Parameter separator is throwing an exception

Jenkins and plugins versions report

Environment
Paste the output here

What Operating System are you using (both controller, and any agents involved in the problem)?

Amzon Linux

Reproduction steps

I installed the plugin on version 1.3 on 2 different Jenkins (2.387.3 and 2.319) on the first one it is working and on the second one I am getting an exception

Expected Results

I should have a parameter separator in both envs.

Actual Results

getting an exception
My Jenkins pipeline is failing with the following

java.lang.IllegalArgumentException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.jenkinsci.plugins.structs.describable.Setter$1.set(Setter.java:33)
at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:429)
at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:331)
Caused: java.lang.IllegalArgumentException: Could not instantiate {name=RLC_MODE, defaultValue=null, description=Enable for MC to work in RLC mode.} for hudson.model.BooleanParameterDefinition
at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:334)
at org.jenkinsci.plugins.structs.describable.UninstantiatedDescribable.instantiate(UninstantiatedDescribable.java:208)
at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:466)
at org.jenkinsci.plugins.structs.describable.DescribableModel.coerceList(DescribableModel.java:585)
at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:458)
at org.jenkinsci.plugins.structs.describable.DescribableModel.buildArguments(DescribableModel.java:409)
at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:329)
Caused: java.lang.IllegalArgumentException: Could not instantiate {parameterDefinitions=[{$class=ParameterSeparatorDefinition, name=SEP_NODES, sectionHeader=Working Nodes, separatorStyle=

Anything else?

The RLC_MODE is not an actual error. when I remove the parameter separator it is working. this is the beginning of the Jenkinsfile:

separatorStyle = '''
border: none;
'''

sectionHeaderStyle = '''
color: navy;
font-family: Roboto, sans-serif !important;
font-size: 20px;
padding: 5px;
text-align: left;
border-bottom: 1px solid navy;
'''
properties([
parameters([
[
$class: 'ParameterSeparatorDefinition',
name: 'SEP_NODES',
sectionHeader: 'Working Nodes',
separatorStyle: separatorStyle ,
sectionHeaderStyle: sectionHeaderStyle
],

Are you interested in contributing a fix?

No response

Expand/collapse sections

What feature do you want to see added?

In our CI there are some necessary but rarely used sections, and the interface will be much neater if those sections are collapsed. I am wondering if it is possible to add this feature where a section is expanded/collapsed by clicking the separator.

Upstream changes

No response

Are you interested in contributing this feature?

No response

Missing tests

What feature do you want to see added?

This plugin doesn't have any test.

Implement better test coverage

Upstream changes

No response

Are you interested in contributing this feature?

No response

Update documentation

Describe your use-case which is not covered by existing documentation.

Make sure the documentation is up-to-date and screenshots refreshed with modern Jenkins

Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.

No response

Are you interested in contributing to the documentation?

No response

Following the upgrade of Jenkins, where the "Parameter Separator" plugin was updated from version 1.0 to 1.3, we've encountered issues regarding the presentation of parameters.

Jenkins and plugins versions report

Jenkins: 2.361.4
OS: Linux - 4.14.328-248.540.amzn2.x86_64
Java: 11.0.21 - Amazon.com Inc. (OpenJDK 64-Bit Server VM)

ace-editor:1.1
ansicolor:1.0.2
ant:481.v7b_09e538fcca
antisamy-markup-formatter:1.8
apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61
artifact-manager:202401.0.0
artifactory:4.0.0
authentication-tokens:1.4
bitbucket:223.vd12f2bca5430
bootstrap5-api:5.2.1-3
bouncycastle-api:2.27
branch-api:2.1071.v1a_188a_562481
build-timeout:1.24
build-user-vars-plugin:1.9
build-with-parameters:76.v9382db_f78962
buildparameters:202401.0.0
caffeine-api:2.9.3-65.v6a_47d0f4d1fe
checks-api:1.8.1
cloudbees-folder:6.758.vfd75d09eea_a_1
command-launcher:90.v669d7ccb_7c31
commons-lang3-api:3.13.0-62.v7d18e55f51e2
commons-text-api:1.10.0-68.v0d0b_c439292b_
conditional-buildstep:1.4.2
config-file-provider:3.11.1
copyartifact:1.48
credentials:1189.vf61b_a_5e2f62e
credentials-binding:523.525.vb_72269281873
customview:202401.0.0
data-tables-api:1.12.1-4
description-setter:1.10
display-url-api:2.200.vb_9327d658781
docker-commons:1.21
docker-workflow:1.28
durable-task:507.v050055d0cb_dd
echarts-api:5.4.0-1
email-ext:2.92
envinject:2.901.v0038b_6471582
envinject-api:1.199.v3ce31253ed13
extended-choice-parameter:359.v35dcfdd0c20d
external-monitor-job:203.v683c09d993b_9
filesystem_scm:2.1
flyway-runner:1.9
font-awesome-api:6.2.1-1
generic-webhook-trigger:1.86.4
ghprb:1.42.2
git:4.14.3
git-client:3.13.1
git-server:99.va_0826a_b_cdfa_d
github:1.36.1
github-api:1.303-400.v35c2d8258028
github-branch-source:1696.v3a_7603564d04
gitlab-plugin:1.6.0
gradle:2.9
groovy-events-listener-plugin:1.019
handlebars:3.0.8
hidden-parameter:0.0.5
htmlpublisher:1.31
http_request:1.16
icon-shim:3.0.0
instance-identity:185.v303dc7c645f9
ionicons-api:56.v1b_1c8c49374e
ivy:2.4
jackson2-api:2.14.2-319.v37853346a_229
jakarta-activation-api:2.0.1-3
jakarta-mail-api:2.0.1-3
javadoc:226.v71211feb_e7e9
javax-activation-api:1.2.0-5
javax-mail-api:1.6.2-8
jaxb:2.3.7-1
jdk-tool:63.v62d2fd4b_4793
jersey2-api:2.37-1
jjwt-api:0.11.5-77.v646c772fddb_0
job-dsl:1.81.1
jquery:1.12.4-1
jquery-detached:1.2.1
jquery-ui:1.0.2
jquery3-api:3.6.1-2
jsch:0.2.8-65.v052c39de79b_2
junit:1166.1168.vd6b_8042a_06de
ldap:659.v8ca_b_a_fe79fa_d
lockable-resources:1069.v726298f53f8c
mailer:448.v5b_97805e3767
mapdb-api:1.0.9-28.vf251ce40855d
mask-passwords:3.3
matrix-auth:3.1.5
matrix-project:785.v06b_7f47b_c631
maven-plugin:3.22
mercurial:1260.vdfb_723cdcc81
mina-sshd-api-common:2.11.0-86.v836f585d47fa_
mina-sshd-api-core:2.11.0-86.v836f585d47fa_
momentjs:1.1.1
nodejs:1.5.1
okhttp-api:4.9.3-108.v0feda04578cf
ownership:0.13.0
pam-auth:1.10
parameter-separator:1.3
parameterized-trigger:2.45
pipeline-aws:1.43
pipeline-build-step:488.v8993df156e8d
pipeline-github-lib:36.v4c01db_ca_ed16
pipeline-graph-analysis:202.va_d268e64deb_3
pipeline-input-step:466.v6d0a_5df34f81
pipeline-milestone-step:111.v449306f708b_7
pipeline-model-api:2.2121.vd87fb_6536d1e
pipeline-model-declarative-agent:1.1.1
pipeline-model-definition:2.2081.v3919681ffc1e
pipeline-model-extensions:2.2121.vd87fb_6536d1e
pipeline-rest-api:2.29
pipeline-stage-step:305.ve96d0205c1c6
pipeline-stage-tags-metadata:2.2121.vd87fb_6536d1e
pipeline-stage-view:2.29
pipeline-utility-steps:2.15.0
plain-credentials:143.v1b_df8b_d3b_e48
plugin-util-api:2.20.0
popper2-api:2.11.6-2
rebuild:1.34
resource-disposer:0.20
role-strategy:587.588.v850a_20a_30162
run-condition:1.5
s3:0.12.3445.vda_704535b_5a_d
scm-api:631.v9143df5b_e4a_a
scoring-load-balancer:1.0.1
script-security:1229.v4880b_b_e905a_6
scriptler:3.1
sidebar-link:2.2.2
simple-theme-plugin:160.vb_76454b_67900
snakeyaml-api:1.33-90.v80dcb_3814d35
sonar:2.15
ssh-agent:333.v878b_53c89511
ssh-credentials:305.v8f4381501156
ssh-slaves:2.854.v7fd446b_337c9
sshd:3.270.vb_a_e71e64c287
structs:324.va_f5d6774f3a_d
subversion:2.17.1
testng-plugin:700.va_ea_5873a_3399
timestamper:1.16
token-macro:321.vd7cc1f2a_52c8
trilead-api:2.84.v72119de229b_7
uno-choice:2.2.2
validating-string-parameter:2.8
variant:59.vf075fe829ccb
windows-slaves:1.8.1
workflow-aggregator:578.vf9a_f99755f4a_
workflow-api:1200.v8005c684b_a_c6
workflow-basic-steps:994.vd57e3ca_46d24
workflow-cps:3536.vb_8a_6628079d5
workflow-cps-global-lib:581.ve633085a_8a_87
workflow-durable-task-step:1217.v38306d8fa_b_5c
workflow-job:1268.v6eb_e2ee1a_85a
workflow-multibranch:716.vc692a_e52371b_
workflow-scm-step:408.v7d5b_135a_b_d49
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:839.v35e2736cfd5c
ws-cleanup:0.43

What Operating System are you using (both controller, and any agents involved in the problem)?

Linux: centos

Reproduction steps

upgrade jenkins from 2.332.3 version to 2.361.4

Expected Results

before upgrade upgrade results are in attached screenshot

Actual Results

before upgrade upgrade results are in attached screenshot

Anything else?

how to fix this issues to reflect changes as earlier and we are using below html code.

Source Control

These fields are used to determine which revision or version of your VisualizerTM app will be built and the credentials that will be used to pull it from the repository where you've stored it.

To determine which version of your Visualizer app to build, use this field to specify a branch, release tag or commit Id in the repository where your source code is stored. To do this Quantum recommends the following options:

screenshot for reference:

before upgrade:
image

post upgrade:
image

Are you interested in contributing a fix?

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.