forked from sonata-nfv/tng-sdk-validation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
57 lines (56 loc) · 2.12 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
pipeline {
agent any
stages {
stage('Container Build') {
steps {
echo 'Building..'
sh 'docker build --no-cache -f ./Dockerfile -t registry.sonata-nfv.eu:5000/tng-sdk-validation .'
}
}
stage('Unit Tests') {
steps {
echo 'Unit Testing..'
sh "docker container ls -a | grep redis_docker && docker rm -f redis_docker || true"
sh "docker network ls | grep redis_network && docker network rm redis_network || true"
sh "docker network create --driver bridge redis_network"
sh "docker run -d --name redis_docker -p 6379:6379 --network redis_network redis"
sh "docker run --network redis_network -e VAPI_REDIS_HOST='redis_docker' -i --rm registry.sonata-nfv.eu:5000/tng-sdk-validation pytest -v --ignore=src/tngsdk/validation/gui/"
sh "docker rm -f redis_docker || true"
sh "docker network rm redis_network || true"
}
}
stage('Code Style check') {
steps {
echo 'Checking code style....'
sh "pipeline/checkstyle/check.sh"
}
}
stage('Integration tests (SDK-tools)') {
steps {
echo 'Stage: Integration tests (SDK-tools)'
sh "docker run --rm --name tng-sdk-validation-int registry.sonata-nfv.eu:5000/tng-sdk-validation pipeline/test/test_sdk_integration.sh"
}
}
stage('Containers Publication') {
steps {
echo 'Publishing docker image....'
sh 'docker push registry.sonata-nfv.eu:5000/tng-sdk-validation'
}
}
stage('Promoting release v5.0') {
when {
branch 'v5.0'
}
stages {
stage('Generating release') {
steps {
sh 'docker tag registry.sonata-nfv.eu:5000/tng-sdk-validation:latest registry.sonata-nfv.eu:5000/tng-sdk-validation:v5.0'
sh 'docker tag registry.sonata-nfv.eu:5000/tng-sdk-validation:latest sonatanfv/tng-sdk-validation:v5.0'
sh 'docker push registry.sonata-nfv.eu:5000/tng-sdk-validation:v5.0'
sh 'docker push sonatanfv/tng-sdk-validation:v5.0'
}
}
}
}
}
}