You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2018/08/28 17:30:31 UTC
[geode] branch develop updated: GEODE-5608 truncate fork/branch
names in image/instance naming (#2390)
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 aa915c2 GEODE-5608 truncate fork/branch names in image/instance naming (#2390)
aa915c2 is described below
commit aa915c2ba7d07a641c8ec65f473dd60f44806606
Author: FSOUTHERLAND <39...@users.noreply.github.com>
AuthorDate: Tue Aug 28 10:30:24 2018 -0700
GEODE-5608 truncate fork/branch names in image/instance naming (#2390)
* GEODE-5608 truncate fork/branch names in image/instance naming (#2363)
Co-authored-by: Jacob Barrett <jb...@pivotal.io>
Co-authored-by: Finn Southerland <fs...@pivotal.io>
Co-authored-by: Robert Houghton <rh...@pivotal.io>
---
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, 142 insertions(+), 57 deletions(-)
diff --git a/ci/images/google-geode-builder/build_image.sh b/ci/images/google-geode-builder/build_image.sh
index 885392f..6cdf219 100755
--- a/ci/images/google-geode-builder/build_image.sh
+++ b/ci/images/google-geode-builder/build_image.sh
@@ -26,8 +26,6 @@ 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
@@ -35,9 +33,12 @@ 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 [[ "${GEODE_FORK}" != "apache" ]]; then
- IMAGE_FAMILY_PREFIX="${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-"
+if [[ "${SANITIZED_GEODE_FORK}" != "apache" ]]; then
+ IMAGE_FAMILY_PREFIX="${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-"
fi
echo "Running packer"
diff --git a/ci/pipelines/README.md b/ci/pipelines/README.md
index 1f761ed..40eab56 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 <path to jinja template> <path to jinja variables> <path to generated file>
+./render.py <directory containing jinja template>
```
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 903dcf1..1a19443 100755
--- a/ci/pipelines/clean_fork_pipelines.sh
+++ b/ci/pipelines/clean_fork_pipelines.sh
@@ -19,7 +19,11 @@ TARGET=geode
GEODE_FORK=${1}
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
GEODE_BRANCH=${2:-${CURRENT_BRANCH}}
-SANITIZED_GEODE_BRANCH=$(echo ${GEODE_BRANCH} | tr "/" "-" | tr '[:upper:]' '[:lower:]')
+
+. ${SCRIPTDIR}/../shared/utilities.sh
+SANITIZED_GEODE_BRANCH=$(getSanitizedBranch ${GEODE_BRANCH})
+SANITIZED_GEODE_FORK=$(getSanitizedFork ${GEODE_FORK})
+
TEAM=$(fly targets | grep ^${TARGET} | awk '{print $3}')
if [[ -z "${GEODE_FORK}" ]]; then
@@ -31,22 +35,22 @@ echo "Fork is ${GEODE_FORK}"
echo "Branch is ${GEODE_BRANCH}"
echo "Deleting meta pipeline if it exists..."
-META_PIPELINE="meta-${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}"
+META_PIPELINE="meta-${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_BRANCH}"
fly -t ${TARGET} destroy-pipeline --non-interactive -p ${META_PIPELINE}
echo "Deleting images pipeline if it exists..."
-IMAGES_PIPELINE="${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-images"
+IMAGES_PIPELINE="${SANITIZED_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="${GEOD_FORK}-${SANITIZED_GEODE_BRANCH}-reaper"
+REAPER_PIPELINE="${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-reaper"
fly -t ${TARGET} destroy-pipeline --non-interactive -p ${REAPER_PIPELINE}
echo "Deleting build pipeline if it exists..."
-BUILD_PIPELINE="${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}"
+BUILD_PIPELINE="${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_BRANCH}"
fly -t ${TARGET} destroy-pipeline --non-interactive -p ${BUILD_PIPELINE}
-gcloud container images list | grep "${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}" | while IFS= read -r line; do
+gcloud container images list | grep "${SANITIZED_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
@@ -55,7 +59,7 @@ gcloud container images list | grep "${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}" |
done
done
-gcloud compute images list | awk "/^${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}/ {print \$1}" | while IFS= read -r line; do
+gcloud compute images list | awk "/^${SANITIZED_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 5736b2c..59e30af 100755
--- a/ci/pipelines/deploy_meta.sh
+++ b/ci/pipelines/deploy_meta.sh
@@ -15,11 +15,22 @@
# 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}
-SANITIZED_GEODE_FORK=$(echo ${GEODE_FORK} | tr "/" "-" | tr '[:upper:]' '[:lower:]')
+
+. ${SCRIPTDIR}/shared/utilities.sh
+SANITIZED_GEODE_BRANCH=$(getSanitizedBranch ${GEODE_BRANCH})
+SANITIZED_GEODE_FORK=$(getSanitizedFork ${GEODE_FORK})
+
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 20b8a04..bb560a3 100755
--- a/ci/pipelines/examples/deploy_pipeline.sh
+++ b/ci/pipelines/examples/deploy_pipeline.sh
@@ -44,7 +44,11 @@ if [ "${GEODE_BRANCH}" = "HEAD" ]; then
exit 1
fi
-SANITIZED_GEODE_BRANCH=$(echo ${GEODE_BRANCH} | tr "/" "-" | tr '[:upper:]' '[:lower:]')
+
+. ${SCRIPTDIR}/../shared/utilities.sh
+
+SANITIZED_GEODE_BRANCH=$(getSanitizedBranch ${GEODE_BRANCH})
+SANITIZED_GEODE_FORK=$(getSanitizedFork ${GEODE_FORK})
BIN_DIR=${OUTPUT_DIRECTORY}/bin
TMP_DIR=${OUTPUT_DIRECTORY}/tmp
@@ -61,18 +65,18 @@ if [[ "${GEODE_BRANCH}" == "develop" ]] || [[ ${GEODE_BRANCH} =~ ^release/* ]];
TEAM="main"
fi
-if [[ "${GEODE_FORK}" == "apache" ]]; then
+if [[ "${SANITIZED_GEODE_FORK}" == "apache" ]]; then
PIPELINE_NAME=${SANITIZED_GEODE_BRANCH}
DOCKER_IMAGE_PREFIX=""
else
- PIPELINE_NAME="${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}"
+ PIPELINE_NAME="${SANITIZED_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 jinja.template.yml ../shared/jinja.variables.yml generated-pipeline.yml || exit 1
+# Template and output share a directory with this script, but variables are shared in the parent directory.
+ python3 ../render.py $(basename ${SCRIPTDIR}) || exit 1
fly login -t ${TARGET} \
-n ${TEAM} \
@@ -81,9 +85,9 @@ pushd ${SCRIPTDIR} 2>&1 > /dev/null
-p ${CONCOURSE_PASSWORD}
fly -t ${TARGET} set-pipeline \
- --non-interactive \
- --pipeline ${PIPELINE_NAME} \
- --config generated-pipeline.yml \
- --var docker-image-prefix=${DOCKER_IMAGE_PREFIX} \
+ --non-interactive \
+ --pipeline ${PIPELINE_NAME} \
+ --config ${SCRIPTDIR}/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 bd6709f..a8e4937 100755
--- a/ci/pipelines/geode-build/deploy_pipeline.sh
+++ b/ci/pipelines/geode-build/deploy_pipeline.sh
@@ -44,7 +44,10 @@ if [ "${GEODE_BRANCH}" = "HEAD" ]; then
exit 1
fi
-SANITIZED_GEODE_BRANCH=$(echo ${GEODE_BRANCH} | tr "/" "-" | tr '[:upper:]' '[:lower:]')
+. ${SCRIPTDIR}/../shared/utilities.sh
+
+SANITIZED_GEODE_BRANCH=$(getSanitizedBranch ${GEODE_BRANCH})
+SANITIZED_GEODE_FORK=$(getSanitizedFork ${GEODE_FORK})
BIN_DIR=${OUTPUT_DIRECTORY}/bin
TMP_DIR=${OUTPUT_DIRECTORY}/tmp
@@ -61,17 +64,17 @@ if [[ "${GEODE_BRANCH}" == "develop" ]] || [[ ${GEODE_BRANCH} =~ ^release/* ]];
TEAM="main"
fi
-if [[ "${GEODE_FORK}" == "apache" ]]; then
+if [[ "${SANITIZED_GEODE_FORK}" == "apache" ]]; then
PIPELINE_NAME=${SANITIZED_GEODE_BRANCH}
DOCKER_IMAGE_PREFIX=""
else
- PIPELINE_NAME="${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}"
+ PIPELINE_NAME="${SANITIZED_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 jinja.template.yml ../shared/jinja.variables.yml generated-pipeline.yml || exit 1
+ python3 ../render.py $(basename ${SCRIPTDIR}) || exit 1
grep -n . generated-pipeline.yml
@@ -81,9 +84,10 @@ 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 generated-pipeline.yml
+ --config ${SCRIPTDIR}/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 dd544fe..b7f8f4d 100755
--- a/ci/pipelines/images/deploy_images_pipeline.sh
+++ b/ci/pipelines/images/deploy_images_pipeline.sh
@@ -36,7 +36,11 @@ if [ "${GEODE_BRANCH}" = "HEAD" ]; then
exit 1
fi
-SANITIZED_GEODE_BRANCH=$(echo ${GEODE_BRANCH} | tr "/" "-" | tr '[:upper:]' '[:lower:]')
+
+. ${SCRIPTDIR}/../shared/utilities.sh
+
+SANITIZED_GEODE_BRANCH=$(getSanitizedBranch ${GEODE_BRANCH})
+SANITIZED_GEODE_FORK=$(getSanitizedFork ${GEODE_FORK})
BIN_DIR=${OUTPUT_DIRECTORY}/bin
TMP_DIR=${OUTPUT_DIRECTORY}/tmp
@@ -50,11 +54,11 @@ TARGET="geode"
TEAM=${CONCOURSE_TEAM}
-if [[ "${GEODE_FORK}" == "apache" ]]; then
+if [[ "${SANITIZED_GEODE_FORK}" == "apache" ]]; then
PIPELINE_PREFIX=""
DOCKER_IMAGE_PREFIX=""
else
- PIPELINE_PREFIX="${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-"
+ PIPELINE_PREFIX="${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-"
DOCKER_IMAGE_PREFIX=${PIPELINE_PREFIX}
fi
diff --git a/ci/pipelines/meta.yml b/ci/pipelines/meta.yml
index 2b5bc4b..8b05bcc 100644
--- a/ci/pipelines/meta.yml
+++ b/ci/pipelines/meta.yml
@@ -41,6 +41,7 @@ resources:
paths:
- ci/pipelines/geode-build/*
- ci/pipelines/shared/*
+ - ci/pipelines/render.py
- name: geode-examples-pipeline
type: git
source:
@@ -49,6 +50,7 @@ resources:
paths:
- ci/pipelines/examples/*
- ci/pipelines/shared/*
+ - ci/pipelines/render.py
- name: geode-pr-pipeline
type: git
source:
@@ -57,6 +59,7 @@ 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 50b917e..78c5e78 100755
--- a/ci/pipelines/pull-request/deploy_pr_pipeline.sh
+++ b/ci/pipelines/pull-request/deploy_pr_pipeline.sh
@@ -46,7 +46,11 @@ if [ "${GEODE_BRANCH}" = "HEAD" ]; then
exit 1
fi
-SANITIZED_GEODE_BRANCH=$(echo ${GEODE_BRANCH} | tr "/" "-" | tr '[:upper:]' '[:lower:]')
+
+. ${SCRIPTDIR}/../shared/utilities.sh
+
+SANITIZED_GEODE_BRANCH=$(getSanitizedBranch ${GEODE_BRANCH})
+SANITIZED_GEODE_FORK=$(getSanitizedFork ${GEODE_FORK})
OUTPUT_DIRECTORY=${OUTPUT_DIRECTORY:-$SCRIPTDIR}
@@ -62,17 +66,17 @@ TARGET="geode"
TEAM=${CONCOURSE_TEAM:-main}
-if [[ "${GEODE_FORK}" == "apache" ]]; then
+if [[ "${SANITIZED_GEODE_FORK}" == "apache" ]]; then
PIPELINE_PREFIX=""
DOCKER_IMAGE_PREFIX=""
else
- PIPELINE_PREFIX="${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-"
+ PIPELINE_PREFIX="${SANITIZED_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 jinja.template.yml ../shared/jinja.variables.yml generated-pipeline.yml || exit 1
+ python3 ../render.py $(basename ${SCRIPTDIR}) || exit 1
fly login -t ${TARGET} \
-n ${TEAM} \
@@ -81,11 +85,11 @@ pushd ${SCRIPTDIR} 2>&1 > /dev/null
-p ${CONCOURSE_PASSWORD}
fly -t ${TARGET} set-pipeline \
- --non-interactive \
- --pipeline pr-${SANITIZED_GEODE_BRANCH} \
- --config generated-pipeline.yml \
- --var docker-image-prefix=${DOCKER_IMAGE_PREFIX} \
- --var concourse-team=${TEAM}
+ --non-interactive \
+ --pipeline pr-${SANITIZED_GEODE_BRANCH} \
+ --config ${SCRIPTDIR}/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 2754462..0c65136 100755
--- a/ci/pipelines/render.py
+++ b/ci/pipelines/render.py
@@ -24,23 +24,40 @@ import yaml
from jinja2 import Environment, FileSystemLoader, Undefined
import jinja2.exceptions
import os
+import subprocess
-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)
+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_]))
template = env.get_template(template_file)
with open(variables_file, 'r') as variablesFromYml:
variables = yaml.load(variablesFromYml)
- variables['repository']['branch'] = os.environ['GEODE_BRANCH']
- variables['repository']['fork'] = os.environ['GEODE_FORK']
+ 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]
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))
@@ -57,9 +74,9 @@ class RaiseExceptionIfUndefined(Undefined):
if __name__ == '__main__':
parser = argparse.ArgumentParser()
- 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("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("--debug", help="It's debug. If you have to ask, you'll never know.", action="store_true")
_args = parser.parse_args()
@@ -69,5 +86,5 @@ if __name__ == '__main__':
logging.debug(f"cwd: {os.getcwd()}")
- main(_args.template, _args.variables, _args.output)
+ main(_args.template_dir_name)
diff --git a/ci/pipelines/shared/shared_jinja.yml b/ci/pipelines/shared/shared_jinja.yml
index 69a4ac5..69fd1a9 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.fork}}-{{repository.branch}}-
+{{repository.sanitized_fork}}-{{repository.sanitized_branch}}-
{%- endif %}
{%- endmacro %}
diff --git a/ci/pipelines/shared/utilities.sh b/ci/pipelines/shared/utilities.sh
new file mode 100644
index 0000000..eef105f
--- /dev/null
+++ b/ci/pipelines/shared/utilities.sh
@@ -0,0 +1,29 @@
+#!/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 c9a54f2..3bee7f9 100755
--- a/ci/scripts/start_instance.sh
+++ b/ci/scripts/start_instance.sh
@@ -45,17 +45,21 @@ fi
-SANITIZED_GEODE_BRANCH=$(echo ${GEODE_BRANCH} | tr "/" "-" | tr '[:upper:]' '[:lower:]')
+
+. ${SCRIPTDIR}/../pipelines/shared/utilities.sh
+SANITIZED_GEODE_BRANCH=$(getSanitizedBranch ${GEODE_BRANCH})
+SANITIZED_GEODE_FORK=$(getSanitizedFork ${GEODE_FORK})
+
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 [[ "${GEODE_FORK}" != "apache" ]]; then
- IMAGE_FAMILY_PREFIX="${GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-"
+if [[ "${SANITIZED_GEODE_FORK}" != "apache" ]]; then
+ IMAGE_FAMILY_PREFIX="${SANITIZED_GEODE_FORK}-${SANITIZED_GEODE_BRANCH}-"
fi
-INSTANCE_NAME="$(echo "build-${BUILD_PIPELINE_NAME}-${BUILD_JOB_NAME}-${BUILD_NAME}" | tr '[:upper:]' '[:lower:]')"
+INSTANCE_NAME="$(echo "${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"