forked from ARGOeu/eosc-recommender-metrics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
85 lines (84 loc) · 2.59 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
84
85
pipeline {
agent {
docker {
image 'node:18-buster'
}
}
options {
checkoutToSubdirectory('eosc-recommender-metrics')
newContainerPerStage()
}
environment {
PROJECT_DIR='eosc-recommender-metrics'
GH_USER = 'newgrnetci'
GH_EMAIL = '<argo@grnet.gr>'
}
stages {
stage('Python syntax style checks') {
agent {
docker {
image 'argo.registry:5000/python3'
args '-u jenkins:jenkins'
}
}
steps {
echo 'Checking Python syntax style with flake8'
sh """
pipenv --python 3
pipenv run pip install flake8
pipenv run python -m flake8 ./
pipenv --rm
"""
}
post {
always {
cleanWs()
}
}
}
stage ('Deploy Docs') {
when {
anyOf {
branch 'master'
branch 'devel'
}
}
steps {
echo 'Publish eosc-recommender-metrics docs...'
sh '''
cd $WORKSPACE/$PROJECT_DIR
cd website
npm install
'''
sshagent (credentials: ['jenkins-master']) {
sh '''
cd $WORKSPACE/$PROJECT_DIR/website
mkdir ~/.ssh && ssh-keyscan -H github.com > ~/.ssh/known_hosts
git config --global user.email ${GH_EMAIL}
git config --global user.name ${GH_USER}
GIT_USER=${GH_USER} USE_SSH=true npm run deploy
'''
}
}
}
}
post{
always {
cleanWs()
}
success {
script{
if ( env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'devel' ) {
slackSend( message: ":rocket: New version of eosc-recommender-metrics docs deployed! Job: $JOB_NAME !\n <https://argoeu.github.io/eosc-recommender-metrics|See them here...>")
}
}
}
failure {
script{
if ( env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'devel' ) {
slackSend( message: ":rain_cloud: Deployment of eosc-recommender-metrics docs failed! Job: $JOB_NAME")
}
}
}
}
}