-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-34617] Add a @Symbol for "extendedChoice" #25
Conversation
This allows extendedChoice() to be used in the parameters block of a declarative pipeline.
Can the value attribute be "calculated" as the result of a groovy script? :) From a shared library? |
@agray I don't know. I just tried this patch and used |
@rodrigc would be a great feature to add that has been missing from declarative pipelines (AFAIK). Happy for someone to tell me if such functionality exists elsewhere to extend this lack of functionality in choice() parameter. |
I wonder when this functionality will be available for the wide public? |
@zentavr I emailed the plugin maintainer about this plugin. He did not respond yet |
@oleg-nenashev I wonder how the PR gets accepted in this organization? |
@zentavr PRs are being accepted and released by the plugin maintainers. If there is no active plugin maintainers, there is an adoption process: https://wiki.jenkins.io/display/JENKINS/Adopt+a+Plugin . If anyone is interested to get this fix out of the door, please feel free to request ownership of the plugin. |
I forked this repo and did a build with this patch here. Testing that locally now. |
Works like a charm! :)
|
I've been waiting for this for a while hope it gets merged soon, I will use the patch for now Thanks!!! |
When I tried to use the above code, I have got the following error, java.lang.NoSuchMethodError: No such DSL method 'extendedChoice' found among steps [ansiColor, ansiblePlaybook, ansibleVault, archive, bat, build, catchError, checkout, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, dockerNode, echo, emailext, emailextrecipients, envVarsForTool, error, fileExists, getContext, git, input, isUnix, jiraComment, jiraIssueSelector, jiraSearch, junit, library, libraryResource, load, lock, mail, milestone, node, parallel, powershell, properties, publishHTML, pwd, readFile, readTrusted, resolveScm, retry, script, sh, slackSend, sleep, sshagent, stage, stash, step, svn, timeout, timestamps, tm, tool, unarchive, unstash, validateDeclarativePipeline, waitUntil, withContext, withCredentials, withDockerContainer, withDockerRegistry, withDockerServer, withEnv, wrap, writeFile, ws] or symbols [all, allOf, always, ant, antFromApache, antOutcome, antTarget, any, anyOf, apiToken, architecture, archiveArtifacts, artifactManager, attach, authorizationMatrix, batchFile, bitbucket, booleanParam, branch, brokenBuildSuspects, brokenTestsSuspects, buildButton, buildDiscarder, buildingTag, caseInsensitive, caseSensitive, certificate, changeRequest, changelog, changeset, checkoutToSubdirectory, choice, choiceParam, cleanWs, clock, cloud, command, credentials, cron, crumb, culprits, defaultView, demand, developers, disableConcurrentBuilds, disableResume, docker, dockerCert, dockerfile, downloadSettings, downstream, dumb, durabilityHint, envVars, environment, equals, expression, file, fileParam, filePath, fingerprint, frameOptions, freeStyle, freeStyleJob, fromScm, fromSource, git, github, githubPush, gradle, headRegexFilter, headWildcardFilter, hyperlink, hyperlinkToModels, inheriting, inheritingGlobal, installSource, isRestartedRun, jdk, jdkInstaller, jgit, jgitapache, jnlp, jobName, label, lastDuration, lastFailure, lastGrantedAuthorities, lastStable, lastSuccess, legacy, legacySCM, list, local, location, logRotator, loggedInUsersCanDoAnything, masterBuild, maven, maven3Mojos, mavenErrors, mavenMojos, mavenWarnings, modernSCM, myView, newContainerPerStage, node, nodeProperties, nonInheriting, nonStoredPasswordParam, none, not, overrideIndexTriggers, paneStatus, parallelsAlwaysFailFast, parameters, password, pattern, permanent, pipeline-model, pipelineTriggers, plainText, plugin, pollSCM, preserveStashes, projectNamingStrategy, proxy, queueItemAuthenticator, quietPeriod, rateLimitBuilds, recipients, remotingCLI, requestor, run, runParam, schedule, scmRetryCount, scriptApprovalLink, search, security, shell, skipDefaultCheckout, skipStagesAfterUnstable, slackNotifier, slave, sourceRegexFilter, sourceWildcardFilter, ssh, sshUserPrivateKey, stackTrace, standard, status, string, stringParam, swapSpace, tag, text, textParam, tmpSpace, toolLocation, triggeredBy, unsecured, upstream, upstreamDevelopers, usernameColonPassword, usernamePassword, viewsTabBar, weather, withAnt, zfs, zip] or globals [currentBuild, docker, env, params, pipeline, scm] Looks like Jenkins doesnt support this function yet.? |
@dilipdesing - you can try the compiled version. Use my link above. |
@zentavr I'm going to try to obtain write permissions to this plugin: jenkins-infra/repository-permissions-updater#1081 |
@vimil - do we expect a new build soon? |
yes I have released version 0.78 which has the requested changes. My email in github was outdated which is why I couldn't respond sooner. |
@vimil Thanks! |
@vimil If possible please update your contact email in GitHub to one that is accurate. |
do you know if a newer plugin version will be available from Jenkins including this commit? I see that in the Jenkins Plugin Manager latest version is 1.6.0 while this project has 0.78 (including this commit). |
@andreatera you are confusing extended choice plugin and extensible choice plugin, this page is for extended choice plugin and the latest version is 0.78. The extensible choice plugin latest version is 1.6.0 |
@afrancoc2000 aaah that's why 😄 sorry but I was confused by latest post on this page: https://wiki.jenkins.io/display/JENKINS/Extensible+Choice+Parameter+plugin Thanks a lot! |
When configured manually in the UI the bindings passed to groovy contains the Job under key @zentavr where is your property |
I've installed No signature of method: javaposse.jobdsl.dsl.helpers.BuildParametersContext.extendedChoice() is applicable for argument types: (java.util.LinkedHashMap) values: [[defaultValue:One,Two,Three,Four, description:Some description, ...]] This is my file parameters {
stringParam('GIT_REPO',"my-repo",'xxx')
stringParam('GIT_BRANCH',"master",'xxx')
extendedChoice(
defaultValue: 'One,Two,Three,Four',
description: 'Some description',
multiSelectDelimiter: ',',
name: 'SAMPLE_EXTENDED_CHOICE',
quoteValue: false,
saveJSONParameterToFile: false,
type: 'PT_CHECKBOX',
value:'One,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten',
visibleItemCount: 10
)
} Any ideas how do debug this or maybe I am missing something? |
@vikas027 It works fine here with jenkins version |
@cheryPeng - Sorry, I do not have my old environment to test it now but I remember, I did checked the |
same as for @vikas027 dsl:
extendedChoice() returns if i use extendedChoice{}, it requires all of the fields to be set, which is definately not a proper behaviour: |
Also seeing the same error for using extendedChoice() using version 0.78 on jenkins versions 2.204.5. |
Also seeing the same error for using extendedChoice() using version 0.78 on jenkins version 2.255 |
Error still exist in 0.82 version |
Sorry, but it does not work for me at all. :(. Can you actually define extendedChoice parameter via JobDSL? |
yes, actually you can. Here's complete example how to fetch available versions from JFrog Artifactory via groovy script:
|
i am getting the same error. Any suggestions, what could be the issue? |
Hi, I had a same problem like in quoted post. But I found useful post on job-dsl-plugin github. When you will face some of these errors, try to look to your jenkins dsl plugin api definition. When I followed the defined structure its works. In "job/parameters" section you can find all parameters from installed jenkins plugins. extendedChoice included. |
any update ?
extendedChoice(
name: 'severity2',
value: 'UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL',
defaultValue: 'HIGH,CRITICAL',
quoteValue: false,
visibleItemCount: 5,
description: 'scan level',
type: 'PT_MULTI_SELECT',
multiSelectDelimiter: ','
), log:
|
This allows extendedChoice() to be used in the parameters
block of a declarative pipeline.
For example: