diff --git a/ci/steps/push-docker-manifest.sh b/ci/steps/push-docker-manifest.sh index 62ac0317..e866e606 100755 --- a/ci/steps/push-docker-manifest.sh +++ b/ci/steps/push-docker-manifest.sh @@ -1,6 +1,17 @@ #!/usr/bin/env bash set -euo pipefail +# See if this version already exists on Docker Hub. +function version_exists() { + local output + output=$(curl --silent "https://index.docker.io/v1/repositories/codercom/code-server/tags/$VERSION") + if [[ $output == "Tag not found" ]]; then + return 1 + else + return 0 + fi +} + # Import and push the Docker image for the provided arch. push() { local arch=$1 @@ -26,6 +37,11 @@ main() { cd "$(dirname "$0")/../.." source ./ci/lib.sh + if version_exists; then + echo "$VERSION is already pushed" + return + fi + download_artifact release-images ./release-images if [[ ${CI-} ]]; then echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin