diff --git a/.gitignore b/.gitignore index 4eaed2111c..af5ce57919 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ var/ *.egg-info/ .installed.cfg *.egg +external/ # Ignore Mac DS_Store files .DS_Store diff --git a/reframe/frontend/ci.py b/reframe/frontend/ci.py index bd48df85ef..6caf50fe11 100644 --- a/reframe/frontend/ci.py +++ b/reframe/frontend/ci.py @@ -5,6 +5,7 @@ import os import sys +import copy import yaml import reframe.core.exceptions as errors @@ -21,6 +22,17 @@ def _emit_gitlab_pipeline(testcases, child_pipeline_opts): recurse = config.get('general/0/check_search_recursive') verbosity = 'v' * config.get('general/0/verbose') + # Collect the generate CI options + before_script = config.get('generate-ci/0/before_script') + after_script = config.get('generate-ci/0/after_script') + artifacts = config.get('generate-ci/0/artifacts') + artifacts_expiry = config.get('generate-ci/0/artifacts_expiry') + + # Need to append prefix to artifacts + artifacts = [os.path.join(prefix, a) + if a in ['perflogs', 'stage', 'output'] + else a for a in artifacts] + def rfm_command(testcase): # Ignore the first argument, it should be '' config_opt = ' '.join([f'-C {arg}' for arg in config.sources[1:]]) @@ -64,9 +76,13 @@ def rfm_command(testcase): for tc in testcases: json[f'{tc.check.unique_name}'] = { 'stage': f'rfm-stage-{tc.level}', + 'before_script': copy.deepcopy(before_script), 'script': [rfm_command(tc)], + 'after_script': copy.deepcopy(after_script), 'artifacts': { - 'paths': [f'{tc.check.unique_name}-report.json'] + 'paths': [f'{tc.check.unique_name}-report.json', + f'{tc.check.unique_name}-report.xml'] + artifacts, + 'expire_in': artifacts_expiry, }, 'needs': [t.check.unique_name for t in tc.deps] } diff --git a/reframe/schemas/config.json b/reframe/schemas/config.json index 697004ebbb..85b0bebce8 100644 --- a/reframe/schemas/config.json +++ b/reframe/schemas/config.json @@ -394,6 +394,32 @@ "additionalProperties": false } }, + "generate-ci": { + "type": "array", + "items": { + "type": "object", + "properties": { + "before_script": { + "type": "array", + "items": {"type": "string"} + }, + "after_script": { + "type": "array", + "items": {"type": "string"} + }, + "artifacts": { + "type": "array", + "items": { + "type": "string", + "enum": ["perflogs", "output", "stage"] + } + }, + "target_systems": {"$ref": "#/defs/system_ref"}, + "artifacts_expiry": {"type": "string"} + }, + "additionalProperties": false + } + }, "logging": { "type": "array", "items": { @@ -506,6 +532,11 @@ "required": ["systems", "environments", "logging"], "additionalProperties": false, "defaults": { + "generate-ci/after_script": ["echo 'noop'"], + "generate-ci/before_script": ["echo 'noop'"], + "generate-ci/artifacts": [], + "generate-ci/artifacts_expiry": "30 days", + "generate-ci/target_systems": ["*"], "environments/modules": [], "environments/env_vars": [], "environments/variables": [],