cloudfoundry/stratos

View on GitHub
deploy/ci/tasks/dev-releases/check-gh-release.yml

Summary

Maintainability
Test Coverage
---
platform: linux
inputs:
- name: stratos
- name: image-tag
image_resource:
  type: docker-image
  source:
   # Generated using scripts/Dockerfile.stratos-ci
   repository: ghcr.io/cf-stratos/stratos-ci-concourse

run:
  path: sh
  args:
    - -exc
    - |
      # Check that the Github release DOES NOT exist
      ROOT_DIR=${PWD}
      STRATOS=${ROOT_DIR}/stratos
      source "${STRATOS}/deploy/ci/tasks/dev-releases/vars-helper.sh"

      source ${STRATOS}/deploy/ci/tasks/dev-releases/github-helper.sh

      # Check tagged release version is consistent with package.json version
      TAG_RELEASE_VERSION=$(echo ${LATEST_TAG} | cut -d"-" -f1)
      if [ "${TAG_RELEASE_VERSION}" != "${VERSION}" ]; then
        echo "Package.json version is not consistent with tag release version! ${TAG_RELEASE_VERSION} != ${VERSION}"
        exit 1
      fi
      cd ${ROOT_DIR}/stratos

      # Check that the release exists
      set +e
      github-release info -t ${RELEASE_TAG}
      RETVAL=$?
      set -e

      if [ $RETVAL -eq 0 ]; then
        echo "Aborting... release already exists"
        exit 1
      fi

      echo "Release does not exist.. OK"