-
Notifications
You must be signed in to change notification settings - Fork 54
Add nonStoredPassword symbol for Pipeline syntax #102
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
Add nonStoredPassword symbol for Pipeline syntax #102
Conversation
Jenkins Symbol Annotation: Official Guide: https://www.jenkins.io/doc/developer/extensibility/extension-points/#symbol Javadoc: https://javadoc.jenkins.io/jenkins/Symbol.html > The @symbol annotation allows Jenkins Pipeline DSL to reference extensions using a short, memorable name rather than the full class name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the addition. Please provide tests that confirm the newly added symbol works as expected in declarative Pipeline and scripted Pipeline.
Can you expand on what you'd like to see exactly outside of what I've provided? |
Sure. I'd like to see a test that refers to the new symbol in a sample declarative Pipeline and confirms that the sample declarative Pipeline runs successfully twice. The first run defines the parameter for the job and the second run accepts the parameter. Examples of that type of test are available at:
I'd like a test that refers to the new symbol in a sample scripted Pipeline and confirms that the sample scripted Pipeline runs successfully twice. The first run defines the parameter for the job and the second run accepts the parameter. An example of that type of test is available at: |
|
I added a DeclarativePipelineTest.java. To be honest, I struggled with the scripted side. Perhaps this is something that I'm not understanding correctly, but the purpose of using Symbol is to create an alias that works with the declarative syntax so that you aren't forced into using a scripted approach to the parameters instead. I did do this (but didn't merge it here): https://github.com/niklucas/mask-passwords-plugin-symbol/blob/scripted-test/src/test/java/com/michelin/cio/hudson/plugins/passwordparam/ScriptedPipelineTest.java but I can't really use nonStoredPassword() from @symbol instead of the |
I think you may have a syntax error in your scripted Pipeline. The following worked for me: Please also include documentation in the README that describes why someone would use a non-stored password and how it is different from other uses. |
|
Thanks! I've updated both to add the scripted test and the README. |
MarkEWaite
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good to me. I've made changes that allow the tests to pass on my local development environment.
|
Can I be removed from this github repo's admin, I'm not contributing to
this anymore
…On Thu, Oct 23, 2025 at 7:20 PM Mark Waite ***@***.***> wrote:
***@***.**** approved this pull request.
The change looks good to me. I've made changes that allow the tests to
pass on my local development environment.
—
Reply to this email directly, view it on GitHub
<#102 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABV4VKTURSDTBNBOCYD7U4L3ZGEFDAVCNFSM6AAAAACJMGVVBCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTGNZUGAYTAOJQHE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***
com>
|
I don't see any indication that you are an administrator of this repository. Can you explain why you believe you are an administrator of this repository? |
The @symbol annotation allows Jenkins Pipeline DSL to reference extensions using a short, memorable name rather than the full class name. This allows easy access to set parameter values in declarative syntax without having to use the full class name.
Problem:
It's not possible to declare the class via the simple parameters syntax in DSL:
Trying to use the DSL syntax showed that we didn't have a short name available:
/var/lib/jenkins/jobs/Library/jobs/11/libs/f486e69665525f717055921d8bb70c1a3309ae0625efc0ba5cc2d8e5ba4ba64d/vars/test.groovy: 70: Invalid parameter type "nonStoredPassword". Valid parameter types: [activeChoice, reactiveChoice, activeChoiceHtml, base64File, booleanParam, buildSelector, choice, credentials, extendedChoice, file, gitParameter, jiraIssue, jiraReleaseVersion, listGitBranches, text, password, run, stashedFile, string] @ line 70, column 13.
10:00:58 nonStoredPassword(name: 'token', description: 'Token value')
10:00:58 ^
10:00:58
10:00:58 1 error
Change
Simply imports Symbol and adds @symbol with a short name for use on the class.
Testing done
Built the plugin locally.
Loaded the locally built plugin to Jenkins UI
Ran a test pipeline with
nonStoredPassword(name: 'token', description: 'Token value')inparameters {}Confirmed that build worked successfully and supplied the password appropriately. (i.e. I no longer got the above error messages which prevented the pipeline from even starting):
Also confirmed that the UI automatically set the Non Stored Password parameter for future builds of that pipeline:

Submitter checklist