-
Notifications
You must be signed in to change notification settings - Fork 0
/
compose.Jenkins
38 lines (31 loc) · 1.13 KB
/
compose.Jenkins
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
/* Cloning the git branch*/
stage('Clone repository') {
checkout scm
}
/* Start docker-compose with five instances of Chrome */
stage('Start docker-compose') {
sh 'docker-compose up -d --scale chrome=5 --scale firefox=0'
}
/* This builds an image with all pytest selenium scripts in it */
stage('Build image') {
def dockerfile = 'pytest.Dockerfile'
app = docker.build("pytest-with-src","-f ${dockerfile} ./")
}
/* Execute the pytest script. Even on faliure proceed to next step */
stage('Execute script') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh 'docker run --network="host" --rm -i -v ${WORKSPACE}/allure-results:/AllureReports pytest-with-src --executor "remote" --browser "chrome" .'
}
}
/* Delete the image which got created earlier */
stage('Remove image') {
sh 'docker rmi pytest-with-src -f'
}
/* Tear down docker compose */
stage('Teardown docker-compose') {
sh 'docker-compose down --rmi local'
}
/* Generate Allure Report */
stage('Allure Report') {
allure includeProperties: false, jdk: '', results: [[path: 'allure-results']]
}