Sha256: 8422061b9ee7b4f946d8bd3f8647c92e8f487b92204dacfed38929467141c4d8

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

#!/bin/bash

set -e

readonly REGISTRY="cyberark"
readonly VERSION="$(cat VERSION)"
readonly VERSION_TAG="5-${VERSION}"
readonly image_name="conjur-cli"
readonly full_image_name="${REGISTRY}/${image_name}:latest"

readonly TAGS=(
  "5"
  "5-latest"
  "$VERSION_TAG"
)

# fetching tags is required for git_description to work
git fetch --tags
git_description=$(git describe)

# if it’s not a tagged commit, VERSION will have extra junk (i.e. -g666c4b2), so we won’t publish that commit
# only when tag matches the VERSION, push VERSION and latest releases
# and x and x.y releases
#Ex: v5-6.2.1
if [ "$git_description" = "v${VERSION_TAG}" ]; then
  echo "Revision $git_description matches version $VERSION exactly. Pushing to Dockerhub..."

  for tag in "${TAGS[@]}"; do
    echo "Tagging and pushing $REGISTRY/$image_name:$tag"

    docker tag $full_image_name "$REGISTRY/$image_name:$tag"
    docker push "$REGISTRY/$image_name:$tag"
  done

  # push to legacy `conjurinc/cli5` tag
  docker tag $full_image_name conjurinc/cli5:latest
  docker push conjurinc/cli5:latest
fi

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
conjur-cli-6.2.2 push-image