blob: 7addf0d50b4ed0b6823f636136611a6e5d19263d [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") {
14 git url: '$CI_SCRIPTS_REPO', branch: 'master', credentialsId: 'GIT_SSH_KEY'
15 }
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("""
23 if [ -z "\$GERRIT_HOST" ] ; then
24 echo Not running for a Gerrit change, skipping vote.
25 exit 0
26 fi
27 if [ ! -d venv ] ; then
28 virtualenv -p \$(which python3) venv
29 fi
30 . venv/bin/activate
31 pip -q install requests
32 ./tf-m-ci-scripts/jenkins/verify.py --category ${category} --value ${value} --verify-name ${verify_name} --user \$VERIFY_USER
33 """)
34 }
35}
36
37def comment(comment) {
38 node("docker-amd64-xenial") {
39 cleanWs()
40 dir("tf-m-ci-scripts") {
41 git url: '$CI_SCRIPTS_REPO', branch: 'master', credentialsId: 'GIT_SSH_KEY'
42 }
43 commentInWorkspace(comment)
44 }
45}
46
47def commentInWorkspace(comment) {
48 withCredentials([usernamePassword(credentialsId: 'VERIFY_STATUS', passwordVariable: 'GERRIT_PASSWORD', usernameVariable: 'GERRIT_USER')]) {
49 sh("""
50 if [ -z "\$GERRIT_HOST" ] ; then
51 echo Not running for a Gerrit change, skipping.
52 exit 0
53 fi
54 if [ ! -d venv ] ; then
55 virtualenv -p \$(which python3) venv
56 fi
57 . venv/bin/activate
58 pip -q install requests
59 ./tf-m-ci-scripts/jenkins/comment.py --comment "${comment}" --user \$GERRIT_USER
60 """)
61 }
62}