1

I have a script which contains:

TEST=`curl -v  -X GET http://xxx/v2/${PROJECT}/${IMAGE}/manifests/${DCD}`
TEST2="curl -v  -XGET http://xxx/v2/${PROJECT}/${IMAGE}/manifests/${DCD}"
echo "output"
echo ${TEST}
echo "output2"
echo ${TEST2}

This is the output of TEST and TEST1:

* Illegal characters found in URL
* Closing connection -1
output
        ##empty
output2
curl -v -XGET http://xxx:5000/v2/proj1/base/manifests/sha256:a1f97fd03ec62888fb315745cde69acb7c98d0fae7xxx

If I copy the content of the output2 (curl -v...) and execute it than it works fine (that is what I try to do in output1). So it seems that the command is filled in correctly. But The execution of that command (what happens in output1) seems to fail with: Illegal character found in URL.

I really don't have a clue what is going wrong

Whole content of script with cat -A

#!/bin/sh$
#ENV VAR to set in Jenkins Job$
PROJECT="proj1"$
IMAGE="base"$
TAG="1.2"$
$
# Find Docker-Content-Digest$
DCD=`curl -v -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -X GET http://xxx:5000/v2/${PROJECT}/${IMAGE}/manifests/${TAG} 2>&1 | grep Docker-Content-Digest | awk '{print ($3)}'`$
$
# Delete tag in registry using DCD$
# I just want to execute the command belowe but gave the illegal argument erros so tried some debugging with this$
TEST=`curl -v -X GET http://xxx:5000/v2/${PROJECT}/${IMAGE}/manifests/${DCD}`$
$
TEST2="curl -v -XGET http://xxx:5000/v2/${PROJECT}/${IMAGE}/manifests/${DCD}"$
echo "output"$
echo ${TEST}$
echo "output2"$
echo ${TEST2}$
$
DenCowboy
  • 13,884
  • 38
  • 114
  • 210

1 Answers1

1

The solution was to add:

DCD=${DCD%$'\r'}

After the command DCD=`curl -v...

So it seemed to be a duplicate of this question.

Community
  • 1
  • 1
DenCowboy
  • 13,884
  • 38
  • 114
  • 210