From 6fe4ddffb63e75f6190188abd35bee03eb348f76 Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Thu, 30 Apr 2026 07:58:32 +0200 Subject: [PATCH 1/3] Add support for the test-tag pragma Signed-off-by: Oksana Salyk --- vars/getCommitTags.groovy | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 vars/getCommitTags.groovy diff --git a/vars/getCommitTags.groovy b/vars/getCommitTags.groovy new file mode 100755 index 000000000..e9e9c4e3e --- /dev/null +++ b/vars/getCommitTags.groovy @@ -0,0 +1,22 @@ +// vars/getCommitTags.groovy + + +def call() { + def commitMsg = sh( + script: "git log -1 --pretty=%B", + returnStdout: true + ).trim() + + def commitTags = [] + + commitMsg.split("\n").each { line -> + if (line.toLowerCase().startsWith("test-tag:")) { + def value = line.split(":", 2)[1].trim() + if (value) { + commitTags.addAll(value.split()) + } + } + } + + return commitTags as Set +} From d048ff40c3fb6e1d9f5bcaf23ed4c2fd02d9f36c Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Wed, 6 May 2026 14:30:23 +0200 Subject: [PATCH 2/3] add getTestTag.groovy file Signed-off-by: Oksana Salyk --- vars/getTestTag.groovy | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 vars/getTestTag.groovy diff --git a/vars/getTestTag.groovy b/vars/getTestTag.groovy new file mode 100755 index 000000000..3abfbffab --- /dev/null +++ b/vars/getTestTag.groovy @@ -0,0 +1,56 @@ +// vars/getTestTag.groovy + + +def call(Map commitPragmaMapping, List paths, String defaultTag = 'pr') { + + def commitTags = getCommitTags() as Set + + def allTags = [] as Set + allTags.addAll(commitTags) + + def ftestTagMap = new org.example.ftest.FtestTagMap( + org.example.ftest.FtestTagMap.allFtestPythonFiles() + ) + + paths.each { path -> + commitPragmaMapping.each { pattern, config -> + if (path ==~ /${pattern}/) { + + def testTagConfig = config.get('test-tag', defaultTag) + + if (testTagConfig instanceof String) { + testTagConfig = [ + tags: testTagConfig, + handler: 'direct' + ] + } + + def handler = testTagConfig.handler + + if (handler == 'FtestTagMap') { + try { + allTags.addAll(ftestTagMap.minimalTags(path)) + } catch (Exception e) { + allTags.addAll(testTagConfig.tags.split(' ')) + } + } else if (handler == 'direct') { + allTags.addAll(testTagConfig.tags.split(' ')) + } else { + error "Invalid handler: ${handler}" + } + + if (testTagConfig.get('stop_on_match', config.get('stop_on_match', false))) { + return + } + } + } + } + + def validTags = ftestTagMap.uniqueTags() + invalid = allTags - validTags + if (invalid) { + error "test-tag does not match any tests: ${invalid.join(', ')}" + } + + return allTags.sort().join(' ') +} From 8494be777e89a5922f4f9ee059854011267862c5 Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Wed, 6 May 2026 14:31:59 +0200 Subject: [PATCH 3/3] Use my branch Signed-off-by: Oksana Salyk --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0a5f1cb39..461b79616 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,7 @@ // That PR should be landed with out deleting the PR branch. // Then a second PR submitted to comment out the @Library line, and when it // is landed, both PR branches can be deleted. -//@Library(value='pipeline-lib@my_branch_name') _ +@Library(value='pipeline-lib@osalyk/SRE-322') _ /* groovylint-disable-next-line CompileStatic */ job_status_internal = [:]