-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
59 lines (57 loc) · 2.18 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
#!groovy
@Library('PS-Shared-libs') _
node() {
try {
stage('Checkout'){
checkout scm
}
withDockerRegistry(credentialsId: 'ps-ci', toolName: 'master', url: 'https://ps-docker.artifactory.aslab.juniper.net') {
docker.image('ps-docker.artifactory.aslab.juniper.net/py-builder:latest').inside('-u root') {
stage('Cleanup'){
echo 'cleanup'
sh 'rm -rf dist'
sh 'rm -rf .pypirc'
}
stage('Unit tests'){
echo 'Running unit tests'
sh 'python3 setup.py test'
}
stage('Install'){
echo 'Running a test installation'
sh 'pip3 install --no-binary :all: .'
}
stage('Autocomplete'){
echo 'Generate autocomplete'
sh 'python3 autocomplete'
}
stage('Test'){
echo 'Testing help and version'
sh 'nita ?'
sh 'nita cli version'
}
stage('Publish'){
if (env.SOURCE_BRANCH == 'refs/heads/master') {
echo 'Push to Artifactory'
sh 'python3 setup.py sdist'
withCredentials([file(credentialsId:'f1503ca7-3285-4ac6-ae55-5a660658c075', variable: 'PYPIRC')]) {
sh 'ln -s $PYPIRC $HOME/.pypirc'
sh 'python3 setup.py sdist upload -r local'
}
}
else {
echo "Only the master branch is published to the repository"
}
}
stage('Test pull'){
if (env.SOURCE_BRANCH == 'refs/heads/master') {
echo 'Push to Artifactory'
sh 'pip3 install -i https://artifactory.aslab.juniper.net/artifactory/api/pypi/ps-pypi/simple nita-cli'
}
}
}
}
}
finally {
ciSkip action: 'postProcess'
}
}