Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update-description needs to update the call to DockerHub API #138

Closed
zigarn opened this issue Jul 13, 2022 · 1 comment · Fixed by #147
Closed

update-description needs to update the call to DockerHub API #138

zigarn opened this issue Jul 13, 2022 · 1 comment · Fixed by #147

Comments

@zigarn
Copy link

zigarn commented Jul 13, 2022

Orb version

2.1.2

What happened

update-description doesn't work anymore.

According to documentation and docker/hub-feedback#2127 (comment) the endpoint is only working with JSON payload and not x-www-form-urlencoded anymore.

Expected behavior

Update command to use JSON payload.

zigarn added a commit to Zenika-Training/ztraining2strigo that referenced this issue Jul 13, 2022
@zigarn
Copy link
Author

zigarn commented Jul 13, 2022

Something like this could fix:

diff --git c/src/scripts/update-description.sh i/src/scripts/update-description.sh
index a1006c9..80cbb22 100644
--- c/src/scripts/update-description.sh
+++ i/src/scripts/update-description.sh
@@ -13,7 +13,7 @@ PAYLOAD="username=$USERNAME&password=$PASSWORD"
 JWT=$(curl -s -d "$PAYLOAD" https://hub.docker.com/v2/users/login/ | jq -r .token)
 HEADER="Authorization: JWT $JWT"
 URL="https://hub.docker.com/v2/repositories/$PARAM_IMAGE/"
-STATUS=$(curl -s -o /dev/null -w '%{http_code}' -X PATCH -H "$HEADER" --data-urlencode full_description@$DESCRIPTION $URL)
+STATUS=$(curl -s -o /dev/null -w '%{http_code}' -X PATCH -H "$HEADER" -H 'Content-type: application/json' --data "{\"full_description\": $(jq -Rs '.' $DESCRIPTION)}" $URL)
 
 if [ $STATUS -ne 200 ]; then
   echo "Could not update image description"

But it depends on jq, which is available in cimg/* docker images but not necessarily in all executors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant