12
12
13
13
set -e
14
14
15
- # Update README file in Docker hub.
16
- push_readme () {
17
- declare -r image=" ${1} "
18
- declare -r token=" ${2} "
19
- declare -r input_file=" ${3} "
20
-
21
- if [[ ! -r $input_file ]]; then
22
- echo " file $input_file is not readable"
23
- exit 1
24
- fi
25
-
26
- local code=$( curl -s -o /dev/null -L -w " %{http_code}" \
27
- -X PATCH \
28
- --data-urlencode full_description@${input_file} \
29
- -H " Content-Type: application/json" \
30
- -H " Authorization: JWT ${token} " \
31
- ${API_URL} /repositories/" ${image} " /)
32
-
33
- if [[ " ${code} " = " 200" ]]; then
34
- echo " Successfully pushed README to Docker Hub"
35
- else
36
- printf " Unable to push README to Docker Hub, response code: %s\n" " ${code} "
37
- exit 1
38
- fi
39
- }
40
-
41
15
echo " Running linter"
42
16
docker run --rm -i hadolint/hadolint:2.6.0 < Dockerfile || exit 1
43
17
@@ -119,17 +93,4 @@ if [ -n "$DOCKER_PASSWORD" -a -n "$DOCKER_USERNAME" -a -n "$TAGS" ]; then
119
93
echo " Pushing Docker image for tag $tag "
120
94
docker push $IMAGE :$tag
121
95
done
122
- fi
123
-
124
- # Update README and badge only for release builds.
125
- if [[ -n $OPENGROK_TAG ]]; then
126
- TOKEN=$( curl -s -H " Content-Type: application/json" -X POST \
127
- -d ' {"username": "' ${DOCKER_USERNAME} ' ", "password": "' ${DOCKER_PASSWORD} ' "}' \
128
- ${API_URL} /users/login/ | jq -r .token)
129
- if [[ -z $TOKEN ]]; then
130
- echo " Cannot get auth token to publish the README file"
131
- exit 1
132
- fi
133
-
134
- push_readme " ${IMAGE} " " ${TOKEN} " " docker/README.md"
135
- fi
96
+ fi
0 commit comments