This is an automated email from the ASF dual-hosted git repository.
prhomberg 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 542ab38 GEODE-6483: Separate concerns of render.py. (#3264)
542ab38 is described below
commit 542ab38c011881e29a0f1a4f921469a8d96b7814
Author: Patrick Rhomberg <[email protected]>
AuthorDate: Fri Mar 8 09:28:17 2019 -0800
GEODE-6483: Separate concerns of render.py. (#3264)
---
ci/pipelines/examples/deploy_pipeline.sh | 14 +-
ci/pipelines/examples/jinja.template.yml | 4 +-
ci/pipelines/geode-build/deploy_pipeline.sh | 13 +-
ci/pipelines/geode-build/jinja.template.yml | 10 +-
ci/pipelines/images/deploy_images_pipeline.sh | 13 +-
ci/pipelines/images/jinja.template.yml | 2 +-
ci/pipelines/meta/deploy_meta.sh | 14 +-
ci/pipelines/meta/jinja.template.yml | 2 +-
ci/pipelines/metrics/deploy_metrics_pipeline.sh | 13 +-
ci/pipelines/metrics/jinja.template.yml | 2 +-
ci/pipelines/pull-request/deploy_pr_pipeline.sh | 14 +-
ci/pipelines/pull-request/jinja.template.yml | 8 +-
ci/pipelines/render.py | 224 ++++++++++++++++++------
ci/pipelines/shared/jinja.variables.yml | 1 +
14 files changed, 258 insertions(+), 76 deletions(-)
diff --git a/ci/pipelines/examples/deploy_pipeline.sh
b/ci/pipelines/examples/deploy_pipeline.sh
index 3c37b5e..0b847fa 100755
--- a/ci/pipelines/examples/deploy_pipeline.sh
+++ b/ci/pipelines/examples/deploy_pipeline.sh
@@ -58,8 +58,18 @@ VERSION_BUCKET="concourse-${ENV_ID}-version"
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}) ${GEODE_FORK} ${GEODE_BRANCH}
${UPSTREAM_FORK} ${REPOSITORY_PUBLIC} || exit 1
+
+ cat > repository.yml <<YML
+repository:
+ project: 'geode'
+ fork: ${GEODE_FORK}
+ branch: ${GEODE_BRANCH}
+ upstream_fork: ${UPSTREAM_FORK}
+ public: ${REPOSITORY_PUBLIC}
+YML
+
+ python3 ../render.py jinja.template.yml --variable-file
../shared/jinja.variables.yml repository.yml --environment ../shared/ --output
${SCRIPTDIR}/generated-pipeline.yml || exit 1
+
popd 2>&1 > /dev/null
cp ${SCRIPTDIR}/generated-pipeline.yml
${OUTPUT_DIRECTORY}/generated-pipeline.yml
diff --git a/ci/pipelines/examples/jinja.template.yml
b/ci/pipelines/examples/jinja.template.yml
index 1e8fc6c..3e70e61 100644
--- a/ci/pipelines/examples/jinja.template.yml
+++ b/ci/pipelines/examples/jinja.template.yml
@@ -15,8 +15,8 @@
# limitations under the License.
#
-{% from 'shared/shared_jinja.yml' import alpine_tools_config with context %}
-{% from 'shared/shared_jinja.yml' import github_access with context %}
+{% from 'shared_jinja.yml' import alpine_tools_config with context %}
+{% from 'shared_jinja.yml' import github_access with context %}
{% macro common_instance_params(test) -%}
GCP_PROJECT: ((gcp-project))
diff --git a/ci/pipelines/geode-build/deploy_pipeline.sh
b/ci/pipelines/geode-build/deploy_pipeline.sh
index bca3526..7e74ad9 100755
--- a/ci/pipelines/geode-build/deploy_pipeline.sh
+++ b/ci/pipelines/geode-build/deploy_pipeline.sh
@@ -55,7 +55,18 @@ VERSION_BUCKET="concourse-${ENV_ID}-version"
#echo "Pipeline prefix = ${PIPELINE_PREFIX}"
#echo "Docker image prefix = ${DOCKER_IMAGE_PREFIX}"]
pushd ${SCRIPTDIR} 2>&1 > /dev/null
- python3 ../render.py $(basename ${SCRIPTDIR}) ${GEODE_FORK} ${GEODE_BRANCH}
${UPSTREAM_FORK} ${REPOSITORY_PUBLIC} || exit 1
+
+ cat > repository.yml <<YML
+repository:
+ project: 'geode'
+ fork: ${GEODE_FORK}
+ branch: ${GEODE_BRANCH}
+ upstream_fork: ${UPSTREAM_FORK}
+ public: ${REPOSITORY_PUBLIC}
+YML
+
+ python3 ../render.py jinja.template.yml --variable-file
../shared/jinja.variables.yml repository.yml --environment ../shared/ --output
${SCRIPTDIR}/generated-pipeline.yml || exit 1
+
popd 2>&1 > /dev/null
cp ${SCRIPTDIR}/generated-pipeline.yml
${OUTPUT_DIRECTORY}/generated-pipeline.yml
diff --git a/ci/pipelines/geode-build/jinja.template.yml
b/ci/pipelines/geode-build/jinja.template.yml
index d27f5ca..4ea7643 100644
--- a/ci/pipelines/geode-build/jinja.template.yml
+++ b/ci/pipelines/geode-build/jinja.template.yml
@@ -15,9 +15,9 @@
# limitations under the License.
#
-{% from 'shared/shared_jinja.yml' import alpine_tools_config with context %}
-{% from 'shared/shared_jinja.yml' import pipeline_prefix with context %}
-{% from 'shared/shared_jinja.yml' import github_access with context %}
+{% from 'shared_jinja.yml' import alpine_tools_config with context %}
+{% from 'shared_jinja.yml' import pipeline_prefix with context %}
+{% from 'shared_jinja.yml' import github_access with context %}
---
@@ -78,7 +78,11 @@ GRADLE_TASK_OPTIONS: {{ test.GRADLE_TASK_OPTIONS }}
DUNIT_PARALLEL_FORKS: {{ test.DUNIT_PARALLEL_FORKS }}
MAINTENANCE_VERSION: ((geode-build-branch ))
PARALLEL_DUNIT: {{ test.PARALLEL_DUNIT }}
+{% if test.PARALLEL_GRADLE is defined %}
PARALLEL_GRADLE: {{ test.PARALLEL_GRADLE }}
+{% else %}
+PARALLEL_GRADLE: true
+{% endif %}
ARTIFACT_BUCKET: ((artifact-bucket))
SERVICE_ACCOUNT: ((concourse-gcp-account))
GRADLE_GLOBAL_ARGS: ((gradle-global-args))
diff --git a/ci/pipelines/images/deploy_images_pipeline.sh
b/ci/pipelines/images/deploy_images_pipeline.sh
index a5d7e81..b1b8582 100755
--- a/ci/pipelines/images/deploy_images_pipeline.sh
+++ b/ci/pipelines/images/deploy_images_pipeline.sh
@@ -46,7 +46,18 @@ echo "Sanitized Geode Branch = ${SANITIZED_GEODE_BRANCH}"
#echo "Docker image prefix = ${DOCKER_IMAGE_PREFIX}"
pushd ${SCRIPTDIR} 2>&1 > /dev/null
- python3 ../render.py $(basename ${SCRIPTDIR}) ${GEODE_FORK} ${GEODE_BRANCH}
${UPSTREAM_FORK} ${REPOSITORY_PUBLIC} || exit 1
+
+ cat > repository.yml <<YML
+repository:
+ project: 'geode'
+ fork: ${GEODE_FORK}
+ branch: ${GEODE_BRANCH}
+ upstream_fork: ${UPSTREAM_FORK}
+ public: ${REPOSITORY_PUBLIC}
+YML
+
+ python3 ../render.py jinja.template.yml --variable-file
../shared/jinja.variables.yml repository.yml --environment ../shared/ --output
${SCRIPTDIR}/generated-pipeline.yml || exit 1
+
popd 2>&1 > /dev/null
cp ${SCRIPTDIR}/generated-pipeline.yml
${OUTPUT_DIRECTORY}/generated-pipeline.yml
diff --git a/ci/pipelines/images/jinja.template.yml
b/ci/pipelines/images/jinja.template.yml
index 9dde1c3..c6cb362 100644
--- a/ci/pipelines/images/jinja.template.yml
+++ b/ci/pipelines/images/jinja.template.yml
@@ -15,7 +15,7 @@
# limitations under the License.
#
-{% from 'shared/shared_jinja.yml' import github_access with context %}
+{% from 'shared_jinja.yml' import github_access with context %}
---
diff --git a/ci/pipelines/meta/deploy_meta.sh b/ci/pipelines/meta/deploy_meta.sh
index be95392..aaa153b 100755
--- a/ci/pipelines/meta/deploy_meta.sh
+++ b/ci/pipelines/meta/deploy_meta.sh
@@ -91,7 +91,17 @@ 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}) ${GEODE_FORK} ${GEODE_BRANCH}
${UPSTREAM_FORK} ${REPOSITORY_PUBLIC} || exit 1
+
+ cat > repository.yml <<YML
+repository:
+ project: 'geode'
+ fork: ${GEODE_FORK}
+ branch: ${GEODE_BRANCH}
+ upstream_fork: ${UPSTREAM_FORK}
+ public: ${REPOSITORY_PUBLIC}
+YML
+
+ python3 ../render.py jinja.template.yml --variable-file
../shared/jinja.variables.yml repository.yml --environment ../shared/ --output
${SCRIPTDIR}/generated-pipeline.yml --debug || exit 1
fly -t ${FLY_TARGET} sync
fly -t ${FLY_TARGET} set-pipeline \
@@ -258,4 +268,4 @@ if [[ "$GEODE_FORK" == "${UPSTREAM_FORK}" ]]; then
unpauseJobs set-pr-pipeline set-examples-pipeline
exposePipelines ${PIPELINE_PREFIX}pr ${PIPELINE_PREFIX}examples
fi
-fi
\ No newline at end of file
+fi
diff --git a/ci/pipelines/meta/jinja.template.yml
b/ci/pipelines/meta/jinja.template.yml
index dff534b..019066b 100644
--- a/ci/pipelines/meta/jinja.template.yml
+++ b/ci/pipelines/meta/jinja.template.yml
@@ -15,7 +15,7 @@
# limitations under the License.
#
-{% from 'shared/shared_jinja.yml' import github_access with context %}
+{% from 'shared_jinja.yml' import github_access with context %}
---
resource_types:
diff --git a/ci/pipelines/metrics/deploy_metrics_pipeline.sh
b/ci/pipelines/metrics/deploy_metrics_pipeline.sh
index 0addc68..bb8409e 100755
--- a/ci/pipelines/metrics/deploy_metrics_pipeline.sh
+++ b/ci/pipelines/metrics/deploy_metrics_pipeline.sh
@@ -46,7 +46,18 @@ echo "Sanitized Geode Branch = ${SANITIZED_GEODE_BRANCH}"
#echo "Docker image prefix = ${DOCKER_IMAGE_PREFIX}"
pushd ${SCRIPTDIR} 2>&1 > /dev/null
- python3 ../render.py $(basename ${SCRIPTDIR}) ${GEODE_FORK} ${GEODE_BRANCH}
${UPSTREAM_FORK} ${REPOSITORY_PUBLIC} || exit 1
+
+ cat > repository.yml <<YML
+repository:
+ project: 'geode'
+ fork: ${GEODE_FORK}
+ branch: ${GEODE_BRANCH}
+ upstream_fork: ${UPSTREAM_FORK}
+ public: ${REPOSITORY_PUBLIC}
+YML
+
+ python3 ../render.py jinja.template.yml --variable-file
../shared/jinja.variables.yml repository.yml --environment ../shared/ --output
${SCRIPTDIR}/generated-pipeline.yml || exit 1
+
popd 2>&1 > /dev/null
cp ${SCRIPTDIR}/generated-pipeline.yml
${OUTPUT_DIRECTORY}/generated-pipeline.yml
diff --git a/ci/pipelines/metrics/jinja.template.yml
b/ci/pipelines/metrics/jinja.template.yml
index e9b965b..28e31e4 100644
--- a/ci/pipelines/metrics/jinja.template.yml
+++ b/ci/pipelines/metrics/jinja.template.yml
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-{% from 'shared/shared_jinja.yml' import github_access with context %}
+{% from 'shared_jinja.yml' import github_access with context %}
---
image_resource: &docker-geode-build-image
type: docker-image
diff --git a/ci/pipelines/pull-request/deploy_pr_pipeline.sh
b/ci/pipelines/pull-request/deploy_pr_pipeline.sh
index 89c8521..08fde5c 100755
--- a/ci/pipelines/pull-request/deploy_pr_pipeline.sh
+++ b/ci/pipelines/pull-request/deploy_pr_pipeline.sh
@@ -73,8 +73,18 @@ else
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}) ${GEODE_FORK} ${GEODE_BRANCH}
${UPSTREAM_FORK} ${REPOSITORY_PUBLIC} || exit 1
+
+ cat > repository.yml <<YML
+repository:
+ project: 'geode'
+ fork: ${GEODE_FORK}
+ branch: ${GEODE_BRANCH}
+ upstream_fork: ${UPSTREAM_FORK}
+ public: ${REPOSITORY_PUBLIC}
+YML
+
+ python3 ../render.py jinja.template.yml --variable-file
../shared/jinja.variables.yml repository.yml --environment ../shared/ --output
${SCRIPTDIR}/generated-pipeline.yml || exit 1
+
popd 2>&1 > /dev/null
cp ${SCRIPTDIR}/generated-pipeline.yml
${OUTPUT_DIRECTORY}/generated-pipeline.yml
diff --git a/ci/pipelines/pull-request/jinja.template.yml
b/ci/pipelines/pull-request/jinja.template.yml
index 6be610d..bcec2a1 100644
--- a/ci/pipelines/pull-request/jinja.template.yml
+++ b/ci/pipelines/pull-request/jinja.template.yml
@@ -15,8 +15,8 @@
# limitations under the License.
#
-{% from 'shared/shared_jinja.yml' import alpine_tools_config with context %}
-{% from 'shared/shared_jinja.yml' import pipeline_prefix with context %}
+{% from 'shared_jinja.yml' import alpine_tools_config with context %}
+{% from 'shared_jinja.yml' import pipeline_prefix with context %}
groups:
- name: main
@@ -264,7 +264,11 @@ jobs:
GRADLE_TASK_OPTIONS: ""
MAINTENANCE_VERSION: {{repository.branch}}
PARALLEL_DUNIT: {{test.PARALLEL_DUNIT}}
+ {% if test.PARALLEL_GRADLE is defined %}
PARALLEL_GRADLE: {{test.PARALLEL_GRADLE}}
+ {% else %}
+ PARALLEL_GRADLE: true
+ {% endif %}
ARTIFACT_BUCKET: ((artifact-bucket))
SERVICE_ACCOUNT: ((concourse-gcp-account))
GRADLE_GLOBAL_ARGS: ((gradle-global-args))
diff --git a/ci/pipelines/render.py b/ci/pipelines/render.py
index 62227be..ffd7d30 100755
--- a/ci/pipelines/render.py
+++ b/ci/pipelines/render.py
@@ -17,80 +17,190 @@
# limitations under the License.
#
+"""This script performs a multi-pass render of a Jinja templated file.
+See the argparse help for details."""
import argparse
import logging
+import os
+import pprint
+from itertools import combinations
+from typing import List, Dict
+import jinja2.exceptions
import yaml
from jinja2 import Environment, FileSystemLoader, Undefined
-import jinja2.exceptions
-import os
-import subprocess
-
-def main(template_dir_name, geode_fork, geode_branch, upstream_fork,
repository_public):
-
- 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_]),
- extensions=['jinja2.ext.do']
- )
- template = env.get_template(template_file)
-
- with open(variables_file, 'r') as variablesFromYml:
- variables = yaml.load(variablesFromYml)
- variables['repository']['branch'] = geode_branch
- variables['repository']['fork'] = geode_fork
- variables['repository']['upstream_fork'] = upstream_fork
- variables['repository']['public'] = repository_public
-
- # 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:
- pipeline_file.write(template.render(variables))
+RENDER_PASS_LIMIT = 5
class RaiseExceptionIfUndefined(Undefined):
- def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
+ """If a variable is not defined, do not interpolate it to be an empty
string per Jinja's default behavior.
+ Rather, the render script should fail vocally.
- def __str__(self):
- raise jinja2.exceptions.UndefinedError("Interpolating undefined
variables has been disabled.")
+ The actual failure must be raised in __str__, when the renderer attempts
to interpolate this value.
+ """
- def __iter__(self):
- raise jinja2.exceptions.UndefinedError("Interpolating undefined
variables has been disabled.")
+ def __str__(self):
+ raise jinja2.exceptions.UndefinedError(f"Could not find variable
definition for '{self._undefined_name}'.")
+
+
+def render_template(template_file: str,
+ variables_files: List[str], environment_dirs: List[str],
+ command_line_variable_options: List[Dict],
+ print_rendered: bool, output_file: str):
+ env = get_environment(environment_dirs, template_file)
+ variables = determine_variables(command_line_variable_options,
variables_files)
+ template = env.get_template(os.path.basename(template_file))
+ rendered_template = multipass_render(template, variables)
+
+ if print_rendered:
+ print(rendered_template)
+
+ logging.debug(f"Writing to output '{output_file}'")
+ with open(output_file, 'w') as pipeline_file:
+ pipeline_file.write(rendered_template)
+
+
+def get_environment(environment_dirs, template_file):
+ """Gets the Jinja Environment for the renderer.
+ Uses a FileSystemLoader with the specified environment dirs, as well as
the directory containing the template_file.
+ Raises an error if any variable cannot be resolved."""
+ environment_searchpath = [get_absolute_dirname(template_file)] +
environment_dirs
+ logging.debug(f"Environment search
path:\n{pprint.pformat(environment_searchpath)}")
+ env = Environment(loader=FileSystemLoader(environment_searchpath),
+ extensions=['jinja2.ext.do'],
+ undefined=RaiseExceptionIfUndefined,
+ )
+ return env
+
+
+def multipass_render(template, variables):
+ f"""Performs a multiple-pass render of the template file, allowing
variables to reference other variables.
+ Performs at most RENDER_PASS_LIMIT (={RENDER_PASS_LIMIT}) passes.
+ """
+ this_template = template
+ for i in range(1, RENDER_PASS_LIMIT + 1):
+ logging.debug(f"Performing render pass {i}...")
+
+ this_template = this_template.render(variables)
+ if "{{" not in this_template:
+ return this_template
+ raise RuntimeError(f"Variables not eliminated from template after
{RENDER_PASS_LIMIT} passes."
+ f" Please verify that template variables references to
not recurse.")
+
+
+def determine_variables(command_line_variable_options: List[Dict],
variables_files):
+ """Merges variables from each specified variable file and any command-line
specified variables,
+ warning when conflicts exist."""
+ # For safety purposes, we first generate a list of tuples for each
specified variable,
+ # where each tuple is of the form (source, key, value).
+ variable_list = [(source, key, value)
+ for source in variables_files
+ for key, value in get_variables_from_file(source).items()]
+ # Add any command-line variables last to give them the highest priority
+ variable_list.extend([
+ ("command-line option", k, v)
+ for cmd_opt in command_line_variable_options
+ for k, v in cmd_opt.items()
+ ])
+ # Scan though the variable set to make sure there are no conflicts
+ for (s1, k1, v1), (s2, k2, v2) in combinations(variable_list, 2):
+ if k1 == k2 and v1 == v2:
+ logging.info(f"Key value pair ({k1}: {v1}) is duplicated in
variable files {s1} and {s2}")
+ if k1 == k2 and v1 != v2:
+ logging.warning(f"Conflicting variable specifications provided.\n"
+ f"Key value pair from {s1}:\n"
+ f" {k1}: {v1}\n"
+ f"has been overwritten by {s2}:\n"
+ f" {k2}: {v2}")
+
+ # Here as above, we maintain load order so that later-specified variable
files will overwrite earlier-specified.
+ variables = {key: value for _, key, value in variable_list}
+
+ logging.debug(f"Variables:\n{pprint.pformat(variables)}\n")
+
+ return variables
+
+
+def get_variables_from_file(absolute_var_file):
+ logging.debug(f"Loading variables from file {absolute_var_file}")
+ with open(absolute_var_file, 'r') as variablesFromYml:
+ return yaml.load(variablesFromYml)
+
+
+def get_absolute_dirname(some_path):
+ """If the path given is a directory, returns the absolute path to that
directory.
+ If the path given is a file, returns the absolute path to the directory
containing that file.
+ Errors if the path does not exist or could not otherwise resolve."""
+ absolute_path = os.path.abspath(some_path)
+ if os.path.isfile(absolute_path):
+ return os.path.abspath(os.path.dirname(os.path.abspath(absolute_path)))
+
+ if os.path.isdir(absolute_path):
+ return os.path.abspath(absolute_path)
+
+ if not os.path.exists(absolute_path):
+ raise FileNotFoundError(f"Path '{absolute_path}' does not exist.")
+
+ raise ValueError(f"Something strange happened attempting to resolve the
absolute dirname of '{absolute_path}'")
if __name__ == '__main__':
+ # All files / directories specified are converted to absolute paths by the
ArgParser
parser = argparse.ArgumentParser()
- parser.add_argument("template_dir_name", help="Directory containing Jinja
template file.")
- parser.add_argument("geode_fork", help="Name of the git fork")
- parser.add_argument("geode_branch", help="Branch against which
pull-requests are made")
- parser.add_argument("upstream_fork", help="Name of the upstream into which
this fork would merge")
- parser.add_argument("repository_public", help="Is repository public?")
- # 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")
+ parser.add_argument("template",
+ help="Jinja template file.",
+ type=lambda s: os.path.abspath(s)
+ )
+ parser.add_argument("--variable-file",
+ help="Jinja variables file. Multiple files can be
provided."
+ " You will be warned if any definitions collide."
+ " Preference will be given to the file specified
last.",
+ nargs='+',
+ default=[],
+ type=lambda s: os.path.abspath(s))
+ parser.add_argument("--environment",
+ help="Additional directories to pass to the Jinja
environment, e.g.,"
+ " a 'shared/' directory containing files
referenced by name,"
+ " e.g., '{%% from shared_jinja.yml import x with
context %%}'",
+ nargs="+",
+ default=[],
+ type=get_absolute_dirname
+ )
+ parser.add_argument("--raw-variable",
+ help="YML or JSON string defining additional
variables."
+ " This option has preference greater than
variable files.",
+ nargs="+",
+ default=[],
+ type=lambda s: yaml.load(s))
+ parser.add_argument("-o",
+ "--output",
+ help="Output file",
+ default=f"generated-pipeline.yml",
+ type=lambda s: os.path.abspath(s))
+ parser.add_argument("--print-to-console",
+ help="Prints the rendered file before writing to
--output",
+ action="store_true")
+ parser.add_argument("--debug",
+ help="It's debug. If you have to ask, you'll never
know.",
+ action="store_true")
+ parser.add_argument("--info",
+ help="It's info. It's like a lazy --debug.",
+ action="store_true")
_args = parser.parse_args()
if _args.debug:
logging.getLogger().setLevel(logging.DEBUG)
-
- logging.debug(f"cwd: {os.getcwd()}")
-
- main(_args.template_dir_name, _args.geode_fork, _args.geode_branch,
_args.upstream_fork, _args.repository_public)
-
+ elif _args.info:
+ logging.getLogger().setLevel(logging.INFO)
+ else:
+ logging.getLogger().setLevel(logging.WARNING)
+
+ # Preprocess file arguments so that we only deal with absolute paths.
+ render_template(_args.template,
+ _args.variable_file,
+ _args.environment,
+ _args.raw_variable,
+ _args.print_to_console,
+ _args.output)
diff --git a/ci/pipelines/shared/jinja.variables.yml
b/ci/pipelines/shared/jinja.variables.yml
index 81b95c5..345e111 100644
--- a/ci/pipelines/shared/jinja.variables.yml
+++ b/ci/pipelines/shared/jinja.variables.yml
@@ -57,6 +57,7 @@ java_test_versions:
version: 11
benchmarks:
+ baseline_branch: "develop"
baseline_version: "1.8.0"
java_build_version: