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

[JENKINS-24398] Support for Token Macro Plugin in description #4

Closed

Conversation

christiangalsterer
Copy link

Supports to expansion of macros provided via the token macro plugin.
Macros are expanded only if no regex is given.

@cloudbees-pull-request-builder

plugins » description-setter-plugin #9 SUCCESS
This pull request looks good

@jenkinsadmin
Copy link
Member

Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests

@@ -47,7 +49,11 @@ public static boolean setDescription(AbstractBuild<?, ?> build,
result = build.getEnvironment(listener).expand(result);
} else {
if (result == null && regexp == null && description != null) {
result = description;
try {
result = TokenMacro.expandAll(build, listener, description);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since token-macro is only an optional plugin dependency you'll risk getting a ClassNotFoundException here.
You should maybe do an "if plugin installed" check here as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see two options here:

  1. Make the dependency to the Token Macro plugin mandatory
  2. Add a check if the plugin is installed.

I actually propose option 1 as this is the most convenient option for the user as in this case the Token Macro plugin is automatically installed if missing.

Let me know your thoughts.

@jchristi
Copy link

+1 this would be awesome to have!

@christiangalsterer
Copy link
Author

Added check if token macro plugin is installed. If token plugin is installed then macros are expanded. If not then the description is used verbatim.

@Brantone
Copy link

Looks like PR used to be legit at one point but now has conflicts? Any chance of a fix-up so this can get into a release?

@mrooney
Copy link
Member

mrooney commented Nov 2, 2016

Let's close this in favor of #11 unless anyone objects.

@mrooney mrooney closed this Nov 2, 2016
@MarkEWaite MarkEWaite added the enhancement Improvement or new feature label Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement or new feature
Projects
None yet
8 participants