From a842d95435d0e0fbdfa721050862221ccf1735d8 Mon Sep 17 00:00:00 2001 From: Tomer Figenblat Date: Sat, 11 Apr 2020 00:19:33 +0300 Subject: [PATCH] Fixed docker hub description pushing. --- .github/CONTRIBUTING.md | 1 - .github/workflows/release.yml | 7 ++++ Makefile | 3 -- VERSION | 2 +- shellscripts/push-docker-description.sh | 51 ------------------------- 5 files changed, 8 insertions(+), 56 deletions(-) delete mode 100644 shellscripts/push-docker-description.sh diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8657cd7d..f858a8e2 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -65,7 +65,6 @@ docker-tag-latest: add latest tag before pushing the latest version docker-run: run the built image as a container (must be built first). docker-build-and-run: build image from Dockerfile and run as container. docker-build-no-cache-and-run: build image from Dockerfile with no caching and run as container. -push-description: push the relative README.md file as full description to docker hub, requires username and password arguments verify-environment-file: verify the existence of the required environment variables file. ``` diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aafadc96..988ed9e5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,3 +37,10 @@ jobs: tags: latest,${{ steps.getSemver.outputs.semver }} # yamllint disable-line rule:line-length build_args: VCS_REF=$GITHUB_SHA,BUILD_DATE=${{ steps.getDate.outputs.date }},VERSION=${{ steps.getSemver.outputs.semver }} + + - name: Update docker hub description + uses: peter-evans/dockerhub-description@v2 + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} + DOCKERHUB_REPOSITORY: tomerfi/switcher_webapi diff --git a/Makefile b/Makefile index 5900f731..a56417b9 100644 --- a/Makefile +++ b/Makefile @@ -97,9 +97,6 @@ docker-build-and-run: docker-build docker-run docker-build-no-cache-and-run: ## build image from Dockerfile with no caching and run as container. docker-build-no-cache-and-run: docker-build-no-cache docker-run -push-description: ## push the relative README.md file as full description to docker hub, requires username and password arguments - sh shellscripts/push-docker-description.sh $(strip $(username)) $(strip $(password)) $(strip $(IMAGE_NAME)) - verify-environment-file: ## verify the existence of the required environment variables file. ifndef CONF_DEVICE_IP_ADDR $(error Mandatory configuration value CONF_DEVICE_IP_ADDR was not provided, can't run container.) diff --git a/VERSION b/VERSION index 0d91a54c..9e11b32f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.0 +0.3.1 diff --git a/shellscripts/push-docker-description.sh b/shellscripts/push-docker-description.sh deleted file mode 100644 index ecb5adf0..00000000 --- a/shellscripts/push-docker-description.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -# push-docker-description.sh -# -# Script to push the content of README.md as Description to Docker Hub using Docker Registry HTTP API V2. -# Pass docker-hub user name as first argument, -# Pass docker-hub password as second argument. -# Pass image name including namespace but with no tags as the third and final argument. - -display_usage() { - echo "please provide username, password and image name as arguments." - echo -e "please note, there is no need for any image tags, just the namespace and name.\n" - echo "usage: $0 dockhub_username dockhub_password namespace/image_name" -} - - -if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] -then - display_usage - exit 1 -fi - -token=$(curl -s -X POST \ - -H "Content-Type: application/json" \ - -d '{"username": "'"$1"'", "password": "'"$2"'"}' \ - https://hub.docker.com/v2/users/login/ | jq -r .token) - -if [ -z "$token" ] -then - echo "Failed retrieving token from the registry api, please check username and password." - exit 1 -else - echo "Got token." -fi - -code=$(jq -n --arg msg "$(