Skip to content
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

pipeline:create-execution: Write execution id to stdout #224

Open
kwin opened this issue Feb 23, 2021 · 11 comments
Open

pipeline:create-execution: Write execution id to stdout #224

kwin opened this issue Feb 23, 2021 · 11 comments
Labels
help wanted Extra attention is needed

Comments

@kwin
Copy link
Contributor

kwin commented Feb 23, 2021

It is useful to have the id of the newly created execution id available in the stdout (for non-interactive use cases).
This is not the case for

cli.action.stop(`started execution ID ${result.id}`)
as the spinner is overwriting output in stdout.

The only way to get hold of the output is via the {{-a}} option: https://github.com/wblachowski/cm-jenkins-helpers/blob/7762702130cec073abddef51eb4268a8d28465bd/jenkins-config/pipelines/pipeline-cm-deploy.Jenkinsfile#L14

The return value of of the run method is not evaluated. A table should be emitted similar to what is done in

. That way both json and regular format could be supported.

@justinedelson
Copy link
Member

I don't know that the table is the right output in this case, but this seems to be a macro case of a broader issue where the commands should all support a non-interactive mode. The effect of that will vary, but certainly the spinners in general should not be output in a non-interactive mode.

I don't really understand that use case though -- why isn't the Jenkins plugin being used?

@justinedelson justinedelson added the help wanted Extra attention is needed label Feb 23, 2021
@kwin
Copy link
Contributor Author

kwin commented Feb 23, 2021

why isn't the Jenkins plugin being used?

Are you referring to https://plugins.jenkins.io/adobe-cloud-manager/? This does not support Jenkins Pipelines and only the request to trigger a new execution (without waiting for it).

I also considered using https://github.com/adobe/aio-lib-java-cloudmanager in a shared library, but this just doesn't seem mature enough yet and also Jenkins is advocating against executing too much with Groovy (https://www.jenkins.io/doc/book/pipeline/pipeline-best-practices/#making-sure-to-use-groovy-code-in-pipelines-as-glue). Therefore I decided to go with calling aio-cli-plugin-cloudmanager from Jenkins.

@justinedelson
Copy link
Member

justinedelson commented Feb 23, 2021

Are you referring to https://plugins.jenkins.io/adobe-cloud-manager/? This does not support Jenkins Pipelines and only the request to trigger a new execution (without waiting for it).

Yes, this seems like a better solution IMO if the use case is specifically to Jenkins. I don't know what is necessary to support Jenkins Pipelines in that plugin but I assume that would be the proper place for it.

@kwin
Copy link
Contributor Author

kwin commented Feb 23, 2021

https://plugins.jenkins.io/adobe-cloud-manager/ is not based on https://github.com/adobe/aio-lib-java-cloudmanager and also has no issue tracker, therefore it is close to impossible to collaborate. Also this does not rely on any Adobe libraries but just the swagger definition to build its own client. Therefore I came to the conclusion to disregard this approach/plugin.

@justinedelson
Copy link
Member

It actually looks like it was moved over in December: jenkinsci/adobe-cloud-manager-plugin#1

Agree that no issues is an interesting project choice... I created jenkinsci/adobe-cloud-manager-plugin#2 (using PRs as a issues workaround)

@kwin
Copy link
Contributor Author

kwin commented Feb 23, 2021

@kwin
Copy link
Contributor Author

kwin commented Feb 23, 2021

One further question before I come up with PRs for the Jenkins Plugin: Is that now maintained by Adobe or by Perficient? Who is responsible for pushing out releases in the future. Given that the last release is 1 year old gives me the impression that the plugin is pretty dead.

@justinedelson
Copy link
Member

As I understand it, it is a community project with participants from both Perficient and Adobe. I do not know the full backstory, but I assume it is where it is because that is what works best for Jenkins plugins.

@kwin
Copy link
Contributor Author

kwin commented Mar 21, 2021

It doesn't seem that there is much going forward with the Jenkins plugin. Would you consider including a patch which just fixes the issue for create-execution for now (i.e. set a proper exit code and don't use animations for non-interactive usage via a dedicated flag)?

@kwin
Copy link
Contributor Author

kwin commented Mar 21, 2021

I found a workaround:
The actionType simple is used by cli-ux automatically in case the environment variable CI is set (https://github.com/oclif/cli-ux/blob/6dfa79da103cc608dc1b7b4790eb1a084c435c5b/src/config.ts#L20). In addition you have to be aware of the fact the the action gives out by default to stderr instead of stdout (https://github.com/oclif/cli-ux/blob/6dfa79da103cc608dc1b7b4790eb1a084c435c5b/src/action/base.ts#L30) so you have to make sure to capture stderr.

@justinedelson
Copy link
Member

@kwin my preference would be to have a generic --non-interactive flag and have that work consistently across commands. But starting with one or two commands would be fine with me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants