forked from pagopa-archive/pdnd-uservice-rest-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
68 lines (51 loc) · 1.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
pipeline {
agent none
stages {
stage('Deploy DAGS') {
agent { label 'sbt-template' }
environment {
NEXUS = 'gateway.pdnd.dev'
NEXUS_CREDENTIALS = credentials('pdnd-nexus')
}
steps {
container('sbt-container') {
script {
sh '''
curl -sL https://deb.nodesource.com/setup_10.x | bash -
apt-get install -y nodejs
npm install @openapitools/openapi-generator-cli -g
openapi-generator-cli version
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
docker login $NEXUS -u $NEXUS_CREDENTIALS_USR -p $NEXUS_CREDENTIALS_PSW
'''
sh '''#!/bin/bash
export DOCKER_REPO=$NEXUS
sbt generateCode docker:publish
'''
}
}
}
}
stage('Apply Kubernetes files') {
agent { label 'sbt-template' }
steps{
// we should use a container with kubectl preinstalled
container('sbt-container') {
withKubeConfig([credentialsId: 'kube-config']) {
sh '''
cd kubernetes
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
chmod u+x ./kubectl
chmod u+x undeploy.sh
chmod u+x deploy.sh
cp kubectl /usr/local/bin/
./undeploy.sh
./deploy.sh
'''
}
}
}
}
}
}