1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
@Library('utils') import edu.stsci.jscu.*
// [skip ci] and [ci skip] have no effect here.
if (utils.scm_checkout(['skip_disable':true])) return
// Allow modification of the job configuration, affects all relevant build configs.
// Pass this object in the argument list to the`run()` function below to apply these settings to the job's execution.
jobconfig = new JobConfig()
//jobconfig.post_test_summary = true
//jobconfig.credentials = ['SECRET_VALUE']
//jobconfig.enable_env_publication = true
//jobconfig.publish_env_on_success_only = false
// Pytest wrapper
def PYTEST_BASETEMP = "test_outputs"
def PYTEST = "pytest \
-r s \
--basetemp=${PYTEST_BASETEMP} \
--junit-xml=results.xml"
// Configure artifactory ingest
data_config = new DataConfig()
data_config.server_id = 'bytesalad'
data_config.root = '${PYTEST_BASETEMP}'
data_config.match_prefix = '(.*)_result' // .json is appended automatically
data_unmanaged = new DataConfig()
data_unmanaged.server_id = 'bytesalad'
data_unmanaged.managed = false
data_unmanaged.insert("pytest_result",
["files":
[[
"pattern": "results*.xml",
"target": "datb-generic/shared_utils/"
]]
]
)
bc0 = new BuildConfig()
//bc0.nodetype = 'RHEL-6'
bc0.nodetype = 'linux'
bc0.name = 'First buildconfig'
bc0.env_vars = ['VAR_ONE=1',
'VAR_TWO=2']
bc0.conda_ver = '4.6.4'
bc0.conda_packages = ['python=3.6',
'pytest']
bc0.build_cmds = ["env",
"ls -al ..", // Workspace root.
"ls -al", // Project clone dir.
"conda config --show",
"./access_env_var.sh",
"which python",
"conda install ipython"]
bc0.test_cmds = ["${PYTEST} tests/test_75pass.py"]
bc0.test_configs = [data_config]
bc1 = utils.copy(bc0)
bc1.name = 'Second'
bc1.env_vars = ['VAR_THREE=3',
'VAR_FOUR=4']
bc1.test_cmds[1] = "${PYTEST} tests/test_25pass.py"
bc2 = utils.copy(bc0)
bc2.name = 'Third build config'
bc2.conda_packages = ['python=3.6']
bc2.build_cmds = ["env",
"which python"]
bc2.test_cmds = ["ls -al ..", // Workspace root.
"ls -al"] // Project clone dir.
bc2.test_configs = []
bc3 = utils.copy(bc0)
bc3.name = "Fourth build config"
bc3.test_configs = [data_unmanaged]
utils.run([bc0, bc1, bc2, bc3, jobconfig])
|