0

Below is my code.

I am trying to use a value in subsequent curl command. But the URL value is empty.

       ASSETURL="$$(curl -X GET -H "Authorization: token ${GHE_TOKEN_FIPS}" "https://github.xxx.com/api/v3/repos/test-registry/base/releases/latest" | jq -r '.assets[0].url')"
        @echo "$${ASSETURL}"
        @echo $${ASSETURL}
        curl -H "Authorization: token ${GHE_TOKEN_FIPS}" -H "Accept: application/octet-stream" -L $$ASSETURL > base.image

In console I see

0.23s$ make $MAKE_TASK
++jq -r '.assets[0].url'
++curl -X GET -H 'Authorization: token [secure]' https://github.xxx.com/api/v3/repos/test-registry/base/releases/latest
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6951  100  6951    0     0  73946      0 --:--:-- --:--:-- --:--:-- 73946
+ASSETURL=https://github.xxx.com/api/v3/repos/test-registry/base/releases/assets/1255


curl -H "Authorization: token [secure]" -H "Accept: application/octet-stream" -L $ASSETURL > base.image
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
make: *** [Makefile:92: fipsserver] Error 2
The command "make $MAKE_TASK" exited with 2.

I tried many options nut definitely not the correct one!! Any help to fix this. What am I missing here

ambikanair
  • 4,004
  • 11
  • 43
  • 83

1 Answers1

0

; helped to fix the issue.

ASSETURL="$$(curl -X GET -H "Authorization: token ${GHE_TOKEN_FIPS}" "https://github.xxx.com/api/v3/repos/test-registry/base/releases/latest" | jq -r '.assets[0].url')" ; \
        @echo "$${ASSETURL}" ; \
        @echo $${ASSETURL} ; \
        curl -H "Authorization: token ${GHE_TOKEN_FIPS}" -H "Accept: application/octet-stream" -L $$ASSETURL > base.image
ambikanair
  • 4,004
  • 11
  • 43
  • 83