diff --git a/automation/script/module.py b/automation/script/module.py index 7be9aa8554..ce509b75cc 100644 --- a/automation/script/module.py +++ b/automation/script/module.py @@ -2431,18 +2431,38 @@ def test(self, i): if test_config: logging.info(test_config) test_all_variations = test_config.get('test-all-variations', False) + use_docker = test_config.get('use_docker', False) if test_all_variations: variations = meta.get("variations") individual_variations = [ v for v in variations if variations[v].get('group', '') == '' and str(variations[v].get('exclude-in-test', '')).lower() not in [ "1", "true", "yes" ] ] tags_string = ",".join(meta.get("tags")) for variation in individual_variations: run_tags = f"{tags_string},_{variation}" - r = self.cmind.access({'action':'run', - 'automation':'script', - 'tags': run_tags, - 'quiet': i.get('quiet') }) - if r['return'] > 0: - return r + if use_docker: + docker_images = test_config.get('docker_images', [ "ubuntu-22.04" ]) + for docker_image in docker_images: + ii = {'action':'docker', + 'automation':'script', + 'tags': run_tags, + 'quiet': i.get('quiet'), + 'docker_image': docker_image, + 'docker_image_name': alias + } + if i.get('docker_cm_repo', '') != '': + ii['docker_cm_repo'] = i['docker_cm_repo'] + if i.get('docker_cm_repo_branch', '') != '': + ii['docker_cm_repo_branch'] = i['docker_cm_repo_branch'] + + r = self.cmind.access(ii) + if r['return'] > 0: + return r + else: + r = self.cmind.access({'action':'run', + 'automation':'script', + 'tags': run_tags, + 'quiet': i.get('quiet') }) + if r['return'] > 0: + return r logging.info(' Test: WIP') diff --git a/script/get-generic-sys-util/_cm.json b/script/get-generic-sys-util/_cm.json index e0db7c4944..08df073dfa 100644 --- a/script/get-generic-sys-util/_cm.json +++ b/script/get-generic-sys-util/_cm.json @@ -723,6 +723,10 @@ } }, "tests": { - "test-all-variations": "yes" + "test-all-variations": "yes", + "use_docker": "yes", + "docker_images": [ + "ubuntu-22.04" + ] } } diff --git a/script/run-docker-container/customize.py b/script/run-docker-container/customize.py index 35d3fdf1e4..db7ef766ab 100644 --- a/script/run-docker-container/customize.py +++ b/script/run-docker-container/customize.py @@ -303,7 +303,7 @@ def update_docker_info(env): if env.get('CM_DOCKER_IMAGE_NAME', '') != '': docker_image_name = env['CM_DOCKER_IMAGE_NAME'] else: - docker_image_name = 'cm-script-'+env['CM_DOCKER_RUN_SCRIPT_TAGS'].replace(',', '-').replace('_','-') + docker_image_name = 'cm-script-'+env['CM_DOCKER_RUN_SCRIPT_TAGS'].replace(',', '-').replace('_','-').replace('+','plus') env['CM_DOCKER_IMAGE_NAME'] = docker_image_name docker_image_tag_extra = env.get('CM_DOCKER_IMAGE_TAG_EXTRA', '-latest') diff --git a/tests/script/process_tests.py b/tests/script/process_tests.py index 558c47a2ee..59c3b67694 100644 --- a/tests/script/process_tests.py +++ b/tests/script/process_tests.py @@ -9,7 +9,7 @@ for file in files: print(file) - if not os.path.isfile(file): + if not os.path.isfile(file) or not "script" in file: continue if not file.endswith("_cm.json") and not file.endswith("_cm.yaml"): continue