This is an automated email from the ASF dual-hosted git repository. jbarrett pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push: new 366594c Revert "GEODE-5608 truncate fork/branch names in image/instance naming (#2363)" 366594c is described below commit 366594ca6f4807b6dfaa1fc9162f3760ecd18a58 Author: Jacob Barrett <jbarr...@pivotal.io> AuthorDate: Tue Aug 28 10:16:25 2018 -0700 Revert "GEODE-5608 truncate fork/branch names in image/instance naming (#2363)" This reverts commit 58e4035f7678e7198bb3c59f719d94a27a9144b2. --- ci/images/google-geode-builder/build_image.sh | 9 +++--- ci/pipelines/README.md | 2 +- ci/pipelines/clean_fork_pipelines.sh | 18 +++++------- ci/pipelines/deploy_meta.sh | 15 ++-------- ci/pipelines/examples/deploy_pipeline.sh | 22 ++++++-------- ci/pipelines/geode-build/deploy_pipeline.sh | 16 ++++------ ci/pipelines/images/deploy_images_pipeline.sh | 10 ++----- ci/pipelines/meta.yml | 3 -- ci/pipelines/pull-request/deploy_pr_pipeline.sh | 22 ++++++-------- ci/pipelines/render.py | 39 +++++++------------------ ci/pipelines/shared/shared_jinja.yml | 2 +- ci/pipelines/shared/utilities.sh | 29 ------------------ ci/scripts/start_instance.sh | 12 +++----- 13 files changed, 57 insertions(+), 142 deletions(-) diff --git a/ci/images/google-geode-builder/build_image.sh b/ci/images/google-geode-builder/build_image.sh index 6cdf219..885392f 100755 --- a/ci/images/google-geode-builder/build_image.sh +++ b/ci/images/google-geode-builder/build_image.sh @@ -26,6 +26,8 @@ SCRIPTDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" pushd ${SCRIPTDIR} +GEODE_BRANCH=${GEODE_BRANCH:-$(git rev-parse --abbrev-ref HEAD)} +SANITIZED_GEODE_BRANCH=$(echo ${GEODE_BRANCH} | tr "/" "-" | tr '[:upper:]' '[:lower:]') IMAGE_FAMILY_PREFIX="" GEODE_DOCKER_IMAGE=${GEODE_DOCKER_IMAGE:-"gcr.io/apachegeode-ci/test-container"} if [[ -z "${GEODE_FORK}" ]]; then @@ -33,12 +35,9 @@ if [[ -z "${GEODE_FORK}" ]]; then exit 1 fi -GEODE_BRANCH=${GEODE_BRANCH:-$(git rev-parse --abbrev-ref HEAD)} -SANITIZED_GEODE_BRANCH=$(echo ${GEODE_BRANCH} | tr "/" "-" | tr '[:upper:]' '[:lower:]' | cut -c 1-20) -SANITIZED_GEODE_FORK=$(echo ${GEODE_FORK} | tr "/" "-" | tr '[:upper:]' '[:lower:]' | cut -c 1-16) -if [[ "${SANITIZED_GEODE_FORK}" != "apache" ]]; then - IMAGE_FAMILY_PREFIX="${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-" +if [[ "${GEODE_FORK}" != "apache" ]]; then + IMAGE_FAMILY_PREFIX="${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-" fi echo "Running packer" diff --git a/ci/pipelines/README.md b/ci/pipelines/README.md index 40eab56..1f761ed 100644 --- a/ci/pipelines/README.md +++ b/ci/pipelines/README.md @@ -11,7 +11,7 @@ To generate a pipeline, using jinja: (for the pipeline you want to create): ```bash -./render.py <directory containing jinja template> +./render.py <path to jinja template> <path to jinja variables> <path to generated file> ``` The generated file should be named `generated-pipeline.yml`. \ No newline at end of file diff --git a/ci/pipelines/clean_fork_pipelines.sh b/ci/pipelines/clean_fork_pipelines.sh index 1a19443..903dcf1 100755 --- a/ci/pipelines/clean_fork_pipelines.sh +++ b/ci/pipelines/clean_fork_pipelines.sh @@ -19,11 +19,7 @@ TARGET=geode GEODE_FORK=${1} CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) GEODE_BRANCH=${2:-${CURRENT_BRANCH}} - -. ${SCRIPTDIR}/../shared/utilities.sh -SANITIZED_GEODE_BRANCH=$(getSanitizedBranch ${GEODE_BRANCH}) -SANITIZED_GEODE_FORK=$(getSanitizedFork ${GEODE_FORK}) - +SANITIZED_GEODE_BRANCH=$(echo ${GEODE_BRANCH} | tr "/" "-" | tr '[:upper:]' '[:lower:]') TEAM=$(fly targets | grep ^${TARGET} | awk '{print $3}') if [[ -z "${GEODE_FORK}" ]]; then @@ -35,22 +31,22 @@ echo "Fork is ${GEODE_FORK}" echo "Branch is ${GEODE_BRANCH}" echo "Deleting meta pipeline if it exists..." -META_PIPELINE="meta-${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_BRANCH}" +META_PIPELINE="meta-${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}" fly -t ${TARGET} destroy-pipeline --non-interactive -p ${META_PIPELINE} echo "Deleting images pipeline if it exists..." -IMAGES_PIPELINE="${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-images" +IMAGES_PIPELINE="${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-images" fly -t ${TARGET} destroy-pipeline --non-interactive -p ${IMAGES_PIPELINE} echo "Deleting reaper pipeline if it exists..." -REAPER_PIPELINE="${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-reaper" +REAPER_PIPELINE="${GEOD_FORK}-${SANITIZED_GEODE_BRANCH}-reaper" fly -t ${TARGET} destroy-pipeline --non-interactive -p ${REAPER_PIPELINE} echo "Deleting build pipeline if it exists..." -BUILD_PIPELINE="${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_BRANCH}" +BUILD_PIPELINE="${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}" fly -t ${TARGET} destroy-pipeline --non-interactive -p ${BUILD_PIPELINE} -gcloud container images list | grep "${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_BRANCH}" | while IFS= read -r line; do +gcloud container images list | grep "${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}" | while IFS= read -r line; do echo "Deleting image: ${line}" gcloud container images delete ${line}:latest --quiet gcloud container images list-tags ${line} --filter='-tags:*' --format='get(digest)' | while IFS= read -r line2; do @@ -59,7 +55,7 @@ gcloud container images list | grep "${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_B done done -gcloud compute images list | awk "/^${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_BRANCH}/ {print \$1}" | while IFS= read -r line; do +gcloud compute images list | awk "/^${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}/ {print \$1}" | while IFS= read -r line; do echo "Deleting image: ${line}" gcloud compute images delete ${line} --quiet done diff --git a/ci/pipelines/deploy_meta.sh b/ci/pipelines/deploy_meta.sh index 59e30af..5736b2c 100755 --- a/ci/pipelines/deploy_meta.sh +++ b/ci/pipelines/deploy_meta.sh @@ -15,22 +15,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -SOURCE="${BASH_SOURCE[0]}" -while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink - SCRIPTDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located -done -SCRIPTDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - GEODE_BRANCH=$(git rev-parse --abbrev-ref HEAD) +SANITIZED_GEODE_BRANCH=$(echo ${GEODE_BRANCH} | tr "/" "-" | tr '[:upper:]' '[:lower:]') TARGET=geode GEODE_FORK=${1:-apache} - -. ${SCRIPTDIR}/shared/utilities.sh -SANITIZED_GEODE_BRANCH=$(getSanitizedBranch ${GEODE_BRANCH}) -SANITIZED_GEODE_FORK=$(getSanitizedFork ${GEODE_FORK}) - +SANITIZED_GEODE_FORK=$(echo ${GEODE_FORK} | tr "/" "-" | tr '[:upper:]' '[:lower:]') TEAM=$(fly targets | grep ^${TARGET} | awk '{print $3}') PUBLIC=true diff --git a/ci/pipelines/examples/deploy_pipeline.sh b/ci/pipelines/examples/deploy_pipeline.sh index bb560a3..20b8a04 100755 --- a/ci/pipelines/examples/deploy_pipeline.sh +++ b/ci/pipelines/examples/deploy_pipeline.sh @@ -44,11 +44,7 @@ if [ "${GEODE_BRANCH}" = "HEAD" ]; then exit 1 fi - -. ${SCRIPTDIR}/../shared/utilities.sh - -SANITIZED_GEODE_BRANCH=$(getSanitizedBranch ${GEODE_BRANCH}) -SANITIZED_GEODE_FORK=$(getSanitizedFork ${GEODE_FORK}) +SANITIZED_GEODE_BRANCH=$(echo ${GEODE_BRANCH} | tr "/" "-" | tr '[:upper:]' '[:lower:]') BIN_DIR=${OUTPUT_DIRECTORY}/bin TMP_DIR=${OUTPUT_DIRECTORY}/tmp @@ -65,18 +61,18 @@ if [[ "${GEODE_BRANCH}" == "develop" ]] || [[ ${GEODE_BRANCH} =~ ^release/* ]]; TEAM="main" fi -if [[ "${SANITIZED_GEODE_FORK}" == "apache" ]]; then +if [[ "${GEODE_FORK}" == "apache" ]]; then PIPELINE_NAME=${SANITIZED_GEODE_BRANCH} DOCKER_IMAGE_PREFIX="" else - PIPELINE_NAME="${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_BRANCH}" + PIPELINE_NAME="${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}" DOCKER_IMAGE_PREFIX="${PIPELINE_NAME}-" fi PIPELINE_NAME="${PIPELINE_NAME}-examples" pushd ${SCRIPTDIR} 2>&1 > /dev/null -# Template and output share a directory with this script, but variables are shared in the parent directory. - python3 ../render.py $(basename ${SCRIPTDIR}) || exit 1 + # Template and output share a directory with this script, but variables are shared in the parent directory. + python3 ../render.py jinja.template.yml ../shared/jinja.variables.yml generated-pipeline.yml || exit 1 fly login -t ${TARGET} \ -n ${TEAM} \ @@ -85,9 +81,9 @@ pushd ${SCRIPTDIR} 2>&1 > /dev/null -p ${CONCOURSE_PASSWORD} fly -t ${TARGET} set-pipeline \ - --non-interactive \ - --pipeline ${PIPELINE_NAME} \ - --config ${SCRIPTDIR}/generated-pipeline.yml \ - --var docker-image-prefix=${DOCKER_IMAGE_PREFIX} \ + --non-interactive \ + --pipeline ${PIPELINE_NAME} \ + --config generated-pipeline.yml \ + --var docker-image-prefix=${DOCKER_IMAGE_PREFIX} \ popd 2>&1 > /dev/null diff --git a/ci/pipelines/geode-build/deploy_pipeline.sh b/ci/pipelines/geode-build/deploy_pipeline.sh index a8e4937..bd6709f 100755 --- a/ci/pipelines/geode-build/deploy_pipeline.sh +++ b/ci/pipelines/geode-build/deploy_pipeline.sh @@ -44,10 +44,7 @@ if [ "${GEODE_BRANCH}" = "HEAD" ]; then exit 1 fi -. ${SCRIPTDIR}/../shared/utilities.sh - -SANITIZED_GEODE_BRANCH=$(getSanitizedBranch ${GEODE_BRANCH}) -SANITIZED_GEODE_FORK=$(getSanitizedFork ${GEODE_FORK}) +SANITIZED_GEODE_BRANCH=$(echo ${GEODE_BRANCH} | tr "/" "-" | tr '[:upper:]' '[:lower:]') BIN_DIR=${OUTPUT_DIRECTORY}/bin TMP_DIR=${OUTPUT_DIRECTORY}/tmp @@ -64,17 +61,17 @@ if [[ "${GEODE_BRANCH}" == "develop" ]] || [[ ${GEODE_BRANCH} =~ ^release/* ]]; TEAM="main" fi -if [[ "${SANITIZED_GEODE_FORK}" == "apache" ]]; then +if [[ "${GEODE_FORK}" == "apache" ]]; then PIPELINE_NAME=${SANITIZED_GEODE_BRANCH} DOCKER_IMAGE_PREFIX="" else - PIPELINE_NAME="${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_BRANCH}" + PIPELINE_NAME="${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}" DOCKER_IMAGE_PREFIX="${PIPELINE_NAME}-" fi pushd ${SCRIPTDIR} 2>&1 > /dev/null # Template and output share a directory with this script, but variables are shared in the parent directory. - python3 ../render.py $(basename ${SCRIPTDIR}) || exit 1 + python3 ../render.py jinja.template.yml ../shared/jinja.variables.yml generated-pipeline.yml || exit 1 grep -n . generated-pipeline.yml @@ -84,10 +81,9 @@ pushd ${SCRIPTDIR} 2>&1 > /dev/null -u ${CONCOURSE_USERNAME} \ -p ${CONCOURSE_PASSWORD} - fly -t ${TARGET} set-pipeline \ - --non-interactive \ + fly -t ${TARGET} set-pipeline --non-interactive \ --pipeline ${PIPELINE_NAME} \ --var docker-image-prefix=${DOCKER_IMAGE_PREFIX} \ - --config ${SCRIPTDIR}/generated-pipeline.yml + --config generated-pipeline.yml popd 2>&1 > /dev/null diff --git a/ci/pipelines/images/deploy_images_pipeline.sh b/ci/pipelines/images/deploy_images_pipeline.sh index b7f8f4d..dd544fe 100755 --- a/ci/pipelines/images/deploy_images_pipeline.sh +++ b/ci/pipelines/images/deploy_images_pipeline.sh @@ -36,11 +36,7 @@ if [ "${GEODE_BRANCH}" = "HEAD" ]; then exit 1 fi - -. ${SCRIPTDIR}/../shared/utilities.sh - -SANITIZED_GEODE_BRANCH=$(getSanitizedBranch ${GEODE_BRANCH}) -SANITIZED_GEODE_FORK=$(getSanitizedFork ${GEODE_FORK}) +SANITIZED_GEODE_BRANCH=$(echo ${GEODE_BRANCH} | tr "/" "-" | tr '[:upper:]' '[:lower:]') BIN_DIR=${OUTPUT_DIRECTORY}/bin TMP_DIR=${OUTPUT_DIRECTORY}/tmp @@ -54,11 +50,11 @@ TARGET="geode" TEAM=${CONCOURSE_TEAM} -if [[ "${SANITIZED_GEODE_FORK}" == "apache" ]]; then +if [[ "${GEODE_FORK}" == "apache" ]]; then PIPELINE_PREFIX="" DOCKER_IMAGE_PREFIX="" else - PIPELINE_PREFIX="${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-" + PIPELINE_PREFIX="${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-" DOCKER_IMAGE_PREFIX=${PIPELINE_PREFIX} fi diff --git a/ci/pipelines/meta.yml b/ci/pipelines/meta.yml index 8b05bcc..2b5bc4b 100644 --- a/ci/pipelines/meta.yml +++ b/ci/pipelines/meta.yml @@ -41,7 +41,6 @@ resources: paths: - ci/pipelines/geode-build/* - ci/pipelines/shared/* - - ci/pipelines/render.py - name: geode-examples-pipeline type: git source: @@ -50,7 +49,6 @@ resources: paths: - ci/pipelines/examples/* - ci/pipelines/shared/* - - ci/pipelines/render.py - name: geode-pr-pipeline type: git source: @@ -59,7 +57,6 @@ resources: paths: - ci/pipelines/pull-request/* - ci/pipelines/shared/* - - ci/pipelines/render.py - name: geode-images-pipeline type: git source: diff --git a/ci/pipelines/pull-request/deploy_pr_pipeline.sh b/ci/pipelines/pull-request/deploy_pr_pipeline.sh index 78c5e78..50b917e 100755 --- a/ci/pipelines/pull-request/deploy_pr_pipeline.sh +++ b/ci/pipelines/pull-request/deploy_pr_pipeline.sh @@ -46,11 +46,7 @@ if [ "${GEODE_BRANCH}" = "HEAD" ]; then exit 1 fi - -. ${SCRIPTDIR}/../shared/utilities.sh - -SANITIZED_GEODE_BRANCH=$(getSanitizedBranch ${GEODE_BRANCH}) -SANITIZED_GEODE_FORK=$(getSanitizedFork ${GEODE_FORK}) +SANITIZED_GEODE_BRANCH=$(echo ${GEODE_BRANCH} | tr "/" "-" | tr '[:upper:]' '[:lower:]') OUTPUT_DIRECTORY=${OUTPUT_DIRECTORY:-$SCRIPTDIR} @@ -66,17 +62,17 @@ TARGET="geode" TEAM=${CONCOURSE_TEAM:-main} -if [[ "${SANITIZED_GEODE_FORK}" == "apache" ]]; then +if [[ "${GEODE_FORK}" == "apache" ]]; then PIPELINE_PREFIX="" DOCKER_IMAGE_PREFIX="" else - PIPELINE_PREFIX="${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-" + PIPELINE_PREFIX="${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-" DOCKER_IMAGE_PREFIX=${PIPELINE_PREFIX} fi pushd ${SCRIPTDIR} 2>&1 > /dev/null # Template and output share a directory with this script, but variables are shared in the parent directory. - python3 ../render.py $(basename ${SCRIPTDIR}) || exit 1 + python3 ../render.py jinja.template.yml ../shared/jinja.variables.yml generated-pipeline.yml || exit 1 fly login -t ${TARGET} \ -n ${TEAM} \ @@ -85,11 +81,11 @@ pushd ${SCRIPTDIR} 2>&1 > /dev/null -p ${CONCOURSE_PASSWORD} fly -t ${TARGET} set-pipeline \ - --non-interactive \ - --pipeline pr-${SANITIZED_GEODE_BRANCH} \ - --config ${SCRIPTDIR}/generated-pipeline.yml \ - --var docker-image-prefix=${DOCKER_IMAGE_PREFIX} \ - --var concourse-team=${TEAM} + --non-interactive \ + --pipeline pr-${SANITIZED_GEODE_BRANCH} \ + --config generated-pipeline.yml \ + --var docker-image-prefix=${DOCKER_IMAGE_PREFIX} \ + --var concourse-team=${TEAM} popd 2>&1 > /dev/null diff --git a/ci/pipelines/render.py b/ci/pipelines/render.py index 0c65136..2754462 100755 --- a/ci/pipelines/render.py +++ b/ci/pipelines/render.py @@ -24,40 +24,23 @@ import yaml from jinja2 import Environment, FileSystemLoader, Undefined import jinja2.exceptions import os -import subprocess -def main(template_dir_name): - - script_dir_ = os.path.dirname(os.path.abspath(__file__)) - shared_dir_ = os.path.join(script_dir_, 'shared') - variables_file = os.path.join(shared_dir_, 'jinja.variables.yml') - template_file = os.path.join(template_dir_name, 'jinja.template.yml') - output_file_ = os.path.join(script_dir_, template_dir_name, 'generated-pipeline.yml') - - cwd_ = os.getcwd() - # Jinja2 template loaded does not allow looking UP from the paths below, so be verbose to make sure we can include - # shared/common templates - env = Environment(loader=FileSystemLoader([cwd_, script_dir_])) +def main(template_file, variables_file, output_file): + # TODO Delete this TODO + # Also TODO: Make the FileSystemLoader accept the script-dir, current-dir, and commons-dir more sensibly. + env = Environment(loader=FileSystemLoader(['.', '..']), undefined=RaiseExceptionIfUndefined) template = env.get_template(template_file) with open(variables_file, 'r') as variablesFromYml: variables = yaml.load(variablesFromYml) - geode_branch_ = os.environ['GEODE_BRANCH'] - variables['repository']['branch'] = geode_branch_ - geode_fork_ = os.environ['GEODE_FORK'] - variables['repository']['fork'] = geode_fork_ - - # Use the one-true-way to truncate fork and branches, trimming the Python bytestream characters from the front and - # back. If this is too ugly, then convert the BASH functions into python files, and call that Python from the - # deploy_XYZ.sh scripts - variables['repository']['sanitized_branch'] = subprocess.run(['bash', '-c', '. ' + script_dir_ + '/shared/utilities.sh; getSanitizedBranch ' + geode_branch_], stdout=subprocess.PIPE).stdout.decode('utf-8')[:-1] - variables['repository']['sanitized_fork'] = subprocess.run(['bash', '-c', '. ' + script_dir_ + '/shared/utilities.sh; getSanitizedFork ' + geode_fork_], stdout=subprocess.PIPE).stdout.decode('utf-8')[:-1] + variables['repository']['branch'] = os.environ['GEODE_BRANCH'] + variables['repository']['fork'] = os.environ['GEODE_FORK'] logging.debug(f"Variables = {variables}") logging.info(template.render(variables)) - with open(output_file_, 'w') as pipeline_file: + with open(output_file, 'w') as pipeline_file: pipeline_file.write(template.render(variables)) @@ -74,9 +57,9 @@ class RaiseExceptionIfUndefined(Undefined): if __name__ == '__main__': parser = argparse.ArgumentParser() - parser.add_argument("template_dir_name", help="Directory containing Jinja template file.") - # parser.add_argument("variables", help="Jinja variables file.") - # parser.add_argument("output", help="Output target.") + parser.add_argument("template", help="Jinja template file.") + parser.add_argument("variables", help="Jinja variables file.") + parser.add_argument("output", help="Output target.") parser.add_argument("--debug", help="It's debug. If you have to ask, you'll never know.", action="store_true") _args = parser.parse_args() @@ -86,5 +69,5 @@ if __name__ == '__main__': logging.debug(f"cwd: {os.getcwd()}") - main(_args.template_dir_name) + main(_args.template, _args.variables, _args.output) diff --git a/ci/pipelines/shared/shared_jinja.yml b/ci/pipelines/shared/shared_jinja.yml index 69fd1a9..69a4ac5 100644 --- a/ci/pipelines/shared/shared_jinja.yml +++ b/ci/pipelines/shared/shared_jinja.yml @@ -23,7 +23,7 @@ {%- macro pipeline_prefix() %} {%- if repository.fork=="apache" %} {%- else -%} -{{repository.sanitized_fork}}-{{repository.sanitized_branch}}- +{{repository.fork}}-{{repository.branch}}- {%- endif %} {%- endmacro %} diff --git a/ci/pipelines/shared/utilities.sh b/ci/pipelines/shared/utilities.sh deleted file mode 100644 index eef105f..0000000 --- a/ci/pipelines/shared/utilities.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#!/usr/bin/env bash - - -getSanitizedBranch () { - echo ${1} | tr "/" "-" | tr '[:upper:]' '[:lower:]' | cut -c 1-20 -} - -getSanitizedFork () { - echo ${1} | tr "/" "-" | tr '[:upper:]' '[:lower:]' | cut -c 1-16 -} - diff --git a/ci/scripts/start_instance.sh b/ci/scripts/start_instance.sh index 61edf9f..c9a54f2 100755 --- a/ci/scripts/start_instance.sh +++ b/ci/scripts/start_instance.sh @@ -45,21 +45,17 @@ fi - -. ${SCRIPTDIR}/../pipelines/shared/utilities.sh -SANITIZED_GEODE_BRANCH=$(getSanitizedBranch ${GEODE_BRANCH}) -SANITIZED_GEODE_FORK=$(getSanitizedFork ${GEODE_FORK}) - +SANITIZED_GEODE_BRANCH=$(echo ${GEODE_BRANCH} | tr "/" "-" | tr '[:upper:]' '[:lower:]') SANITIZED_BUILD_PIPELINE_NAME=$(echo ${BUILD_PIPELINE_NAME} | tr "/" "-" | tr '[:upper:]' '[:lower:]') SANITIZED_BUILD_JOB_NAME=$(echo ${BUILD_JOB_NAME} | tr "/" "-" | tr '[:upper:]' '[:lower:]') SANITIZED_BUILD_NAME=$(echo ${BUILD_NAME} | tr "/" "-" | tr '[:upper:]' '[:lower:]') IMAGE_FAMILY_PREFIX="" -if [[ "${SAINTIZED_GEODE_FORK}" != "apache" ]]; then - IMAGE_FAMILY_PREFIX="${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-" +if [[ "${GEODE_FORK}" != "apache" ]]; then + IMAGE_FAMILY_PREFIX="${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-" fi -INSTANCE_NAME="$(echo "${BUILD_PIPELINE_NAME}-${BUILD_JOB_NAME}-${BUILD_NAME}" | tr '[:upper:]' '[:lower:]')" +INSTANCE_NAME="$(echo "build-${BUILD_PIPELINE_NAME}-${BUILD_JOB_NAME}-${BUILD_NAME}" | tr '[:upper:]' '[:lower:]')" PROJECT=apachegeode-ci ZONE=us-central1-f echo "${INSTANCE_NAME}" > "instance-data/instance-name"