-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
Jenkins 2.218
Token Macro Plugin 2.10
Delivery Pipeline Plugin 1.4.0
Amazon Elastic Container Service (ECS) / Fargate plugin 1.25
We are using delivery pipeline views, and we moved many of our build jobs to "Cloud" nodes ( ecs instances ) for which the workspace is not persisted after the build is finished.
As a result, token macro expansion is working fine during the build ( because the workspace exists ), but once the build is finished our pipeline displays un-expanded variables such as ${GIT_BRANCH} etc.
The cause is that the Token Macro plugin requires a workspace for calls to TokenUtil.expandAll() since version 2.0 .
Note that #JENKINS-40763 did a workaround for the issue: it just catches the exception raised by TokenUtils and displays the variables without expansion ( which is arguably much better than not showing a pipeline at all ).
As a workaround I did a fork which:
- updates the dependencies to TokenUtils 2.0 ( required for access to new expandAll methods )
- checks if the build has a valid workspace
- if not, create a null "VirtualChannel" FilePath and changes the call to ExpandAll
Maybe there is a better solution. I am not a java developper but the fix might be useful to others.