[JENKINS] pipeline 작성


git lab 설정에서 webhook (push Event) 이후 작성 정의(pipeline)

pipeline script

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

pipeline {
agent any

tools {nodejs "node"}

stages {
stage('Cloning Git') {
steps {
git url: 'https://xxx.xxxxx.com/bittorage/WebServer.git',
credentialsId: 'gitlab-skarl-passwd',
branch: 'develop'
}
}

stage('Install dependencies') {
steps {
sh 'npm install'
}
}

stage('Test') {
steps {
sh 'npm test'
}
}
}
}

실행

실행

로그

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
106
107
108
109
110
111
112
113
114
115
116
Started by GitLab push by 
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/pipe1
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Tool Install)
[Pipeline] tool
[Pipeline] envVarsForTool
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Cloning Git)
[Pipeline] tool
[Pipeline] envVarsForTool
[Pipeline] withEnv
[Pipeline] {
[Pipeline] git
using credential gitlab-skarl-passwd
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://xxx.xxxxxxx.com/bittorage/WebServer.git # timeout=10
Fetching upstream changes from https://xxx.xxxxxxx.com/bittorage/WebServer.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials gitlab-skarl-passwd
> git fetch --tags --progress https://xxx.xxxxxxx.com/bittorage/WebServer.git +refs/heads/*:refs/remotes/origin/*
skipping resolution of commit remotes/origin/develop, since it originates from another repository
> git rev-parse refs/remotes/origin/develop^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/develop^{commit} # timeout=10
Checking out Revision 449b52612009786e6e7ae37841f57b3602fc89ff (refs/remotes/origin/develop)
> git config core.sparsecheckout # timeout=10
> git checkout -f 449b52612009786e6e7ae37841f57b3602fc89ff
> git branch -a -v --no-abbrev # timeout=10
> git branch -D develop # timeout=10
> git checkout -b develop 449b52612009786e6e7ae37841f57b3602fc89ff
Commit message: "모카 테스트 예제 추가"
> git rev-list --no-walk a7271488613cc3aeb66bd06be08603e458a57c40 # timeout=10
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Install dependencies)
[Pipeline] tool
[Pipeline] envVarsForTool
[Pipeline] withEnv
[Pipeline] {
[Pipeline] sh
+ npm install
npm WARN webserver@0.1.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.6 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.6: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

audited 17564 packages in 18.837s
found 7 vulnerabilities (1 moderate, 6 high)
run `npm audit fix` to fix them, or `npm audit` for details
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Test)
[Pipeline] tool
[Pipeline] envVarsForTool
[Pipeline] withEnv
[Pipeline] {
[Pipeline] sh
+ npm test

> webserver@0.1.0 test /var/lib/jenkins/workspace/pipe1
> mocha ./test/Websocket.test.ts --exit



Sample route
Server is running in process 11973 listening on PORT 1344

Parsing session from request...
no passport
JHnljEKqdbSt48woI0AdXGC6IAZZnU91
open
undefined
{"trCode":42,"message": {} }
code= { trCode: 42, message: {} }
setStorageSock
2019-04-24 10:53:00,528 INFO [STORAGE:NOTICE:CONTROLLER] StorageNoticeController init
faq key= 42
msg Cannot read property 'publish' of undefined
key=== 42
{ networkType: 0,
trCode: 42,
result: 0,
message:
[ { createDate: null, lastModifiedDate: null }] }


✓ STORAGE Test (104ms)
after


1 passing (191ms)

[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Triggering a new build of ansible-project #2
Finished: SUCCESS