curl upload with filename in variable

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

curl upload with filename in variable

Curtis Kline-2
In my declarative pipeline Jenkinsfile, I have the following shell script line:

sh """
curl -F "status=2" -F "notify=1" -F "notes=${params.ReleaseNotes}" -F "ipa=@${env.filename}" -H "X-HockeyAppToken: 1234" https://rink.hockeyapp.net/api/2/apps/upload
"""

This does not work, because curl is apparently unable to open the file. The file clearly exists, and the env.filename variable contains the correct filename (you can see this in the console log below, as the variable has been expanded to a file name).

A snippet of my console log is below. I’ve been working on this for a number of hours, and I could use any help or advice you might have.

[Pipeline] sh[JenkinsAndroidTest] Running shell script
+ curl -F status=2 -F notify=1 -F notes= -F ipa=@Project-debug-v2.1.0-b999.apk
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (26) couldn't open file “Project-debug-v2.1.0-b999.apk
"
[Pipeline] }

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAGkg-enyw40%3DHNoD85ai%2BFemMjafkJwH9jsswGhJX-KmAr8Qig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: curl upload with filename in variable

slide
Does the file exist in what would be considered the current working directory? Perhaps an ls before the curl to verify?

On Wed, Aug 9, 2017 at 2:13 PM Curtis Kline <[hidden email]> wrote:
In my declarative pipeline Jenkinsfile, I have the following shell script line:

sh """
curl -F "status=2" -F "notify=1" -F "notes=${params.ReleaseNotes}" -F "ipa=@${env.filename}" -H "X-HockeyAppToken: 1234" https://rink.hockeyapp.net/api/2/apps/upload
"""

This does not work, because curl is apparently unable to open the file. The file clearly exists, and the env.filename variable contains the correct filename (you can see this in the console log below, as the variable has been expanded to a file name).

A snippet of my console log is below. I’ve been working on this for a number of hours, and I could use any help or advice you might have.

[Pipeline] sh[JenkinsAndroidTest] Running shell script
+ curl -F status=2 -F notify=1 -F notes= -F ipa=@Project-debug-v2.1.0-b999.apk
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (26) couldn't open file “Project-debug-v2.1.0-b999.apk
"
[Pipeline] }

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAGkg-enyw40%3DHNoD85ai%2BFemMjafkJwH9jsswGhJX-KmAr8Qig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfa%2BX14jd_4LvX1CYS_vuWRSYmvvHSh3dHjM9_ApMo5-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: curl upload with filename in variable

Curtis Kline-2
The file exists in the current working directory. This is a three-stage project with the agent declared at the global level. It's not running in a Docker container, simply on a Linux node. As a test, I included a step right before the one I mentioned:

            ls -l ${env.filename}

The results seem conclusive:

[Pipeline] sh
[JenkinsAndroidTest] Running shell script
+ ls -l Project-debug-v2.1.0-b999.apk
-rwxrwxrwx 1 jenkins jenkins 33014841 Aug  9 21:01 Project-debug-v2.1.0-b999.apk



On Wed, Aug 9, 2017 at 4:26 PM, Slide <[hidden email]> wrote:
Does the file exist in what would be considered the current working directory? Perhaps an ls before the curl to verify?

On Wed, Aug 9, 2017 at 2:13 PM Curtis Kline <[hidden email]> wrote:
In my declarative pipeline Jenkinsfile, I have the following shell script line:

sh """
curl -F "status=2" -F "notify=1" -F "notes=${params.ReleaseNotes}" -F "ipa=@${env.filename}" -H "X-HockeyAppToken: 1234" https://rink.hockeyapp.net/api/2/apps/upload
"""

This does not work, because curl is apparently unable to open the file. The file clearly exists, and the env.filename variable contains the correct filename (you can see this in the console log below, as the variable has been expanded to a file name).

A snippet of my console log is below. I’ve been working on this for a number of hours, and I could use any help or advice you might have.

[Pipeline] sh[JenkinsAndroidTest] Running shell script
+ curl -F status=2 -F notify=1 -F notes= -F ipa=@Project-debug-v2.1.0-b999.apk
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (26) couldn't open file “Project-debug-v2.1.0-b999.apk
"
[Pipeline] }

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAGkg-enyw40%3DHNoD85ai%2BFemMjafkJwH9jsswGhJX-KmAr8Qig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfa%2BX14jd_4LvX1CYS_vuWRSYmvvHSh3dHjM9_ApMo5-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAGkg-enQf5Wd00PPtkNnatYKNcmFjPDxHAoj94JakZe18U88Yg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: curl upload with filename in variable

Victor Martinez
Couple of thoughts:

- ${params.ReleaseNotes} doesn't look it got any value, then it might be one of the root causes, 
- if you use the -v flag, does it give you any details?


sh """
ls -l
${env.filename}
curl -v -F "status=2" -F "notify=1" -F "notes=${params.ReleaseNotes}" -F "ipa=@${env.filename}" -H "X-HockeyAppToken: 1234" https://rink.hockeyapp.net/api/2/apps/upload
"""


Cheers

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/b7e0a9d6-ba48-4653-9311-f0f71caec128%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: curl upload with filename in variable

Richard Bywater-2
In reply to this post by Curtis Kline-2
Taking a look at the error, it appears like you have a line feed or carriage return at the end of the env.filename variable (note the quote is on the next line and not next to apk like I'd expect). 

Richard.

On Thu, 10 Aug 2017 at 09:40 Curtis Kline <[hidden email]> wrote:
The file exists in the current working directory. This is a three-stage project with the agent declared at the global level. It's not running in a Docker container, simply on a Linux node. As a test, I included a step right before the one I mentioned:

            ls -l ${env.filename}

The results seem conclusive:

[Pipeline] sh
[JenkinsAndroidTest] Running shell script
+ ls -l Project-debug-v2.1.0-b999.apk
-rwxrwxrwx 1 jenkins jenkins 33014841 Aug  9 21:01 Project-debug-v2.1.0-b999.apk



On Wed, Aug 9, 2017 at 4:26 PM, Slide <[hidden email]> wrote:
Does the file exist in what would be considered the current working directory? Perhaps an ls before the curl to verify?

On Wed, Aug 9, 2017 at 2:13 PM Curtis Kline <[hidden email]> wrote:
In my declarative pipeline Jenkinsfile, I have the following shell script line:

sh """
curl -F "status=2" -F "notify=1" -F "notes=${params.ReleaseNotes}" -F "ipa=@${env.filename}" -H "X-HockeyAppToken: 1234" https://rink.hockeyapp.net/api/2/apps/upload
"""

This does not work, because curl is apparently unable to open the file. The file clearly exists, and the env.filename variable contains the correct filename (you can see this in the console log below, as the variable has been expanded to a file name).

A snippet of my console log is below. I’ve been working on this for a number of hours, and I could use any help or advice you might have.

[Pipeline] sh[JenkinsAndroidTest] Running shell script
+ curl -F status=2 -F notify=1 -F notes= -F ipa=@Project-debug-v2.1.0-b999.apk
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (26) couldn't open file “Project-debug-v2.1.0-b999.apk
"
[Pipeline] }

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAGkg-enyw40%3DHNoD85ai%2BFemMjafkJwH9jsswGhJX-KmAr8Qig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfa%2BX14jd_4LvX1CYS_vuWRSYmvvHSh3dHjM9_ApMo5-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAGkg-enQf5Wd00PPtkNnatYKNcmFjPDxHAoj94JakZe18U88Yg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAMui945v4%3DR_nEFBQ4PyZHN_7vVXsRqFsqEDNgp1Gi2rCd0n-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: curl upload with filename in variable

Curtis Kline-2
Richard, that was the problem. There was an extra line feed stuffed into the variable by accident.

Thanks!
Curtis


On Thu, Aug 10, 2017 at 5:16 AM, Richard Bywater <[hidden email]> wrote:
Taking a look at the error, it appears like you have a line feed or carriage return at the end of the env.filename variable (note the quote is on the next line and not next to apk like I'd expect). 

Richard.

On Thu, 10 Aug 2017 at 09:40 Curtis Kline <[hidden email]> wrote:
The file exists in the current working directory. This is a three-stage project with the agent declared at the global level. It's not running in a Docker container, simply on a Linux node. As a test, I included a step right before the one I mentioned:

            ls -l ${env.filename}

The results seem conclusive:

[Pipeline] sh
[JenkinsAndroidTest] Running shell script
+ ls -l Project-debug-v2.1.0-b999.apk
-rwxrwxrwx 1 jenkins jenkins 33014841 Aug  9 21:01 Project-debug-v2.1.0-b999.apk



On Wed, Aug 9, 2017 at 4:26 PM, Slide <[hidden email]> wrote:
Does the file exist in what would be considered the current working directory? Perhaps an ls before the curl to verify?

On Wed, Aug 9, 2017 at 2:13 PM Curtis Kline <[hidden email]> wrote:
In my declarative pipeline Jenkinsfile, I have the following shell script line:

sh """
curl -F "status=2" -F "notify=1" -F "notes=${params.ReleaseNotes}" -F "ipa=@${env.filename}" -H "X-HockeyAppToken: 1234" https://rink.hockeyapp.net/api/2/apps/upload
"""

This does not work, because curl is apparently unable to open the file. The file clearly exists, and the env.filename variable contains the correct filename (you can see this in the console log below, as the variable has been expanded to a file name).

A snippet of my console log is below. I’ve been working on this for a number of hours, and I could use any help or advice you might have.

[Pipeline] sh[JenkinsAndroidTest] Running shell script
+ curl -F status=2 -F notify=1 -F notes= -F ipa=@Project-debug-v2.1.0-b999.apk
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (26) couldn't open file “Project-debug-v2.1.0-b999.apk
"
[Pipeline] }

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAGkg-enyw40%3DHNoD85ai%2BFemMjafkJwH9jsswGhJX-KmAr8Qig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfa%2BX14jd_4LvX1CYS_vuWRSYmvvHSh3dHjM9_ApMo5-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAGkg-enQf5Wd00PPtkNnatYKNcmFjPDxHAoj94JakZe18U88Yg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAMui945v4%3DR_nEFBQ4PyZHN_7vVXsRqFsqEDNgp1Gi2rCd0n-A%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAGkg-e%3DG0o%2BzqkYmiaKBe20qzv6wDgbAdiv0bozTPwDf0Jrf_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...