blob: bbfd7435e0dd1569d975debccc1b5c128f3644fb [file] [log] [blame]
Dean Birchd0f9f8c2020-03-26 11:10:33 +00001/*
2 * Copyright (c) 2020, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8package org.trustedfirmware
9
Paul Sokolovsky741b30b2024-07-05 12:21:20 +030010
11def checkout_ci_scripts() {
12 checkout([
13 $class: 'GitSCM',
14 branches: [[name: '$CI_SCRIPTS_BRANCH']],
15 userRemoteConfigs: [[
16 credentialsId: 'GIT_SSH_KEY',
17 url: '$CI_SCRIPTS_REPO',
18 refspec: '+refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/remotes/origin/refs/changes/*'
19 ]]
20 ])
21}
22
Dean Birchd0f9f8c2020-03-26 11:10:33 +000023def verifyStatus(value, verify_name, category) {
Paul Sokolovskye1ad4772024-03-07 00:08:27 +070024 node("docker-amd64-tf-m-jammy") {
Dean Birchd0f9f8c2020-03-26 11:10:33 +000025 cleanWs()
26 dir("tf-m-ci-scripts") {
Paul Sokolovsky741b30b2024-07-05 12:21:20 +030027 checkout_ci_scripts()
Dean Birchd0f9f8c2020-03-26 11:10:33 +000028 }
29 verifyStatusInWorkspace(value, verify_name, category)
30 }
31}
32
33def verifyStatusInWorkspace(value, verify_name, category) {
34 withCredentials([usernamePassword(credentialsId: 'VERIFY_STATUS', passwordVariable: 'VERIFY_PASSWORD', usernameVariable: 'VERIFY_USER')]) {
35 sh("""
Dean Birch7fabf4d2020-05-29 16:20:15 +010036 set +e
Dean Birchd0f9f8c2020-03-26 11:10:33 +000037 if [ -z "\$GERRIT_HOST" ] ; then
38 echo Not running for a Gerrit change, skipping vote.
39 exit 0
40 fi
Matthew Dalzell9a24bf12025-07-03 15:26:16 +010041 . /.venv/bin/activate
Dean Birchd0f9f8c2020-03-26 11:10:33 +000042 pip -q install requests
43 ./tf-m-ci-scripts/jenkins/verify.py --category ${category} --value ${value} --verify-name ${verify_name} --user \$VERIFY_USER
44 """)
45 }
46}
47
48def comment(comment) {
Paul Sokolovskye1ad4772024-03-07 00:08:27 +070049 node("docker-amd64-tf-m-jammy") {
Dean Birchd0f9f8c2020-03-26 11:10:33 +000050 cleanWs()
51 dir("tf-m-ci-scripts") {
Paul Sokolovsky741b30b2024-07-05 12:21:20 +030052 checkout_ci_scripts()
Dean Birchd0f9f8c2020-03-26 11:10:33 +000053 }
54 commentInWorkspace(comment)
55 }
56}
57
58def commentInWorkspace(comment) {
59 withCredentials([usernamePassword(credentialsId: 'VERIFY_STATUS', passwordVariable: 'GERRIT_PASSWORD', usernameVariable: 'GERRIT_USER')]) {
60 sh("""
61 if [ -z "\$GERRIT_HOST" ] ; then
62 echo Not running for a Gerrit change, skipping.
63 exit 0
64 fi
Matthew Dalzell9a24bf12025-07-03 15:26:16 +010065 . /.venv/bin/activate
Dean Birchd0f9f8c2020-03-26 11:10:33 +000066 pip -q install requests
67 ./tf-m-ci-scripts/jenkins/comment.py --comment "${comment}" --user \$GERRIT_USER
68 """)
69 }
70}