This is an automated email from the ASF dual-hosted git repository. areusch pushed a commit to branch areusch/overall-jenkins in repository https://gitbox.apache.org/repos/asf/tvm.git
commit 4cb0503502aa10eab274f78e546cc9be1e92ae31 Author: Andrew Reusch <[email protected]> AuthorDate: Thu Apr 6 09:43:49 2023 -0700 Add overall-jenkins build as a test. --- ci/jenkins/generated/overall_jenkinsfile.groovy | 43 ++++++++++++++++++++++ ci/jenkins/templates/overall_jenkinsfile.groovy.j2 | 43 ++++++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/ci/jenkins/generated/overall_jenkinsfile.groovy b/ci/jenkins/generated/overall_jenkinsfile.groovy new file mode 100644 index 0000000000..c7ce6b8385 --- /dev/null +++ b/ci/jenkins/generated/overall_jenkinsfile.groovy @@ -0,0 +1,43 @@ +def findSha1(b) { + for (hudson.scm.SCM s : b.getProperties().get("SCMs")) { + try { + hudson.plugins.git.GitSCM gs = (hudson.plugins.git.GitSCM)s; + hudson.plugins.git.util.BuildData bd = gs.getBuildData(b); + return bd.getLastBuiltRevision().getSha1String(); + } catch (ClassCastException e) { + } + } + return ""; +} + + +def getBuilds(jobNames, branch, sha1) { + var jobs = {}; + for (String ciBuildName : jobNames) { + job = Jenkins.instance.getItemByFullName(ciBuildName).getItem(branch); + int num = 0; + for (org.jenkinsci.plugins.workflow.job.WorkflowRun b : job.getNewBuilds()) { + num++; + if (findSha1(b) == sha1) { + jobs[ciBuildName] = b; + break; + } + } + } + return jobs; +} + +PROJECT_NAMES = ["tvm-cortexm", "tvm-cpu"]); + +if (!env.BRANCH_NAME.startsWith("PR-")) { + waitUntil { + var jobs = getBuilds(PROJECT_NAMES, env.BRANCH_NAME, env.COMMIT_ID) + if (jobs.size() != PROJECT_NAMES.length()) { + return false; + } + } + + for (var j : jobs.keySet()) { + waitForBuild j + } +} diff --git a/ci/jenkins/templates/overall_jenkinsfile.groovy.j2 b/ci/jenkins/templates/overall_jenkinsfile.groovy.j2 new file mode 100644 index 0000000000..c7ce6b8385 --- /dev/null +++ b/ci/jenkins/templates/overall_jenkinsfile.groovy.j2 @@ -0,0 +1,43 @@ +def findSha1(b) { + for (hudson.scm.SCM s : b.getProperties().get("SCMs")) { + try { + hudson.plugins.git.GitSCM gs = (hudson.plugins.git.GitSCM)s; + hudson.plugins.git.util.BuildData bd = gs.getBuildData(b); + return bd.getLastBuiltRevision().getSha1String(); + } catch (ClassCastException e) { + } + } + return ""; +} + + +def getBuilds(jobNames, branch, sha1) { + var jobs = {}; + for (String ciBuildName : jobNames) { + job = Jenkins.instance.getItemByFullName(ciBuildName).getItem(branch); + int num = 0; + for (org.jenkinsci.plugins.workflow.job.WorkflowRun b : job.getNewBuilds()) { + num++; + if (findSha1(b) == sha1) { + jobs[ciBuildName] = b; + break; + } + } + } + return jobs; +} + +PROJECT_NAMES = ["tvm-cortexm", "tvm-cpu"]); + +if (!env.BRANCH_NAME.startsWith("PR-")) { + waitUntil { + var jobs = getBuilds(PROJECT_NAMES, env.BRANCH_NAME, env.COMMIT_ID) + if (jobs.size() != PROJECT_NAMES.length()) { + return false; + } + } + + for (var j : jobs.keySet()) { + waitForBuild j + } +}
