-
Notifications
You must be signed in to change notification settings - Fork 11
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 junit test for stash file parameter #7
Conversation
Signed-off-by: olivier lamy <[email protected]>
Signed-off-by: olivier lamy <[email protected]>
Signed-off-by: olivier lamy <[email protected]>
Signed-off-by: olivier lamy <[email protected]>
Signed-off-by: olivier lamy <[email protected]>
Signed-off-by: olivier lamy <[email protected]>
Signed-off-by: olivier lamy <[email protected]>
@jglick please have a look there is a bit of testing and documentation. |
Signed-off-by: olivier lamy <[email protected]>
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.
Stuff to work with here. I would want to do some fixups before merging.
As to a release, I think it is prudent to look into input
/ build
first. Also there is an unimplemented method. Need to look over the list of outstanding items, implement the easy ones, and refile the rest as GH issues.
src/main/java/io/jenkins/plugins/file_parameters/Base64FileParameterDefinition.java
Outdated
Show resolved
Hide resolved
README.md
Outdated
stages { | ||
stage('Example') { | ||
steps { | ||
withFileParameter('FILE') { |
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.
IIRC Declarative supports using block-scoped steps in an option
block. Does it work here?
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.
yep it works
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.
But you prefer to demonstrate using a block-scoped step inside steps
?
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.
uhm I missed that one but I'm not sure what sort of syntax you mean?
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.
Something like
pipeline {
agent any
parameters {
base64File(name: 'FILE')
}
options {
withFileParameter('FILE')
}
stages {
stage('x') {
steps {
sh 'cat $FILE'
}
}
}
}
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.
Bug in Declarative it seems: https://issues.jenkins.io/browse/JENKINS-64761
src/test/java/io/jenkins/plugins/file_parameters/FileParameterWrapperTest.java
Show resolved
Hide resolved
src/test/java/io/jenkins/plugins/file_parameters/FileParameterWrapperTest.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Jesse Glick <[email protected]>
Co-authored-by: Jesse Glick <[email protected]>
Co-authored-by: Jesse Glick <[email protected]>
…ameterDefinition.java Co-authored-by: Jesse Glick <[email protected]>
Co-authored-by: Jesse Glick <[email protected]>
…WrapperTest.java Co-authored-by: Jesse Glick <[email protected]>
Signed-off-by: olivier lamy <[email protected]>
@jglick looks good to me to look into |
README.md
Outdated
stages { | ||
stage('Example') { | ||
steps { | ||
withFileParameter('FILE') { |
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.
But you prefer to demonstrate using a block-scoped step inside steps
?
src/test/java/io/jenkins/plugins/file_parameters/FileParameterWrapperTest.java
Outdated
Show resolved
Hide resolved
…WrapperTest.java Co-authored-by: Jesse Glick <[email protected]>
Signed-off-by: olivier lamy <[email protected]>
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.
Sorry I must have been tired!
src/main/java/io/jenkins/plugins/file_parameters/StashedFileParameterDefinition.java
Outdated
Show resolved
Hide resolved
src/main/java/io/jenkins/plugins/file_parameters/StashedFileParameterDefinition.java
Outdated
Show resolved
Hide resolved
@@ -4,7 +4,7 @@ | |||
pipeline { | |||
agent any | |||
parameters { | |||
stashed64File(name: 'FILE-STASH') | |||
stashedBase64File(name: 'FILE-STASH') |
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.
stashedBase64File(name: 'FILE-STASH') | |
stashedFile(name: 'FILE-STASH') |
or, if it works,
stashedBase64File(name: 'FILE-STASH') | |
stashedFile 'FILE-STASH' |
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.
simple syntax not working
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.
addressed in another PR
src/test/java/io/jenkins/plugins/file_parameters/FileParameterWrapperTest.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Jesse Glick <[email protected]>
…rameterDefinition.java Co-authored-by: Jesse Glick <[email protected]>
Co-authored-by: Jesse Glick <[email protected]>
Signed-off-by: olivier lamy <[email protected]>
Signed-off-by: olivier lamy <[email protected]>
Signed-off-by: olivier lamy <[email protected]>
Signed-off-by: olivier lamy <[email protected]>
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.
Sorry the back-and-forth across time zones is a little crazy!
src/main/resources/io/jenkins/plugins/file_parameters/Base64FileParameterDefinition/help.html
Outdated
Show resolved
Hide resolved
src/test/java/io/jenkins/plugins/file_parameters/FileParameterWrapperTest.java
Outdated
Show resolved
Hide resolved
src/test/java/io/jenkins/plugins/file_parameters/FileParameterWrapperTest.java
Outdated
Show resolved
Hide resolved
src/test/java/io/jenkins/plugins/file_parameters/FileParameterWrapperTest.java
Outdated
Show resolved
Hide resolved
README.md
Outdated
stages { | ||
stage('Example') { | ||
steps { | ||
withFileParameter('FILE') { |
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.
Something like
pipeline {
agent any
parameters {
base64File(name: 'FILE')
}
options {
withFileParameter('FILE')
}
stages {
stage('x') {
steps {
sh 'cat $FILE'
}
}
}
}
src/main/resources/io/jenkins/plugins/file_parameters/Base64FileParameterDefinition/help.html
Outdated
Show resolved
Hide resolved
src/main/resources/io/jenkins/plugins/file_parameters/Base64FileParameterDefinition/help.html
Outdated
Show resolved
Hide resolved
src/main/resources/io/jenkins/plugins/file_parameters/Base64FileParameterDefinition/help.html
Outdated
Show resolved
Hide resolved
src/main/resources/io/jenkins/plugins/file_parameters/StashedFileParameterDefinition/help.html
Outdated
Show resolved
Hide resolved
src/main/resources/io/jenkins/plugins/file_parameters/StashedFileParameterDefinition/help.html
Outdated
Show resolved
Hide resolved
Signed-off-by: olivier lamy <[email protected]>
…WrapperTest.java Co-authored-by: Jesse Glick <[email protected]>
…WrapperTest.java Co-authored-by: Jesse Glick <[email protected]>
…leParameterDefinition/help.html Co-authored-by: Jesse Glick <[email protected]>
…ileParameterDefinition/help.html Co-authored-by: Jesse Glick <[email protected]>
…WrapperTest.java Co-authored-by: Jesse Glick <[email protected]>
Signed-off-by: olivier lamy <[email protected]>
Signed-off-by: olivier lamy <[email protected]>
Co-authored-by: Jesse Glick <[email protected]>
Signed-off-by: olivier lamy <[email protected]>
no worries especially with adding weekend, public holidays etc... 😄 |
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.
Enough to merge, but I have various follow-ups and corrections.
- [ ] inline help text | ||
- [ ] `withFileParameter` compatibility | ||
- [X] inline help text | ||
- [X] `withFileParameter` compatibility (manual test) |
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.
If you are using withFileParameter
then you are not supposed to need unstash
(and vice-versa).
- [ ] inline help text | ||
- [ ] `withFileParameter` compatibility | ||
- [X] inline help text | ||
- [X] `withFileParameter` compatibility (manual test) |
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.
- [X] `withFileParameter` compatibility (manual test) | |
- [ ] `withFileParameter` compatibility |
@@ -0,0 +1,19 @@ | |||
<div> | |||
<p>File parameter compatible with Pipeline but this one stash the file and must be used to handle bug files, how to use it in a declarative pipeline:</p> |
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.
<p>File parameter compatible with Pipeline but this one stash the file and must be used to handle bug files, how to use it in a declarative pipeline:</p> | |
<p>File parameter compatible with Pipeline but this one stash the file and must be used to handle big files, how to use it in a declarative pipeline:</p> |
" stage('Example') {\n" + | ||
" steps {\n" + | ||
" withFileParameter('FILE') {\n" + | ||
" echo(/loaded '${readFile(FILE).toUpperCase(Locale.ROOT)}' from $FILE/) \n" + |
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.
BTW while sh 'cat $FILE'
is most realistic for docs, I prefer readFile
for functional tests because it requires no special work to pass on Windows.
r.assertLogContains("loaded 'UPLOADED CONTENT HERE'", b); | ||
} | ||
|
||
@Test public void stashed() throws Exception { |
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.
Fine but it is not using FileParameterWrapper
so does not belong here. (Unless the two are made to be compatible and the test made to exercise that.)
r.assertLogContains("loaded 'UPLOADED CONTENT HERE'", b); | ||
} | ||
|
||
@Test public void stashedDeclarativeParameterCreated() throws Exception { |
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.
Ditto.
No description provided.