Skip to content

Commit e8ba77c

Browse files
author
Vladimir Kotal
committed
fix and simplify README update procedure
1 parent b699311 commit e8ba77c

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

dev/docker.sh

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
# These are set via https://travis-ci.com/OpenGrok/docker/settings
1111
#
1212

13-
set -x
1413
set -e
1514

15+
API_URL="https://hub.docker.com/v2"
1616
IMAGE="opengrok/docker"
1717

1818
if [[ -n $TRAVIS_TAG ]]; then
@@ -97,13 +97,11 @@ push_readme() {
9797
exit 1
9898
fi
9999

100-
local code=$(jq -n --arg msg "$(<${input_file})" \
101-
'{"registry":"registry-1.docker.io","full_description": $msg }' | \
102-
curl -s -o /dev/null -L -w "%{http_code}" \
103-
https://cloud.docker.com/v2/repositories/"${image}"/ \
104-
-d @- -X PATCH \
105-
-H "Content-Type: application/json" \
106-
-H "Authorization: JWT ${token}")
100+
local code=$(curl -s -o /dev/null -L -w "%{http_code}" \
101+
-X PATCH --data-urlencode \
102+
full_description@${input_file} \
103+
-H "Authorization: JWT ${token}" \
104+
${API_URL}/repositories/"${image}"/)
107105

108106
if [[ "${code}" = "200" ]]; then
109107
echo "Successfully pushed README to Docker Hub"
@@ -115,7 +113,7 @@ push_readme() {
115113

116114
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST \
117115
-d '{"username": "'${DOCKER_USERNAME}'", "password": "'${DOCKER_PASSWORD}'"}' \
118-
https://hub.docker.com/v2/users/login/ | jq -r .token)
116+
${API_URL}/users/login/ | jq -r .token)
119117
if [[ -z $TOKEN ]]; then
120118
echo "Cannot get auth token to publish the README file"
121119
exit 1

0 commit comments

Comments
 (0)