blob: 05d8398adbf08f7cc9e3a204449335f1b949d667 [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
10def verifyStatus(value, verify_name, category) {
11 node("docker-amd64-xenial") {
12 cleanWs()
13 dir("tf-m-ci-scripts") {
Matthew Hartfb6fd362020-03-04 21:03:59 +000014 git url: '$CI_SCRIPTS_REPO', branch: '$CI_SCRIPTS_BRANCH', credentialsId: 'GIT_SSH_KEY'
Dean Birchd0f9f8c2020-03-26 11:10:33 +000015 }
16 verifyStatusInWorkspace(value, verify_name, category)
17 }
18}
19
20def verifyStatusInWorkspace(value, verify_name, category) {
21 withCredentials([usernamePassword(credentialsId: 'VERIFY_STATUS', passwordVariable: 'VERIFY_PASSWORD', usernameVariable: 'VERIFY_USER')]) {
22 sh("""
Dean Birch7fabf4d2020-05-29 16:20:15 +010023 set +e
Dean Birchd0f9f8c2020-03-26 11:10:33 +000024 if [ -z "\$GERRIT_HOST" ] ; then
25 echo Not running for a Gerrit change, skipping vote.
26 exit 0
27 fi
28 if [ ! -d venv ] ; then
29 virtualenv -p \$(which python3) venv
30 fi
31 . venv/bin/activate
32 pip -q install requests
33 ./tf-m-ci-scripts/jenkins/verify.py --category ${category} --value ${value} --verify-name ${verify_name} --user \$VERIFY_USER
34 """)
35 }
36}
37
38def comment(comment) {
39 node("docker-amd64-xenial") {
40 cleanWs()
41 dir("tf-m-ci-scripts") {
Matthew Hartfb6fd362020-03-04 21:03:59 +000042 git url: '$CI_SCRIPTS_REPO', branch: '$CI_SCRIPTS_BRANCH', credentialsId: 'GIT_SSH_KEY'
Dean Birchd0f9f8c2020-03-26 11:10:33 +000043 }
44 commentInWorkspace(comment)
45 }
46}
47
48def commentInWorkspace(comment) {
49 withCredentials([usernamePassword(credentialsId: 'VERIFY_STATUS', passwordVariable: 'GERRIT_PASSWORD', usernameVariable: 'GERRIT_USER')]) {
50 sh("""
51 if [ -z "\$GERRIT_HOST" ] ; then
52 echo Not running for a Gerrit change, skipping.
53 exit 0
54 fi
55 if [ ! -d venv ] ; then
56 virtualenv -p \$(which python3) venv
57 fi
58 . venv/bin/activate
59 pip -q install requests
60 ./tf-m-ci-scripts/jenkins/comment.py --comment "${comment}" --user \$GERRIT_USER
61 """)
62 }
63}