-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
83 lines (75 loc) · 2.09 KB
/
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
pipeline {
agent any
environment {
ALLURE = '2.29.0'
TOKEN = 'glpat-64VubsDGWUwgPgYkgEjs'
}
parameters {
choice(
name: 'Browser',
choices: ['Firefox', 'Chrome', 'Chromium', 'Edge'],
description: 'The browser to test'
)
}
stages {
stage('Test') {
agent {
docker {
image 'harmin/qa-runner-debian'
args '--user test:test --workdir /home/test --env PATH=/usr/local/bin:/usr/bin:/home/test/.local/bin'
}
}
steps {
sh '''
export PATH=$PATH:$HOME/.local/bin
echo $PATH
python3 -m venv $HOME/venv
. $HOME/venv/bin/activate
./docker.sh --browser $Browser --docker playwright/python
echo "$BUILD_URL/console" > reporting/allure-results/python/job.url
'''
stash includes: 'reporting/**', name: 'artifact_test'
}
}
stage('Report') {
agent {
docker { image 'openjdk:8-jre' }
}
steps {
unstash 'artifact_test'
sh '''
exit
curl https://github.com/allure-framework/allure2/releases/download/${ALLURE}/allure-${ALLURE}.zip -L -o /tmp/allure.zip
unzip /tmp/allure.zip -d /tmp/
mv /tmp/allure-${ALLURE} /tmp/allure
#./allure.sh --browser $Browser
'''
stash includes: 'reporting/**', name: 'artifact_report'
}
post {
always {
archiveArtifacts artifacts: 'reporting/**'
}
}
}
stage('Commit') {
steps {
unstash 'artifact_report'
sh '''
exit
rm -rf reports
git config --global user.name "Gitlab CI"
git config --global user.email "[email protected]"
git clone https://gitlab-ci-token:${TOKEN}@gitlab.com/harmin-qa/reports.git
mv reporting/allure-reports/* reporting/
rm -rf reporting/allure-reports reporting/allure-results
cp -r reporting/* reports/
cd reports
git add *
git commit -m "Gitlab-CI commit"
git push
'''
}
}
}
}