-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
105 lines (93 loc) · 3.05 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
pipeline {
agent {
dockerfile true
}
options {
buildDiscarder(logRotator(numToKeepStr: '2'))
}
stages {
stage('Build') {
steps {
parallel(
"Build-backend": {
ws(dir: 'backend') {
echo 'INFO: Testing buildenv for backend'
sh 'node --version || true'
sh 'npm --version || true'
echo 'INFO: Building backend'
sh 'rm -rf dansuma-backend && pwd && ls -la'
sh 'git clone https://github.com/kuruho/dansuma-backend.git'
sh 'cd dansuma-backend && pwd && ls -la && npm --verbose install'
// echo 'INFO: Starting backend'
// sh 'cd dansuma-backend && pwd && ls -la && NODE_ENV=production PORT=7001 VOLUMIO_WS=ws://192.168.40.10 node app.js'
}
},
"Build-frontend": {
ws(dir: 'frontend') {
echo 'INFO: Testing buildenv for frontend'
sh 'node --version || true'
sh 'npm --version || true'
echo 'INFO: Building frontend'
sh 'rm -rf dansuma-frontend && pwd && ls -la'
sh 'git clone https://github.com/kuruho/dansuma-frontend'
sh 'cd dansuma-frontend && pwd && ls -la && npm --verbose install'
// echo 'INFO: Starting frontend'
// sh 'cd dansuma-frontend && pwd && ls -la && PORT=7000 WEBSOCKET_URL=http://localhost:7001 npm start'
}
}
)
}
}
stage('Test-on-CI') {
steps {
echo 'TODO: Testing on CI'
}
}
stage('Deploy-to-staging') {
steps {
echo 'TODO: Deploy to staging'
sh '''#!/bin/bash
# DEBUG
id
cat /proc/version
cat /etc/os-release
ssh -V
ssh
ls -la
# Make sure the deployment private key is available
# if [ -e aws-droidcon.key ]; then { echo "docker cp $HOME/ssh/id_rsa myjenkins:/xxx/aws-droidcon.key" }
# Remote login to udooneogm01 via rpi3gm23
# ssh -J [email protected]:122 [email protected] "hostname"
# ssh -p 122 [email protected] ssh [email protected] "hostname"
# TODO
# EOF
'''
// See https://jenkins.io/doc/pipeline/steps/ssh-agent/
sshagent (credentials: ['deploy-dev']) {
echo "DEBUG: Inside SSH Agent"
// sh 'ssh -o StrictHostKeyChecking=no -l cloudbees 192.168.1.106 uname -a'
// sh 'ssh -o StrictHostKeyChecking=no -l pi -p 122 gmhome.solarma.it uname -a'
}
}
}
stage('Test-on-staging') {
steps {
echo 'TODO: Test on staging'
// input message: "Does http://localhost:8888/staging/ look good?"
input message: "Does everything look good on your staging system?"
}
}
stage('Deploy-to-production') {
steps {
echo 'TODO: Deploy to production'
echo 'Hello, world!'
sh '''#!/bin/bash
# Remote login to kuruho-udooquad via rpi3gm23,chipgm32
# ssh -J [email protected]:122,10.23.3.32 [email protected] "hostname"
# TODO
# EOF
'''
}
}
}
}