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

Improve pipeline enablement and making it optional #80

Closed
ssbarnea opened this issue Oct 6, 2016 · 10 comments
Closed

Improve pipeline enablement and making it optional #80

ssbarnea opened this issue Oct 6, 2016 · 10 comments
Labels
feature request ✨ New feature to be added

Comments

@ssbarnea
Copy link

ssbarnea commented Oct 6, 2016

Now using Jenkins pipelines is becoming the norm instead of the weird-use-case and we do need an improved way to enable the AnsiColorBuildWrapper.

Have a look at the Timestamper plugin which now supports the nice DSL syntax:

timestamps {
    // code goes here
    }

To make the usage even better I would like to be able to have some kind of condition: if ansi plugin is present enable it, or continue if not.

With these two small additions we could write much better Jenkins pipelines and we would avoid unpleasant surprises if it happens to have the plugin not installed. Build will continue, which is much better than having it broken because the ansicolor plugin was missing.

PS. Please mind that's possible for the plugin to be broken at some point and that's why is much better not to break continuity and continue to work without the feature. Optionally we could throw a warning message, but what matters is to avoid breakages.

@dblock
Copy link
Member

dblock commented Oct 6, 2016

This sounds reasonable, please feel free to contribute.

@dblock dblock added the feature request ✨ New feature to be added label Oct 6, 2016
@JeanMertz
Copy link

JeanMertz commented Oct 15, 2016

Quick question:

Why should I as a Jenkinsfile maintainer be concerned about enabling/disabling color output?

Shouldn't this plugin simply be activated on the server-side, and "just work" for any pipelines running, with or without color output?

My frame of reference here is all the other hosted CI solutions out there (Travis, CircleCI, etc, etc) that have colouring "enabled by default", I've never seen any ci-specific file in a GitHub project that explicitly enabled colouring, not even just "enable/disable for this project", let alone "enable for this line".

I'm sure I'm missing some technical context on why this is ill-adviced/difficult, but I'm looking at it from an end-user perspective.

@dblock
Copy link
Member

dblock commented Oct 17, 2016

@JeanMertz I think this is purely historical. IMO this should be the default and available with the default Jenkins distribution.

@DenizThatMenace
Copy link

A nice side-effect of this feature-request would be:

A DSL, similar to the one of Timestamper, would also enable using the ANSIcolor plugin outside of node-blocks. (See this Timestamper issue for some explaining comments.)

@markhu
Copy link

markhu commented Nov 4, 2016

To put a finer point on @JeanMertz comment: Is there either a way to simply turn on AnsiColor with a checkbox in the UI instead of code in Jenkinsfile? We'd want both an Admin way to set that as the default, and a user-way of toggling the checkbox per job.

@dblock
Copy link
Member

dblock commented Nov 7, 2016

I believe #83 closes this, can someone please try?

@cpoenisch
Copy link
Contributor

My PR allows to use a simpler Pipeline syntax without the need for the build wrapper. But makes the usage not optional depending on whether the plugin is installed or not. In negative case you will always get java.lang.NoSuchMethodError: No such DSL method 'ansiColor' found among steps...
So either put your formatted content inside the ansiColor step or just log as plain text.

@DenizThatMenace
Copy link

I can confirm, that the new syntax works, even without a surrounding node.

@dblock
Copy link
Member

dblock commented Nov 8, 2016

Should this be closed?

@subos2008
Copy link

@dblock yes, I think reading through it that the OP's request is satisfied. There is also the request from @markhu that we have a way to enable this globally (which I am 100% in favour of) but that was already requested separately in [https://github.com//issues/2]

@dblock dblock closed this as completed Mar 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request ✨ New feature to be added
Projects
None yet
Development

No branches or pull requests

7 participants