[JIRA] (JENKINS-39174) Help text for projectName does not describe all permitted values

2 views
Skip to first unread message

j.femia@virtalis.com (JIRA)

unread,
Oct 21, 2016, 10:02:01 AM10/21/16
to jenkinsc...@googlegroups.com
James Femia created an issue
 
Jenkins / Bug JENKINS-39174
Help text for projectName does not describe all permitted values
Issue Type: Bug Bug
Assignee: Unassigned
Components: copyartifact-plugin
Created: 2016/Oct/21 2:01 PM
Environment: Jenkins 2.19.1 LTS / Copy Artifact Plugin 1.38.1
Labels: documentation pipeline
Priority: Minor Minor
Reporter: James Femia

According to jglick in #jenkins, the projectName parameter for Copy Artifact can accept absolute and relative paths to jobs in folders.

There is no mention of this anywhere in the user-facing documentation.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

mark@rideamigos.com (JIRA)

unread,
Dec 8, 2016, 11:44:01 AM12/8/16
to jenkinsc...@googlegroups.com
Mark Stosberg commented on Bug JENKINS-39174
 
Re: Help text for projectName does not describe all permitted values

I ran into this as well and was also only able to resolve it with help from @jglick in #jenkins.

In my case, I was trying to copy artifacts from the branch of a multipline build. The Pipeline syntax generated only generated syntax that included the projectName as "My Pipeline". The correct syntax I eventually figured out was "/My Pipeline/mybranch".

jglick@cloudbees.com (JIRA)

unread,
Dec 8, 2016, 11:48:02 AM12/8/16
to jenkinsc...@googlegroups.com

Well, the syntax offered is going to depend on where you clicked the Pipeline Syntax link; it will offer a path valid from that point. In the case of a multibranch project, you probably want to run it from a sample branch project, so for example from qatest/master you could refer to dev/releases as either /dev/releases or ../../dev/releases. Just like Unix filesystem paths.

j.femia@virtalis.com (JIRA)

unread,
Dec 9, 2016, 4:09:02 AM12/9/16
to jenkinsc...@googlegroups.com

It is also important to note that if the Multibranch Pipeline is searching in branch folders with forward slashes in the sub-job names (or any other url-encodable char), it generates sub-jobs with encoded names. Copying the artifacts from these projects require you to specify the folder path, followed by the url-encoded name of the job. This is logical in terms of being able to resolve Folders containing jobs in Jenkins, but may trip you up when writing groovy.

e.g. if I have a Multibranch project called "MyBranches", with base of https://my.repo, and I tell it to search for branches in /branches/jamie/* and it finds /branches/jamie/a and /branches/jamie/b, copying artifacts from these jobs requires me to use /MyBranches/branches%2Fjamie%2Fa.

As a side node on that, unless I am using java.net.URLEncoder wrong, I have to replace the output of encode + with %20 in order for the string to match the job name.

def job_name = '/MyBranches/' + java.net.URLEncoder.encode('branches/jamie/a', 'UTF-8').replace('+', '%20')

I also did not know that the Pipeline Syntax link from different pages affected the behaviour of the snippet generator.

j.femia@virtalis.com (JIRA)

unread,
Dec 9, 2016, 4:13:01 AM12/9/16
to jenkinsc...@googlegroups.com
James Femia edited a comment on Bug JENKINS-39174
It is also important to note that if the Multibranch Pipeline is searching in branch folders with forward slashes in the sub-job names (or any other url-encodable char), it generates sub-jobs with encoded names. Copying the artifacts from these projects require you to specify the folder path, followed by the *url-encoded* name of the job. This is logical in terms of being able to resolve Folders containing jobs in Jenkins, but may trip you up when writing groovy.

e.g. if I have a Multibranch project called "MyBranches", with base of {{https://my.repo}}, and I tell it to search for branches in {{/branches/jamie/*}} and it finds {{/branches/jamie/a}} and {{/branches/jamie/b}}, copying artifacts from these jobs requires me to use {{/MyBranches/branches%2Fjamie%2Fa}}.

As a side node on that, unless I am using {{java.net.URLEncoder}} wrong, I have to replace the output of encode {{+}} with {{%20}} in order for the string to match the job name
if it has spaces in the url path .
{noformat}
def job_name = '/MyBranches/' + java.net.URLEncoder.encode('branches/jamie/
a spaces in path ', 'UTF-8').replace('+', '%20')
{noformat}

I also did not know that the *Pipeline Syntax* link from different pages affected the behaviour of the snippet generator.

smokris@softpixel.com (JIRA)

unread,
Nov 20, 2018, 12:00:02 PM11/20/18
to jenkinsc...@googlegroups.com

devld@ikedam.jp (JIRA)

unread,
Mar 7, 2020, 1:57:04 AM3/7/20
to jenkinsc...@googlegroups.com
ikedam updated Bug JENKINS-39174
 

This was fixed in copyartifact-1.42.1.

Change By: ikedam
Status: Open Fixed but Unreleased
Assignee: James Femia
Resolution: Fixed
Released As: copyartifact-1.42.1
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

devld@ikedam.jp (JIRA)

unread,
Mar 7, 2020, 1:57:05 AM3/7/20
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages