-
Notifications
You must be signed in to change notification settings - Fork 27
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
Return stdout of command #11
Comments
I reduced the scope to the stdout of the command since I know that Jenkins doesn't really support handling the stderr of command executions. |
+1 here with another use case description in case it either (a) helps rationalize and scope the feature, or (b) leads to a recommended workaround. A running Pipeline job needs to either execute a
Seems unfortunate that the CLI has no --output argument to direct it to send output to a specific destination. I suppose that would be redundant with shell redirection but would allow solving this use case without changing the return type, although I'd much rather see an option like |
Does anyone happen to know where Jenkins' code base keeps the implementation of built-in steps like I'm not aware of any steps other than If that's true, then it might be relatively straightforward to pitch a PR by following that sh's implementation as an example, but I seem to be looking for a needle in a haystack to that end... |
I have also been looking for ages but unfortunately never found it. Should you be more successful in the search I would be very happy about the info 😄
AFAIK, you always must do a "switch case" depending on the runner OS, e.g. for windows it is bat and not sh. But these APIs also support returning stdout. Edit |
We're using a
which isn't valid JSON lol. We're skipping over that line for now, but it is indeed an awful hack. Support for this use case would be very nice. |
Seconding this PR. Would find this feature very useful for my purposes. |
I assumed this "feature" would be among the most basic criteria for a plugin like this, but apparently it wasn't ever a requirement to assert the output of the command itself? What this plugin is in it's current state: A "jf-cli installer" distribution plugin w/ a poorly implemented This needs work. |
@g3n35i5 @zphixon @john-heinnickel @nickheyer @wxm809 The syntax remains the same as suggested in this issue: script {
String result = jf 'rt search --count <repository>/<file>'
echo result
} To clarify – whether or not the output is captured, it will still be logged in the job output. Please let us know if this behavior is not optimal for you. @nickheyer
Could you please elaborate on each point in as much detail as possible? Your input is invaluable for us in implementing these enhancements. If possible, please open a new issue for each one at https://github.com/jfrog/jenkins-jfrog-plugin/issues. |
@yahavi thanks for fixing this. is there a new release/tag planned that includes this fix? |
@deekue @zphixon @g3n35i5 @nickheyer The Jenkins JFrog plugin version 1.5.7 has been released. This version allows capturing the JFrog CLI output. Here's the syntax: script {
String version = jf '-v'
echo "JFrog CLI version output: $version"
} You can learn more about this feature in the documentation: Capturing the output of JFrog CLI commands. Feel free to upgrade, and we would appreciate your feedback on this! |
Is your feature request related to a problem? Please describe.
I'm trying to evaluate whether an artifact already exists on the repository I'm trying to upload to. To do so, I thought of using the
jf rt search
command, but as far as I can see, the the function is a void function.Describe the solution you'd like to see
Return
stdout
of executed command so that it can be stored/interpreted in the following way (Jenkins declarative pipeline example):Describe alternatives you've considered
Since the
jf
execution is printed to the job's log, I could parse the log instead (or at least the last N lines). But this approach seems to be very hacky...The text was updated successfully, but these errors were encountered: