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
Allow TokenMacro in Stash server URL Fixes [JENKINS-31117] #153
Conversation
The diff looks weird. Could you please rebase your changes on the latest |
@scaytrase Sorry about that. I fixed the history. |
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.
Generally looks ok, small fixes requested. I'll test is as soon as I can
private String expandStashURL(Run<?, ?> run, final TaskListener listener) { | ||
String url = stashServerBaseUrl; | ||
DescriptorImpl descriptor = getDescriptor(); | ||
if ("".equals(url) || url == null) { |
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.
should this be (url == null || url.isEmpty() )
as same as above changes?
if ("".equals(url) || url == null) | ||
url = descriptor.getStashRootUrl(); | ||
|
||
final Item project, |
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.
indentation
PrintStream logger = listener.getLogger(); | ||
logger.println("Unable to expand Stash Server URL"); | ||
ex.printStackTrace(logger); | ||
} |
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.
indentation
@scaytrase . I reformatted the file as requested. It still looks a bit off in the diff, but looks ok in NetBeans. |
Unfortunatelly I cannot make it working. I've tried the following example withEnv(["STASH_URL=https://my.local.server"]) {
sh "echo $STASH_URL"
step([$class: 'StashNotifier', projectKey:"test", stashServerBaseUrl:'$STASH_URL']) // Notifies the Stash Instance of the build result
} also tried
Can you provide me an example, how can I put the URL into pipeline to make it being expanded as token? |
Non-pipeline job is failing expanding token too. Configuring it with |
Hi @scaytrase I'm running it right now on my production server with the following config and it works: |
@scaytrase Only variables created in the Pre-Build and Post-Build are available to a post-build process. That is a limitation of Jenkins. If your test case created the variable during the build it will be lost when the post build process executes. That is why in my example the SHA1 is saved to a properties file. The injected variable was no longer accessible. |
@mdkf managed to get it working with classic builds and evaluated groovy script of But cannot get a pipeline working with it. Can you help me with a sample? |
Hi @scaytrase . I have never used pipeline. From the docs, it seems there are some known issues with EnvInject and pipelines: https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin#EnvInjectPlugin-JenkinsPipeline |
@mdkf thanks for investigation, I think I've to merge it as is, since everything else works OK Thank you! |
Thanks! |
Fixes https://issues.jenkins-ci.org/browse/JENKINS-31117 aka #139
Uses latest Parent POM
Fixes some FindBugs warnings