Introduce KAS_BUILD_DIR environment variable

This variable can override default build path `${KAS_WORK_DIR}/build`.

Signed-off-by: Peter Hatina <peter@hatina.eu>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Peter Hatina
2021-03-09 21:40:50 +01:00
committed by Jan Kiszka
parent 24c13a491b
commit f32290d425
6 changed files with 57 additions and 6 deletions

View File

@@ -0,0 +1,30 @@
import os
import shutil
from kas import kas
def test_build_dir_is_placed_inside_work_dir_by_default(changedir, tmpdir):
conf_dir = str(tmpdir.mkdir('test_env_variables'))
shutil.rmtree(conf_dir, ignore_errors=True)
shutil.copytree('tests/test_environment_variables', conf_dir)
os.chdir(conf_dir)
kas.kas(['checkout', 'test.yml'])
assert(os.path.exists(os.path.join(os.getcwd(), 'build', 'conf')))
def test_build_dir_can_be_specified_by_environment_variable(changedir, tmpdir):
conf_dir = str(tmpdir.mkdir('test_env_variables'))
build_dir = str(tmpdir.mkdir('test_build_dir'))
shutil.rmtree(conf_dir, ignore_errors=True)
shutil.copytree('tests/test_environment_variables', conf_dir)
shutil.rmtree(build_dir, ignore_errors=True)
os.chdir(conf_dir)
os.environ['KAS_BUILD_DIR'] = build_dir
kas.kas(['checkout', 'test.yml'])
del os.environ['KAS_BUILD_DIR']
assert(os.path.exists(os.path.join(build_dir, 'conf')))

View File

@@ -0,0 +1,3 @@
#!/bin/sh
true

View File

@@ -0,0 +1,5 @@
header:
version: 10
repos:
this: