make_tarball.sh 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/bash
  2. #
  3. # Licensed to the Apache Software Foundation (ASF) under one or more
  4. # contributor license agreements. See the NOTICE file distributed with
  5. # this work for additional information regarding copyright ownership.
  6. # The ASF licenses this file to You under the Apache License, Version 2.0
  7. # (the "License"); you may not use this file except in compliance with
  8. # the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. set -e
  19. usage() {
  20. echo "usage: make_tarball.sh <SUPERSET_VERSION> <SUPERSET_RC> <PGP_KEY_FULLBANE>"
  21. }
  22. if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
  23. if [ -z "${SUPERSET_VERSION}" ] || [ -z "${SUPERSET_RC}" ] || [ -z "${SUPERSET_PGP_FULLNAME}" ] || [ -z "${SUPERSET_RELEASE_RC_TARBALL}" ]; then
  24. echo "No parameters found and no required environment variables set"
  25. echo "usage: make_tarball.sh <SUPERSET_VERSION> <SUPERSET_RC> <PGP_KEY_FULLBANE>"
  26. usage;
  27. exit 1
  28. fi
  29. else
  30. SUPERSET_VERSION="${1}"
  31. SUPERSET_RC="${2}"
  32. SUPERSET_PGP_FULLNAME="${3}"
  33. SUPERSET_RELEASE_RC_TARBALL="apache-superset-incubating-${SUPERSET_VERSION_RC}-source.tar.gz"
  34. fi
  35. SUPERSET_VERSION_RC="${SUPERSET_VERSION}rc${SUPERSET_RC}"
  36. if [ -z "${SUPERSET_SVN_DEV_PATH}" ]; then
  37. SUPERSET_SVN_DEV_PATH="$HOME/svn/superset_dev"
  38. fi
  39. if [[ ! -d "${SUPERSET_SVN_DEV_PATH}" ]]; then
  40. echo "${SUPERSET_SVN_DEV_PATH} does not exist, you need to: svn checkout"
  41. exit 1
  42. fi
  43. if [ -d "${SUPERSET_SVN_DEV_PATH}/${SUPERSET_VERSION_RC}" ]; then
  44. echo "${SUPERSET_VERSION_RC} Already exists on svn, refusing to overwrite"
  45. exit 1
  46. fi
  47. SUPERSET_RELEASE_RC_TARBALL_PATH="${SUPERSET_SVN_DEV_PATH}"/"${SUPERSET_VERSION_RC}"/"${SUPERSET_RELEASE_RC_TARBALL}"
  48. DOCKER_SVN_PATH="/docker_svn"
  49. # Building docker that will produce a tarball
  50. docker build -t apache-builder -f Dockerfile.make_tarball .
  51. # Running docker to produce a tarball
  52. docker run \
  53. -e SUPERSET_SVN_DEV_PATH="${DOCKER_SVN_PATH}" \
  54. -e SUPERSET_VERSION="${SUPERSET_VERSION}" \
  55. -e SUPERSET_VERSION_RC="${SUPERSET_VERSION_RC}" \
  56. -e HOST_UID=${UID} \
  57. -v "${SUPERSET_SVN_DEV_PATH}":"${DOCKER_SVN_PATH}":rw \
  58. -ti apache-builder
  59. gpg --armor --local-user "${SUPERSET_PGP_FULLNAME}" --output "${SUPERSET_RELEASE_RC_TARBALL_PATH}".asc --detach-sig "${SUPERSET_RELEASE_RC_TARBALL_PATH}"
  60. gpg --print-md --local-user "${SUPERSET_PGP_FULLNAME}" SHA512 "${SUPERSET_RELEASE_RC_TARBALL_PATH}" > "${SUPERSET_RELEASE_RC_TARBALL_PATH}".sha512
  61. echo ---------------------------------------
  62. echo Release candidate tarball is ready
  63. echo ---------------------------------------