-
Bug
-
Resolution: Fixed
-
Major
-
Powered by SuggestiMate
Bonjour,
J'ai eu un souci lors de la montée de version du plugin "Active Choices" suite au passage de la version 2.8.1 vers la version 2.8.2.
Tous les paramètres "Active Choices Reactive Reference Parameter" ne fonctionnais plus affichant soit des messages d'erreur ou soit ceci "{}" (uniquement en utilisant le rendu HTML les autres fonctionnent bien)
J'ai donc fais un role back de la version 2.8.2 vers 2.8.1
[JENKINS-72936] HTML bug after upgrading to 2.8.2
Hi rdumolin ,
Can you please provide with a minimal example to reproduce the bug? Something like a config.xml, or detailed explanation on how to configure the parameters, including Groovy scripts, please? I'd need that in order to try to reproduce the bug on my machine, debug, and see if it's really a bug and how to fix it.
Merci!
kinow
Below is small pipeline example.
working well with version 2.8.1 but not with 2.8.2.
pipeline {
agent {
node {
label TEST
}
}
environment {
ReleaseTitle = "${ReleaseTitle}".trim()
}
~~
parameters {
activeChoice choiceType: 'PT_SINGLE_SELECT',description: 'Choose the Environment to deploy', filterLength: 1, filterable: false, name: 'ENV', randomName: 'choice-parameter-env', script: groovyScript(fallbackScript: [classpath: [], oldScript: '', sandbox: false, script: ''], script: [classpath: [], oldScript: '', sandbox: false, script: 'return["stage","prod"]'])
activeChoiceHtml choiceType: 'ET_FORMATTED_HTML', name: 'ReleaseTitle', omitValueField: true, randomName: 'choice-parameter-releasetitle', referencedParameters: 'ENV', script: groovyScript(fallbackScript: [classpath: [], oldScript: '', sandbox: false, script: ''], script: [classpath: [], oldScript: '', sandbox: false, script:
'''ReleaseTitleHtml = \'\'\'
<div style='display: flex; align-items: center;'><label for='releasetitle'></label><input id='releasetitle' name='value' type='text' style='width: 1500px;'></div>
\'\'\'
if (ENV == "prod")
{
return ReleaseTitleHtml
} else {
return "NA"
}'''])
}
~~
stages {
stage('Test') {
steps {
echo "hi"
}
}
}
}
Hi kinow ,
I just update the plugin to 2.8.2 and i got this error for variables "optionsuppbdd", "brachreference" and "dst_database"
All of these parameters are "Active Choices Reactive Reference Parameter" except "refreshbdd" and "src_database"
Choice Type : "Formatted HTML"
Groovy Sandbox :
Omit value field :
Only "Active Choices Reactive Reference Parameter" :
Here my code that works well :
versionarchioracle :
if(majbdd.equals("true")) {
def versionarchipelia_trimmed = versionarchipelia.replace(' ', '');
html =
"""
<td>
<h2><label for="name">Choix version BDD:</label><h2/>
<input type="text" class=" " id="myText" name="value" value="${versionarchipelia_trimmed}">
</tr>
"""
return html
}
if(majbdd.equals("false")) {
html1 =
"""
<td>
<h2>
<div style="border:2px dotted red;padding:2%;">
<p style="color:red;">
<label for="name">Pas de Mise à jour de BDD !</label>
<input type="hidden" class=" " id="myText" name="value" value="master-pg" disabled="disabled">
</p>
</div>
<h2/>
</tr>
"""
return html1
}
Here my code for the parameters in error :
optionsuppbdd :
if(majbdd.equals("true")) {
html = """
<label for="TEST">-from= -not-recompil --script-only</label>
<input name='value' value='' class='setting-input' type='text'>
"""
return html
}
if(majbdd.equals("false")) {
html1 =
"""
<td>
<h2>
<div style="border:2px dotted red;padding:2%;">
<p style="color:red;">
<label for="name">Pas de Mise à jour de BDD !</label>
<input type="hidden" class=" " id="myText" name="value" value="master-pg" disabled="disabled">
</p>
</div>
<h2/>
</tr>
"""
return html1
}
branchreference :
if(majbdd.equals("true")) {
html = """
<form>
<input name='value' value='master' id='master' type='radio'>
<label for="master">master</label><br>
<input name='value' value='develop' id='develop' type='radio' checked>
<label for="master">develop</label>
</form>
"""
return html
}
if(majbdd.equals("false")) {
html1 =
"""
<td>
<h2>
<div style="border:2px dotted red;padding:2%;">
<p style="color:red;">
<label for="name">Pas de Mise à jour de BDD !</label>
<input type="hidden" class=" " id="myText" name="value" value="develop" disabled="disabled">
</p>
</div>
<h2/>
</tr>
"""
return html1
}
dst_database :
if(refreshbdd =="true") {
html =
"""
<td>
<input type="text" class=" " id="myText" name="value" value="${client}" disabled>
</tr>
"""
return html
}
if(refreshbdd == "false") {
html =
"""
<td>
<h2>
<div style="border:2px dotted red;padding:2%;">
<p style="color:red;">
<label for="name">Pas de refresh BDD</label>
<input type="hidden" class=" " id="myText" name="value" value="pas de refresh" disabled="disabled">
</p>
</div>
<h2/>
</tr>
"""
return html
}
else {
html =
"""
<td>
<h2>
<div style="border:2px dotted red;padding:2%;">
<p style="color:red;">
<label for="name">Pas de refresh BDD</label>
<input type="hidden" class=" " id="myText" name="value" value="pas de refresh" disabled="disabled">
</p>
</div>
<h2/>
</tr>
"""
return html
}
When everything is ok :
Thank you in advance
Merci d'avance
Hi vjkestwal , rdumolin ,
Can you please join your web console log please ? Which web navigator do you use ?
vjkestwal your snippet works well on my side (Microsoft Edge for Business Version 122.0.2365.92) :
I did more debugging, as after initial bug had to revert plugin.
Please find update script which has issue:
Below are Console Logs for Chrome version : 123.0.6312.59
UnoChoice.js:1 Values retrieved from Referenced Parameters: Env=prod
UnoChoice.js:1 Calling Java server code to update HTML elements...
UnoChoice.js:1 Values returned from server: false,true,false,true
UnoChoice.js:1 Updating ReleaseTitle from DEPLOYONLY
UnoChoice.js:1 Values retrieved from Referenced Parameters: DEPLOYONLY=false
UnoChoice.js:1 Avoiding infinite loop due to recursion!
pipeline {
agent {
node {
label 'generic'
}
}
environment {
ReleaseTitle = "${ReleaseTitle}".trim()
}
~~
parameters {
activeChoice choiceType: 'PT_SINGLE_SELECT',description: 'Choose the Environment to deploy', filterLength: 1, filterable: false, name: 'Env', randomName: 'choice-parameter-env', script: groovyScript(fallbackScript: [classpath: [], oldScript: '', sandbox: false, script: ''], script: [classpath: [], oldScript: '', sandbox: false, script: 'return ["stage","prod"]'])
reactiveChoice choiceType: 'PT_SINGLE_SELECT',description: 'Select false - To build and deploy new image/Select true - To deploy using already relased image tag',filterLength: 1, filterable: false, name: 'DEPLOYONLY', randomName: 'choice-parameter-deployonly', referencedParameters: 'Env', script: groovyScript(fallbackScript: [classpath: [], oldScript: '', sandbox: false, script: ''], script: [classpath: [], oldScript: '', sandbox: false, script:
'''
{{ if (Env == "prod")}
return ["false","true"]
}
else {
return ["NA"]
}
'''
])
activeChoiceHtml choiceType: 'ET_FORMATTED_HTML', name: 'ReleaseTitle', omitValueField: true, randomName: 'choice-parameter-releasetitle', referencedParameters: 'DEPLOYONLY', script: groovyScript(fallbackScript: [classpath: [], oldScript: '', sandbox: false, script: ''], script: [classpath: [], oldScript: '', sandbox: false, script:
'''ReleaseTitleHtml = \'\'\'
<div style='display: flex; align-items: center;'><label for='releasetitle'></label><input id='releasetitle' name='value' type='text' style='width: 1500px;'></div>
\'\'\'
if (DEPLOYONLY == "false")
{
return ReleaseTitleHtml
} else {
return "NA"
}
'''])
~~
activeChoiceHtml choiceType: 'ET_FORMATTED_HTML', name: 'ReleaseComments', omitValueField: true, randomName: 'choice-parameter-releasecomments', referencedParameters: 'DEPLOYONLY', script: groovyScript(fallbackScript: [classpath: [], oldScript: '', sandbox: false, script: ''], script: [classpath: [], oldScript: '', sandbox: false, script:
'''ReleaseCommentsHtml = \'\'\'
<div style='display: flex; align-items: center;'><label for='releasecomment'></label><input id='releasecomment' name='value' type='text' style='width: 1500px;'></div>
\'\'\'
if (DEPLOYONLY == "false")
{
return ReleaseCommentsHtml
} else {
return "NA"
}
'''])
}
~~
stages {
stage('Test') {
steps {
echo "hi"
}
}
} ~~
}
vjkestwal the script for DEPLOYONLY is not groovy ...
try with :
''' if (Env == "prod") { return ["false","true"] } else { return ["NA"] } '''
instead of :
''' {{ if (Env == "prod")} return ["false","true"] } else { return ["NA"] } '''
for me it's still OK with 2.8.2 version and edge or chrome (123.0.6312.60)
my test pipeline :
pipeline { agent any environment { ReleaseTitle = "${ReleaseTitle}".trim() } parameters { activeChoice choiceType: 'PT_SINGLE_SELECT',description: 'Choose the Environment to deploy', filterLength: 1, filterable: false, name: 'Env', randomName: 'choice-parameter-env', script: groovyScript(fallbackScript: [classpath: [], oldScript: '', sandbox: false, script: ''], script: [classpath: [], oldScript: '', sandbox: false, script: 'return ["stage","prod"]']) reactiveChoice choiceType: 'PT_SINGLE_SELECT',description: 'Select false - To build and deploy new image/Select true - To deploy using already relased image tag',filterLength: 1, filterable: false, name: 'DEPLOYONLY', randomName: 'choice-parameter-deployonly', referencedParameters: 'Env', script: groovyScript(fallbackScript: [classpath: [], oldScript: '', sandbox: false, script: ''], script: [classpath: [], oldScript: '', sandbox: false, script: ''' if (Env == "prod") { return ["false","true"] } else { return ["NA"] } ''']) activeChoiceHtml choiceType: 'ET_FORMATTED_HTML', name: 'ReleaseTitle', omitValueField: true, randomName: 'choice-parameter-releasetitle', referencedParameters: 'DEPLOYONLY', script: groovyScript(fallbackScript: [classpath: [], oldScript: '', sandbox: false, script: ''], script: [classpath: [], oldScript: '', sandbox: false, script: ''' ReleaseTitleHtml = \'\'\' <div style='display: flex; align-items: center;'><label for='releasetitle'></label><input id='releasetitle' name='value' type='text' style='width: 1500px;'></div> \'\'\' if (DEPLOYONLY == "false") { return ReleaseTitleHtml } else { return "NA" } ''']) activeChoiceHtml choiceType: 'ET_FORMATTED_HTML', name: 'ReleaseComments', omitValueField: true, randomName: 'choice-parameter-releasecomments', referencedParameters: 'DEPLOYONLY', script: groovyScript(fallbackScript: [classpath: [], oldScript: '', sandbox: false, script: ''], script: [classpath: [], oldScript: '', sandbox: false, script: ''' ReleaseCommentsHtml = \'\'\' <div style='display: flex; align-items: center;'><label for='releasecomment'></label><input id='releasecomment' name='value' type='text' style='width: 1500px;'></div> \'\'\' if (DEPLOYONLY == "false") { return ReleaseCommentsHtml } else { return "NA" }''']) } stages { stage('Test') { steps { echo "hi" } } } }
I have the same behaviour with 2.8.1 plugin version.
Sorry I don't understand where the problem is.
Can you please join some screenshots of the problem and the wanted behaviour ?
cpottiers : in your previous comments you can see ReleaseTitle present text input box, but ReleaseComment doesn't.
Ideally both should have input box present.
I'll share more details tomorrow.
Sorry for delay.
vjkestwal unfortunately I have the same behaviour with 2.8.1 version
OK my bad it was due to "script approval", I can see both inputtext on 2.8.1 and only 1 in 2.8.2.
In console log I can see an interesting message "Avoiding infinite loop due to recursion!", but I have the same message with 2.8.1
OK found it !
kinow it's a problem between let and var...
I will make you a PR
edit : [JENKINS-72936]: Fix index.jelly for DynamicReferenceParameter by c3p0-maif · Pull Request #235 · jenkinsci/active-choices-plugin (github.com)
Fixed thanks to cpottiers ! Releasing 2.8.3 now. Should be available in a few minutes/hour.
Some informations :
Jenkins: 2.451
OS: Linux - 6.1.0-18-amd64
Java: 17.0.10 - Debian (OpenJDK 64-Bit Server VM)
—
ansible:307.va_1f3ef06575a_
ansicolor:1.0.4
antisamy-markup-formatter:162.v0e6ec0fcfcf6
apache-httpcomponents-client-4-api:4.5.14-208.v438351942757
asm-api:9.6-3.v2e1fa_b_338cd7
bootstrap5-api:5.3.3-1
bouncycastle-api:2.30.1.77-225.v26ea_c9455fd9
branch-api:2.1152.v6f101e97dd77
build-env-propagator:1.0
build-failure-analyzer:2.5.0
build-name-setter:2.4.2
build-timeout:1.32
build-user-vars-plugin:1.9
build-with-parameters:76.v9382db_f78962
buildrotator:1.2
built-on-column:1.4
caffeine-api:3.1.8-133.v17b_1ff2e0599
checks-api:2.0.2
cloudbees-folder:6.928.v7c780211d66e
command-launcher:107.v773860566e2e
commons-lang3-api:3.13.0-62.v7d18e55f51e2
commons-text-api:1.11.0-95.v22a_d30ee5d36
conditional-buildstep:1.4.3
config-file-provider:968.ve1ca_eb_913f8c
configuration-as-code:1775.v810dc950b_514
coordinator:1.5.0
credentials:1337.v60b_d7b_c7b_c9f
credentials-binding:657.v2b_19db_7d6e6d
dark-theme:439.vdef09f81f85e
discord-notifier:241.v448b_ccd0c0d6
display-url-api:2.200.vb_9327d658781
durable-task:550.v0930093c4b_a_6
echarts-api:5.5.0-1
editable-choice:71.v02a291ebbe45
email-ext:2.105
embeddable-build-status:467.v4a_954796e45d
envfile:43.v2644436e7d71
envinject:2.908.v66a_774b_31d93
envinject-api:1.199.v3ce31253ed13
extensible-choice-parameter:1.8.1
extra-columns:1.26
favorite:2.208.v91d65b_7792a_c
font-awesome-api:6.5.1-3
git:5.2.1
git-client:4.7.0
git-parameter:0.9.19
github:1.38.0
github-api:1.318-461.v7a_c09c9fa_d63
github-branch-source:1785.v99802b_69816c
gravatar:2.2
groovy:457.v99900cb_85593
gson-api:2.10.1-15.v0d99f670e0a_7
hidden-parameter:237.v4b_df26c7a_f0e
htmlpublisher:1.33
instance-identity:185.v303dc7c645f9
ionicons-api:56.v1b_1c8c49374e
jackson2-api:2.17.0-379.v02de8ec9f64c
jakarta-activation-api:2.1.3-1
jakarta-mail-api:2.1.3-1
javadoc:243.vb_b_503b_b_45537
javax-activation-api:1.2.0-6
javax-mail-api:1.6.2-9
jaxb:2.3.9-1
jdk-tool:73.vddf737284550
jenkins-multijob-plugin:627.v7c23cef20a_6a
jersey2-api:2.42-147.va_28a_44603b_d5
jjwt-api:0.11.5-77.v646c772fddb_0
joda-time-api:2.12.7-29.v5a_b_e3a_82269a_
jquery3-api:3.7.1-2
jsch:0.2.16-86.v42e010d9484b_
json-api:20240303-41.v94e11e6de726
json-path-api:2.9.0-58.v62e3e85b_a_655
junit:1265.v65b_14fa_f12f0
locale:431.v3435fa_8f8445
mailer:472.vf7c289a_4b_420
mask-passwords:173.v6a_077a_291eb_5
matrix-auth:3.2.2
matrix-project:822.824.v14451b_c0fd42
maven-plugin:3.23
metrics:4.2.21-449.v6960d7c54c69
mina-sshd-api-common:2.12.0-99.vdb_f07841c2db_
mina-sshd-api-core:2.12.0-99.vdb_f07841c2db_
multiple-scms:0.8
multiselect-parameter:1.7
node-iterator-api:55.v3b_77d4032326
nodelabelparameter:1.12.0
oic-auth:4.225.v03326773b_44b_
okhttp-api:4.11.0-172.vda_da_1feeb_c6e
pam-auth:1.10
parameter-separator:166.vd0120849b_386
parameterized-scheduler:262.v00f3d90585cc
parameterized-trigger:787.v665fcf2a_830b_
pipeline-build-step:540.vb_e8849e1a_b_d8
pipeline-github-lib:42.v0739460cda_c4
pipeline-groovy-lib:704.vc58b_8890a_384
pipeline-input-step:491.vb_07d21da_1a_fb_
pipeline-milestone-step:111.v449306f708b_7
pipeline-model-api:2.2184.v0b_358b_953e69
pipeline-model-definition:2.2184.v0b_358b_953e69
pipeline-model-extensions:2.2184.v0b_358b_953e69
pipeline-stage-step:305.ve96d0205c1c6
pipeline-stage-tags-metadata:2.2184.v0b_358b_953e69
plain-credentials:179.vc5cb_98f6db_38
plugin-util-api:4.1.0
popper2-api:2.11.6-4
postbuild-task:1.9
postbuildscript:3.2.0-550.v88192b_d3e922
prism-api:1.29.0-13
rebuild:330.v645b_7df10e2a_
resource-disposer:0.23
role-strategy:713.vb_3837801b_8cc
run-condition:1.7
schedule-build:557.va_2b_4f8544708
scm-api:689.v237b_6d3a_ef7f
script-security:1326.vdb_c154de8669
simple-theme-plugin:176.v39740c03a_a_f5
snakeyaml-api:2.2-111.vc6598e30cc65
solarized-theme:0.1
ssh-agent:346.vda_a_c4f2c8e50
ssh-credentials:326.v7fcb_a_ef6194b_
ssh-slaves:2.948.vb_8050d697fec
sshd:3.322.v159e91f6a_550
structs:337.v1b_04ea_4df7c8
syslog-logger:1.0.5
template-project:1.5.2
theme-manager:215.vc1ff18d67920
thinBackup:1.19
timestamper:1.26
token-macro:400.v35420b_922dcb_
trilead-api:2.142.v748523a_76693
uno-choice:2.8.1
validating-string-parameter:183.v3748e79b_9737
variant:60.v7290fc0eb_b_cd
view-job-filters:369.ve0513a_a_f5524
vsphere-cloud:2.27
workflow-aggregator:596.v8c21c963d92d
workflow-api:1291.v51fd2a_625da_7
workflow-basic-steps:1049.v257a_e6b_30fb_d
workflow-cps:3889.v937e0b_3412d3
workflow-durable-task-step:1331.vc8c2fed35334
workflow-job:1400.v7fd111b_ec82f
workflow-multibranch:783.va_6eb_ef636fb_d
workflow-scm-step:427.v4ca_6512e7df1
workflow-step-api:657.v03b_e8115821b_
workflow-support:881.v7663695646cf
ws-cleanup:0.45