-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
96 lines (77 loc) · 2.73 KB
/
Jenkinsfile
File metadata and controls
96 lines (77 loc) · 2.73 KB
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
pipeline {
parameters {
string(name: 'TEST_REPO_URL', defaultValue: 'https://github.com/auto-qa-course/python-framework-example.git', 'Please provide QA repo url.')
string(name: 'TEST_BRANCH', defaultValue: 'lesson3', 'Please provide QA repo branch.')
}
agent {
node {
label 'master'
}
}
options {
timestamps()
}
environment {
QA_ENV='QA'
STAGE_ENV='Stage'
}
stages {
stage('Build & Unit tests') {
steps {
sh('echo pass')
}
}
stage('SonarQube Scan') {
steps {
sh('echo pass')
}
}
stage('Publish') {
steps {
sh('echo pass')
}
}
stage('Deploy to QA env') {
steps {
sh('echo pass')
}
}
stage("Integration testing") {
steps {
git url: '$TEST_REPO_URL', branch: '${TEST_BRANCH}'
sh('''
rm out_docker_results/**/*.json || echo 'no json files'
docker build -t automation_demo .
mkdir out_docker_results || echo 'out_docker_results dir exists'
docker run -v $(pwd)/out_docker_results:/out:rw -e "ENVIRONMENT=$QA_ENV" -e "TEST_TYPE=api" -e "RESULTS_FOLDER=outputs" -i automation_demo /bin/bash -c "pytest test/api/test_healthcheck.py --alluredir /out"
docker run -v $(pwd)/out_docker_results:/out:rw -e "ENVIRONMENT=$QA_ENV" -e "TEST_TYPE=api" -e "RESULTS_FOLDER=outputs" -i automation_demo /bin/bash -c "pytest test/api/contacts --alluredir /out"
''')
allure includeProperties: false, jdk: '', results: [[path: 'out_docker_results']]
}
}
stage('Request approval for deploy to Stage') {
steps {
script {
timeout(time:10, unit:'MINUTES') {
while (true) {
userPasswordInput = input(id: 'userPasswordInput',
message: 'Please approve deploy to Stage. Enter password to proceed.',
parameters: [[$class: 'StringParameterDefinition', defaultValue: '', name: 'Password']])
if (userPasswordInput=='Yes') { break }
}
}
}
}
}
stage('Deploy to Stage env') {
steps {
sh('echo pass')
}
}
}
post {
failure {
allure includeProperties: false, jdk: '', results: [[path: 'out_docker_results']]
}
}
}