task #9513
closed"table to div regression": replace scriptler + dynamic parameter plugins
100%
Description
Due to the "table to div regression" the Configure UI is completely broken after upgrade to 2.264 for jobs which are making use of the scriptler plugin. This incident has been reported as JENKINS-65030.
Note by AM: the regression is fixed since 6-2021
affected jobs¶
edit-int¶
- cdm-vaadin-HFX-START [✓]
- cdm-vaadin-DEPLOY [✓]
taxeditor-SITE-DEPLOYdynamic parameter scriptler already replaced by git-parameter- cdm-server-HFX-START [✓]
- cdm-vaadin-RLS-FINISH [✓]
- cdm-server-RLS-FINISH [✓]
- taxeditor-PROVISION [✓]
- taxeditor-RLS-FINISH [✓]
- taxeditor-HFX-START [✓]
- cdm-vaadin-HFX-FINISH - dynamic parameter with scriptler [✓] but
ScriptlerBuilder
still TODO, see below - cdm-dataportal-RLS-FINISH [✓]
- cdmlib-HFX-FINISH [✓]
- cdm-webapp-HFX-START [✓]
- taxeditor-RLS-START [✓]
- taxeditor-HFX-FINISH [✓]
- cdmlib-RLS-FINISH [✓]
- cdm-webapp-RLS-FINISH [✓]
- cdm-webapp-HFX-FINISH [✓]
- cdm-server-HFX-FINISH [✓]
TODO in the below jobs org.jenkinsci.plugins.scriptler.builder.ScriptlerBuilder
is being used to read for example the cdmlib.version
from the pom.xml and to store it in the ${WORKSPACE}/env.properties
which is read and injected as env variable in the next step.
- cdm-vaadin-HFX-FINISH [✓]
- cdm-vaadin-RLS-START [✓]
- cdm-vaadin-HFX-FINISH [✓]
- cdm-webapp-RLS-START [✓]
- cdm-server-INTEGRATION [✓]
Solution:¶
- downgrade jenkins to version 2.263 - not easy, see #note-2
- replace scripter + dynamic parameter plugins by something else. The scripter plugin has security issues and the maintained is searching for someone to adopt the plugin.
- the dynamic parameter may be replaced by the extended choice parameter plugin which also can run groovy scripts to provide the parameter list: https://stackoverflow.com/questions/24730186/jenkins-extended-parameter-plugin-groovy-script
existing groovy scripts¶
edit-int:
- getXPathSingleValue: used to read the maven version from the pom.xml, see https://www.jenkins.io/doc/pipeline/steps/pipeline-utility-steps/#code-readmavenpom-code-read-a-maven-project-file for alternatives --> can be replaced by extended-choice-parameter which also can make use of scriptler scripts. The scriptler management UI is also broken due to the "table to divs regression", therefore it seems better to simply manage the groovy scripts in a git repository.
- Git Refs Lookup: was only used in unused jobs
taxeditor-SNAPSHOT
,taxeditor-JRE-SNAPSHOT
-> jobs deleted now! - Git Tag Lookup --> can be 90% replaced by git-parameter. Limitation, the tags can only be filtered by git-show-ref patterns so more tags will be shown. This can be improved by renaming existing tags.
- GIT Branch Lookup --> can be 100% replaced by git-parameter
edit-jobber:
- cdmserver-find-last-instance: Finds the last instance in a cdmserver
- cdmserver-index-job: Triggers and monitors an index or purge job on a cdmserver for a specific instance
- cdmserver-instance-action: Allows stopping and starting a cdmserver instance.
- cdmserver-monitor-instance-status: monitors the cdmsever until the specified instace shows as specific status or if the timeout is exceeded. Returns true (success) if no instances are configured. If no status is given the script will use 'started' as default.
- cdmserver-monitor-instance-up: monitors the cdmsever until the specified instace is started up or if the timeout is exceeded. Returns true (success) if no instances are configured.
- cdmserver-monitor-up: monitor cdmsever for all instaces started up. Returns true (success) if no instances are configured.
- filtered-cdmserver-instance-names: list datasource bean names in datasources.xml as whitespace separated text (suitable for dynamic axix), the instance names listed in the filter_str are either used as include ot exclude filter depending on the value of the filter_includes parameter. If the propertiesFile parameter is specified the final instance names will be written into the property key: 'INSTANCE_NAMES'. WARNING!!! You need to use the absolute path of the file!!!!
- list-maven-version: Returns a list of all available versions of an e-taxonomy.eu artifact in the wp5.e-taxonomy.eu maven repository
plugins and options to replace existing scriptler groovy scripts:¶
git-parameter¶
xml config snippets
replace GIT Branch Lookup
<net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition plugin="git-parameter@0.9.13">
<name>BRANCH</name>
<uuid>ef8737cf-24cd-47f2-9388-17f7ae481dc4</uuid>
<type>PT_BRANCH</type>
<branch/>
<tagFilter>*</tagFilter>
<branchFilter>origin/hotfix/.*</branchFilter>
<sortMode>DESCENDING_SMART</sortMode>
<defaultValue>origin/master</defaultValue>
<selectedValue>TOP</selectedValue>
<quickFilterEnabled>true</quickFilterEnabled>
<listSize>5</listSize>
</net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition>
replace Git Tag Lookup
<net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition plugin="git-parameter@0.9.13">
<name>RELEASE_TAG</name>
<uuid>58781131-e61b-434d-9f52-42c3b89089a2</uuid>
<type>PT_TAG</type>
<branch/>
<tagFilter>*</tagFilter>
<branchFilter>.*</branchFilter>
<sortMode>DESCENDING_SMART</sortMode>
<defaultValue>origin/master</defaultValue>
<selectedValue>TOP</selectedValue>
<quickFilterEnabled>true</quickFilterEnabled>
<listSize>5</listSize>
</net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition>
extended-choice-parameter¶
NOTE:
- The script files must be located in the JENKINS_HOME folder (
/var/lib/jenkins
) otherwise they are silently ignored. - Modified scripts need to be approved: https://www.jenkins.io/doc/book/managing/script-approval/
Problems
- I could not figure out how to print log entries.
println ""
does not work as expected.
for how to use groovy scripts, see https://stackoverflow.com/questions/24730186/jenkins-extended-parameter-plugin-groovy-script#24731061
according xml snippet:
<com.cwctravel.hudson.plugins.extended__choice__parameter.ExtendedChoiceParameterDefinition plugin="extended-choice-parameter@0.82">
<name>GIT_BRANCH_GROOVY</name>
<quoteValue>false</quoteValue>
<saveJSONParameterToFile>false</saveJSONParameterToFile>
<visibleItemCount>5</visibleItemCount>
<type>PT_SINGLE_SELECT</type>
<groovyScriptFile>/var/lib/jenkins/tmp-groovy-scripts/git-branch-lookup.groovy</groovyScriptFile>
<bindings>project=taxeditor
branch_prefix=hotfix
version_regex=.*
add_default_option=
</bindings>
<groovyClasspath/>
<multiSelectDelimiter>,</multiSelectDelimiter>
<projectName>Tables to divs regression</projectName>
</com.cwctravel.hudson.plugins.extended__choice__parameter.ExtendedChoiceParameterDefinition>
groovy plugin¶
provides build steps to execute groovy scripts and script files either as isolated or system Groovy script
Differences Groovy script vs. system Groovy script
- A Groovy System Script is run inside the master's JVM, that is imports like
import hudson.model.*;
can be directly be used. For isolated Groovy scripts you do need to add the jenkins-core jar to your classpath, and the stapler jar too. - Working directory
- Groovy Script working directory
$WORKSPACE
- system Groovy Script working directory
/
- Groovy Script working directory
<builders>
<hudson.plugins.groovy.Groovy plugin="groovy@2.3">
<scriptSource class="hudson.plugins.groovy.FileScriptSource">
<scriptFile>/var/lib/jenkins/workspace/jenkins-groovy-scripts/getXPathSingleValue-args.groovy</scriptFile>
</scriptSource>
<groovyName>groovy-3.0</groovyName>
<parameters/>
<scriptParameters>pom.xml properties/cdmlib.version env.properties</scriptParameters>
<properties/>
<javaOpts/>
<classPath/>
</hudson.plugins.groovy.Groovy>
<EnvInjectBuilder plugin="envinject@2.4.0">
<info>
<propertiesFilePath>${WORKSPACE}/env.properties</propertiesFilePath>
</info>
</EnvInjectBuilder>
</builders>
Files
Related issues
Updated by Andreas Kohlbecker over 3 years ago
- Description updated (diff)
downgrading to v2.263 is not easily possible as this will require to downgrade a couple of plugins also
Updated by Andreas Kohlbecker over 3 years ago
- Subject changed from "table to div regression": replace scripter + dynamic parameter plugins to "table to div regression": replace scriptler + dynamic parameter plugins
Updated by Andreas Kohlbecker over 3 years ago
- File picture576-1.png picture576-1.png added
- Description updated (diff)
Updated by Andreas Kohlbecker over 3 years ago
- File picture324-1.png picture324-1.png added
- Description updated (diff)
Updated by Andreas Kohlbecker over 3 years ago
- Status changed from New to Resolved
- Target version deleted (
Unassigned CDM tickets) - % Done changed from 0 to 50
Updated by Andreas Kohlbecker over 3 years ago
- % Done changed from 50 to 40
Updated by Andreas Kohlbecker over 2 years ago
Dynamic Parameter Plug-in¶
edit-int
can be removed from edit-int as this plugin is no longer being used by any active job. it only is referenced in the BACKUP jobs, which can be removed:
./cdm-webapp-HFX-FINISH (BACKUP)/config.xml:35: <com.seitenbau.jenkins.plugins.dynamicparameter.scriptler.ScriptlerChoiceParameterDefinition plugin="dynamicparameter@0.2.0"> ./cdmlib-HFX-FINISH (Backup)/config.xml:17: <com.seitenbau.jenkins.plugins.dynamicparameter.scriptler.ScriptlerChoiceParameterDefinition plugin="dynamicparameter@0.2.0"> ./cdm-server_trigger_remote-INSTALL/config.xml:17: <com.seitenbau.jenkins.plugins.dynamicparameter.ChoiceParameterDefinition plugin="dynamicparameter@0.2.0"> ./cdm-vaadin-HFX-FINISH (BACKUP)/config.xml:26: <com.seitenbau.jenkins.plugins.dynamicparameter.scriptler.ScriptlerChoiceParameterDefinition plugin="dynamicparameter@0.2.0"> ./cdm-server-HFX-FINISH (Backup)/config.xml:17: <com.seitenbau.jenkins.plugins.dynamicparameter.scriptler.ScriptlerChoiceParameterDefinition plugin="dynamicparameter@0.2.0">
edit-test:
plugin used in cdmserver-INSTALL --> needs to be replaced! TODO
./cdmserver-INSTALL/config.xml:17: <com.seitenbau.jenkins.plugins.dynamicparameter.ChoiceParameterDefinition plugin="dynamicparameter@0.2.0">
edit-jobber-1:
- REINDEX-col-catalogue-services
- TRIGGER-cdmserver-reindex
- cdmserver-update
Updated by Andreas Kohlbecker over 2 years ago
- Related to task #9950: remove Scriptler Plug-in added
Updated by Andreas Kohlbecker over 2 years ago
status:
- edit-jobber-1: DONE
- edit-test: todo
- edit-int: todo
Updated by Andreas Kohlbecker over 2 years ago
status:
- edit-jobber-1: DONE
- edit-test: DONE
- edit-int: todo
Updated by Andreas Kohlbecker over 2 years ago
status:
- edit-jobber-1: DONE
- edit-test: DONE
- edit-int: DONE
Updated by Andreas Kohlbecker over 2 years ago
- Status changed from Resolved to Closed
- % Done changed from 40 to 100
Updated by Andreas Müller over 2 years ago
- Related to bug #10007: fix reindex jobs on jobber added
Updated by Andreas Müller over 2 years ago
- Related to bug #7579: Set up pipelines in Jenkins to replace the build pipelines added