blob: 732fe5874ec2f4f370e67ab9de55546b159655c9 [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("""
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") {
Matthew Hartfb6fd362020-03-04 21:03:59 +000041 git url: '$CI_SCRIPTS_REPO', branch: '$CI_SCRIPTS_BRANCH', credentialsId: 'GIT_SSH_KEY'
Dean Birchd0f9f8c2020-03-26 11:10:33 +000042 }
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}