From 2386f7582a37e633f273a703cf5c868d8b093bd1 Mon Sep 17 00:00:00 2001 From: Scott Wittenburg Date: Wed, 17 Jun 2020 16:11:48 -0600 Subject: Support variable interpolation at pipeline generation time --- lib/spack/spack/ci.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/spack/spack/ci.py b/lib/spack/spack/ci.py index ce411e09db..bf2b18ebc8 100644 --- a/lib/spack/spack/ci.py +++ b/lib/spack/spack/ci.py @@ -7,6 +7,7 @@ import base64 import datetime import json import os +import re import shutil import tempfile import zlib @@ -40,6 +41,8 @@ JOB_RETRY_CONDITIONS = [ spack_gpg = SpackCommand('gpg') spack_compiler = SpackCommand('compiler') +runner_var_regex = re.compile('\\$env:(.+)$') + class TemporaryDirectory(object): def __init__(self): @@ -575,6 +578,13 @@ def generate_gitlab_ci_yaml(env, print_summary, output_file, variables = {} if 'variables' in runner_attribs: variables.update(runner_attribs['variables']) + for name, value in variables.items(): + m = runner_var_regex.search(value) + if m: + env_var = m.group(1) + interp_value = os.environ.get(env_var, None) + if interp_value: + variables[name] = interp_value image_name = None image_entry = None -- cgit v1.2.3-70-g09d2