[JIRA] (JENKINS-61056) Env variable expansion in tasks of builds without a workspace is broken since TokenUtils 2.0

5 views
Skip to first unread message

olivier.schiavo@mybestpro.com (JIRA)

unread,
Feb 11, 2020, 10:01:08 AM2/11/20
to jenkinsc...@googlegroups.com
Olivier Schiavo created an issue
 
Jenkins / Improvement JENKINS-61056
Env variable expansion in tasks of builds without a workspace is broken since TokenUtils 2.0
Issue Type: Improvement Improvement
Assignee: Patrik Boström
Components: delivery-pipeline-plugin
Created: 2020-02-11 15:00
Environment: Jenkins 2.218
Token Macro Plugin 2.10
Delivery Pipeline Plugin 1.4.0
Amazon Elastic Container Service (ECS) / Fargate plugin 1.25
Priority: Minor Minor
Reporter: Olivier Schiavo

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.

https://github.com/openwengo/delivery-pipeline-plugin/commit/39ed9ca0f5349423d0e5e5ab86692854c2d33af1

 

 

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

olivier.schiavo@mybestpro.com (JIRA)

unread,
Apr 25, 2020, 11:07:03 AM4/25/20
to jenkinsc...@googlegroups.com
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages