From 08724557e2fe63b8cbd5dcf9d05c6d4194dbef44 Mon Sep 17 00:00:00 2001 From: juckerj <39263956+jonasjucker@users.noreply.github.com> Date: Wed, 13 Sep 2023 11:49:11 +0200 Subject: [PATCH] [CI] add option to use custom spack-c2sm branch for spack tests (#268) * add option to use custom spack-c2sm branch for spack tests * fix missing declarations * fix missing declarations --------- Co-authored-by: Jonas Jucker --- jenkins/spack-PR | 17 ++++++++++++++++- jenkins/spack-PR-icon | 5 ----- jenkins/spack-PR-stable | 17 ++++++++++++++++- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/jenkins/spack-PR b/jenkins/spack-PR index 322dd30209..e9be0ac87c 100644 --- a/jenkins/spack-PR +++ b/jenkins/spack-PR @@ -1,3 +1,18 @@ +def repo_identifier = "Project" +def spack_fork = "C2SM" +def spack_branch = "main" +String[] triggerPhrase = env.ghprbCommentBody.split(" ") + +def parseTriggerPhrase(it) { + fork = it.split("=")[1].split("/")[0] + branch = it.split("=")[1].split("/")[1] + return [fork, branch] +} +triggerPhrase.each { + if(it.contains("spack${repo_identifier}")) { + (spack_fork, spack_branch) = parseTriggerPhrase(it) + } +} pipeline { agent none stages { @@ -20,7 +35,7 @@ pipeline { stage('Clone Repos') { steps { sh """ - git clone --depth 1 --recurse-submodules --shallow-submodules https://github.com/C2SM/spack-c2sm.git + git clone --depth 1 --recurse-submodules --shallow-submodules -b '${spack_branch}' https://github.com/${spack_fork}/spack-c2sm.git git clone . local_copy """ } diff --git a/jenkins/spack-PR-icon b/jenkins/spack-PR-icon index 7cadc494df..4d0fe56c22 100644 --- a/jenkins/spack-PR-icon +++ b/jenkins/spack-PR-icon @@ -1,11 +1,9 @@ def repo_identifier = "Project" def icon_fork = "C2SM" def icon_branch = "icon-dsl" -def icon_default = true def spack_fork = "C2SM" def spack_branch = "main" -def spack_default = true def gt4py_fork = "GridTools" def gt4py_branch = "icon4py_20230621" @@ -20,19 +18,16 @@ def parseTriggerPhrase(it) { triggerPhrase.each { if(it.contains("icon${repo_identifier}")) { (icon_fork, icon_branch) = parseTriggerPhrase(it) - icon_default = false } } triggerPhrase.each { if(it.contains("spack${repo_identifier}")) { (spack_fork, spack_branch) = parseTriggerPhrase(it) - spack_default = false } } triggerPhrase.each { if(it.contains("gt4py${repo_identifier}")) { (gt4py_fork, gt4py_branch) = parseTriggerPhrase(it) - gt4py_default = false } } diff --git a/jenkins/spack-PR-stable b/jenkins/spack-PR-stable index 78b85b9961..b2a317a4ff 100644 --- a/jenkins/spack-PR-stable +++ b/jenkins/spack-PR-stable @@ -1,3 +1,18 @@ +def repo_identifier = "Project" +def spack_fork = "C2SM" +def spack_branch = "main" +String[] triggerPhrase = env.ghprbCommentBody.split(" ") + +def parseTriggerPhrase(it) { + fork = it.split("=")[1].split("/")[0] + branch = it.split("=")[1].split("/")[1] + return [fork, branch] +} +triggerPhrase.each { + if(it.contains("spack${repo_identifier}")) { + (spack_fork, spack_branch) = parseTriggerPhrase(it) + } +} pipeline { agent none stages { @@ -20,7 +35,7 @@ pipeline { stage('Clone Repos') { steps { sh """ - git clone --depth 1 --recurse-submodules --shallow-submodules https://github.com/C2SM/spack-c2sm.git + git clone --depth 1 --recurse-submodules --shallow-submodules -b '${spack_branch}' https://github.com/${spack_fork}/spack-c2sm.git git clone . local_copy """ }