generated from konveyor/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathPR_TESTER.jenkinsfile
97 lines (96 loc) · 2.97 KB
/
PR_TESTER.jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
@Library('migrationqe-automation-lib') _
pipeline{
agent {
label 'minikube-node'
}
options{
ansiColor('xterm')
}
environment{
PATH="$PATH:/usr/local/go/bin"
JIRA_CLOUD_PASSWORD=credentials('mta_jira_cloud_token')
JIRA_SERVER_TOKEN=credentials('mta_jira_stage_token')
CRED=credentials('tackle_git_pass')
GITHUB_USER="$CRED_USR"
GITHUB_TOKEN="$CRED_PSW"
}
stages{
stage("Check if their are changed tests"){
when{
branch pattern: '^(PR-.*|main)$',
comparator: 'REGEXP';
}
steps{
script{
checkout scm
env.RUN_TESTS = 'false'
if(env.BRANCH_NAME.contains("PR-") && env.CHANGE_TARGET == 'main') {
env.TEST_BRANCH = env.CHANGE_TARGET
env.RUN_TESTS = 'true'
}else if(env.BRANCH_NAME == 'main'){
env.TEST_BRANCH = env.BRANCH_NAME
env.RUN_TESTS = 'true'
}
tackle.setGoTestsEnvVars() //Sets env sensitive env vars
}
}
}
stage('Install & run minikube'){
when {
expression{
env.RUN_TESTS == "true"
}
}
steps{
script{
tackle.setGoTestsEnvVars() //Sets env sensitive env vars
tackle.deployKonveyorOnMinikube(env.TEST_BRANCH)
echo "Applying tackle CR"
tackle.applyTackleCR()
}
}
}
stage('Run tackle go api tests'){
when {
expression{
env.RUN_TESTS == "true"
}
}
steps{
script{
env.MINIKUBE_IP = sh(
script : 'minikube ip',
returnStdout: true
).trim()
env.HUB_BASE_URL="http://"+env.MINIKUBE_IP+"/hub"
ocp.pollRouteUntilReady("http://"+env.MINIKUBE_IP,15,30)
sh "sleep 40s" //Grace period after the application is serving correctly.
sh (script:"make test-tier3",
label: "Running tier3 tests"
)
}
}
}
}
post{
always{
script{
cleanWs()
}
}
success{
script{
if(env.BRANCH_NAME=="main"){
tackle.writeBuildStatus(passed=true,pipeline="tier3-pr")
}
}
}
failure{
script{
if(env.BRANCH_NAME=="main"){
tackle.writeBuildStatus(passed=false,pipeline="tier3-pr")
}
}
}
}
}