记一次Jenkins+Docker+gitlab自动化部署vue

0x00 Jenkins部署

可以参考我另一篇文章:
https://www.cnblogs.com/she11s/p/13177372.html

0x01 Jenkins配置

插件安装

安装并使用 Publish Over SSH插件可以参考另一篇文章:
https://www.cnblogs.com/she11s/p/13277553.html

配置git

这里要进入Jenkins容器进行配置,进入容器的命令为

docker exec -it name /bin/sh
# name为容器名

配置git可以参考另一篇文章:
https://www.cnblogs.com/she11s/p/13276207.html

0x02 创建工程

按照如下图,进行操作






去gitlab页面配置webhook




脚本内内容为:

#!/bin/bash
web_name=$1
web=`docker ps|grep -w $web_name|wc -l`
if [ $web == 1 ]
then
 echo "已存在!!"
else
 echo "不存在,需部署!!"
 docker rm nginx
 docker  run -d --name nginx -p 80:80 -v /home/ubuntu/nginx/html:/usr/share/nginx/html -v /home/ubuntu/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v /home/ubuntu/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf  nginx
fi
#此脚本可根据自己需求进行更改

到此工程基本已经配置完成

0x03 配置Jenkins打包环境

进入容器安装vue打包所需环境,安装命令如下:

apk add nodejs
apk add npm
#因为此容器镜像基于alpine,所以安装命令为apk add
npm install -g cnpm --registry=https://registry.npm.taobao.org
#安装cnpm,使用国内软件源
cnpm install vue
#安装vue
cnpm install --global vue-cli
#全局安装vue2脚手架

0x04 运行


0x05 遇到的困难

最初我安装的是vue脚手架4版本的,直接在服务器上运行打包命令没问题,但是通过Jenkins去运行就会报如下错误,最后通过安装2版本的脚手架解决的。
+ cnpm install

WARN node unsupported "node@v10.19.0" is incompatible with @vue/cli-plugin-babel@4.4.6 › webpack@4.43.0 › watchpack@1.7.2 › watchpack-chokidar2@^2.0.0, expected node@<8.10.0
platform unsupported @vue/cli-plugin-babel@4.4.6 › webpack@4.43.0 › watchpack@1.7.2 › chokidar@3.4.0 › fsevents@~2.1.2 Package require os(darwin) not compatible with your platform(linux)
[fsevents@~2.1.2] optional install error: Package require os(darwin) not compatible with your platform(linux)
platform unsupported @vue/cli-plugin-babel@4.4.6 › webpack@4.43.0 › watchpack@1.7.2 › watchpack-chokidar2@2.0.0 › chokidar@2.1.8 › fsevents@^1.2.7 Package require os(darwin) not compatible with your platform(linux)
[fsevents@^1.2.7] optional install error: Package require os(darwin) not compatible with your platform(linux)
✔ Installed 25 packages
✔ Linked 998 latest versions
[1/6] scripts.postinstall core-js@^3.6.5 run "node -e \"try{require('./postinstall')}catch(e){}\"", root: "/var/jenkins_home/workspace/SaleService/node_modules/_core-js@3.6.5@core-js"
[1/6] scripts.postinstall core-js@^3.6.5 finished in 87ms
[2/6] scripts.install @vue/cli-plugin-eslint@4.4.6 › yorkie@^2.0.0 run "node bin/install.js", root: "/var/jenkins_home/workspace/SaleService/node_modules/_yorkie@2.0.0@yorkie"
CI detected, skipping Git hooks installation
[2/6] scripts.install @vue/cli-plugin-eslint@4.4.6 › yorkie@^2.0.0 finished in 92ms
[3/6] scripts.install node-sass@^4.14.1 run "node scripts/install.js", root: "/var/jenkins_home/workspace/SaleService/node_modules/_node-sass@4.14.1@node-sass"
Downloading binary from https://cdn.npm.taobao.org/dist/node-sass/v4.14.1/linux_musl-x64-64_binding.node
Download complete
Binary saved to /var/jenkins_home/workspace/SaleService/node_modules/_node-sass@4.14.1@node-sass/vendor/linux_musl-x64-64/binding.node
Caching binary to /root/.npminstall_tarball/node-sass/4.14.1/linux_musl-x64-64_binding.node
[3/6] scripts.install node-sass@^4.14.1 finished in 829ms
[3/6] scripts.postinstall node-sass@^4.14.1 run "node scripts/build.js", root: "/var/jenkins_home/workspace/SaleService/node_modules/_node-sass@4.14.1@node-sass"
Binary found at /var/jenkins_home/workspace/SaleService/node_modules/_node-sass@4.14.1@node-sass/vendor/linux_musl-x64-64/binding.node
Testing binary
Binary is fine
[3/6] scripts.postinstall node-sass@^4.14.1 finished in 245ms
[4/6] scripts.postinstall element-ui@2.13.2 › async-validator@1.8.5 › babel-runtime@6.26.0 › core-js@^2.4.0 run "node -e \"try{require('./postinstall')}catch(e){}\"", root: "/var/jenkins_home/workspace/SaleService/node_modules/_core-js@2.6.11@core-js"
[4/6] scripts.postinstall element-ui@2.13.2 › async-validator@1.8.5 › babel-runtime@6.26.0 › core-js@^2.4.0 finished in 85ms
[5/6] scripts.postinstall @vue/cli-plugin-babel@4.4.6 › @vue/cli-service@4.4.6 › webpack-bundle-analyzer@3.8.0 › ejs@^2.6.1 run "node ./postinstall.js", root: "/var/jenkins_home/workspace/SaleService/node_modules/_ejs@2.7.4@ejs"
Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

[5/6] scripts.postinstall @vue/cli-plugin-babel@4.4.6 › @vue/cli-service@4.4.6 › webpack-bundle-analyzer@3.8.0 › ejs@^2.6.1 finished in 83ms
[6/6] scripts.postinstall @vue/cli-plugin-babel@4.4.6 › @vue/cli-service@4.4.6 › cli-highlight@2.1.4 › yargs@15.4.0 › decamelize@3.2.0 › xregexp@4.3.0 › @babel/runtime-corejs3@7.10.4 › core-js-pure@^3.0.0 run "node -e \"try{require('./postinstall')}catch(e){}\"", root: "/var/jenkins_home/workspace/SaleService/node_modules/_core-js-pure@3.6.5@core-js-pure"
[6/6] scripts.postinstall @vue/cli-plugin-babel@4.4.6 › @vue/cli-service@4.4.6 › cli-highlight@2.1.4 › yargs@15.4.0 › decamelize@3.2.0 › xregexp@4.3.0 › @babel/runtime-corejs3@7.10.4 › core-js-pure@^3.0.0 finished in 81ms
✔ Run 6 scripts
deprecate node-sass@4.14.1 › request@^2.88.0 request has been deprecated, see https://github.com/request/request/issues/3142
deprecate @vue/cli-plugin-babel@4.4.6 › @vue/cli-shared-utils@4.4.6 › @hapi/joi@15.1.1 › @hapi/address@2.x.x This version has been deprecated and is no longer supported or maintained
deprecate @vue/cli-plugin-babel@4.4.6 › webpack@4.43.0 › watchpack@1.7.2 › watchpack-chokidar2@2.0.0 › chokidar@^2.1.8 Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
deprecate element-ui@2.13.2 › async-validator@1.8.5 › babel-runtime@6.26.0 › core-js@^2.4.0 core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
Recently updated (since 2020-07-03): 15 packages (detail see file /var/jenkins_home/workspace/SaleService/node_modules/.recently_updates.txt)
  Today:
    → sass-loader@7.3.1 › neo-async@^2.5.0(2.6.2) (02:23:53)
✔ All packages installed (1198 packages installed from npm registry, used 13s(network 11s), speed 2.41MB/s, json 1023(2.53MB), tarball 25.05MB)
+ cnpm run build
> sale_web@0.1.0 build /var/jenkins_home/workspace/SaleService
> vue-cli-service build


-  Building for production...
 WARN  A new version of sass-loader is available. Please upgrade for best experience.
 ERROR  Failed to compile with 7 errors7:27:16 AM

 error  in ./src/App.vue

Module Error (from ./node_modules/_eslint-loader@2.2.1@eslint-loader/index.js):

/var/jenkins_home/workspace/SaleService/src/App.vue
   2:1   warning  Expected " " character, but found "\t" character                  vue/html-indent
   3:1   error    Trailing spaces not allowed                                       no-trailing-spaces
   4:1   warning  Expected " " character, but found "\t" character                  vue/html-indent
   4:3   warning  Require self-closing on Vue.js custom components (<router-view>)  vue/html-self-closing
   5:1   warning  Expected " " character, but found "\t" character                  vue/html-indent
   9:1   error    Trailing spaces not allowed                                       no-trailing-spaces
  10:1   error    Expected indentation of 0 spaces but found 1 tab                  indent
  11:1   error    Expected indentation of 2 spaces but found 2 tabs                 indent
  11:9   error    Property name "app" is not PascalCase                             vue/name-property-casing
  11:14  error    Unexpected trailing comma                                         comma-dangle
  12:1   error    Trailing spaces not allowed                                       no-trailing-spaces
  13:1   error    More than 1 blank line not allowed                                no-multiple-empty-lines
  14:1   error    Expected indentation of 0 spaces but found 1 tab                  indent

✖ 13 problems (9 errors, 4 warnings)
  9 errors and 4 warnings potentially fixable with the `--fix` option.


 @ ./src/main.js 6:0-28 40:13-16
 @ multi ./src/main.js

 error  in ./src/utils/toolFuc.js

Module Error (from ./node_modules/_eslint-loader@2.2.1@eslint-loader/index.js):

/var/jenkins_home/workspace/SaleService/src/utils/toolFuc.js
   1:1   error  Expected space or tab after '//' in comment                spaced-comment
   3:1   error  Expected indentation of 2 spaces but found 4               indent
   3:9   error  'cloneData' is never reassigned. Use 'const' instead       prefer-const
   3:53  error  Extra semicolon                                            semi
   4:1   error  Expected indentation of 2 spaces but found 4               indent
   5:1   error  Expected indentation of 4 spaces but found 6               indent
   5:11  error  'branchArr' is never reassigned. Use 'const' instead       prefer-const
   6:1   error  Expected indentation of 6 spaces but found 8               indent
   6:25  error  Strings must use singlequote                               quotes
   6:31  error  Expected '===' and instead saw '=='                        eqeqeq
   6:40  error  Strings must use singlequote                               quotes
   7:1   error  Expected indentation of 4 spaces but found 6               indent
   7:8   error  Extra semicolon                                            semi
   8:1   error  Expected indentation of 4 spaces but found 6               indent
   8:38  error  Strings must use singlequote                               quotes
   8:65  error  Strings must use singlequote                               quotes
   8:67  error  Extra semicolon                                            semi
   9:1   error  Expected indentation of 4 spaces but found 6               indent
   9:21  error  Strings must use singlequote                               quotes
   9:41  error  Extra semicolon                                            semi
  10:1   error  Expected indentation of 2 spaces but found 4               indent
  10:7   error  Extra semicolon                                            semi
  12:1   error  Expected space or tab after '//' in comment                spaced-comment
  13:7   error  Multiple spaces found before 'function'                    no-multi-spaces
  14:1   error  Expected indentation of 2 spaces but found 4               indent
  14:9   error  'element_result' is never reassigned. Use 'const' instead  prefer-const
  14:28  error  Extra semicolon                                            semi
  16:1   error  Expected indentation of 2 spaces but found 4               indent
  17:1   error  Expected indentation of 4 spaces but found 6               indent
  17:11  error  'element_data' is never reassigned. Use 'const' instead    prefer-const
  17:55  error  Extra semicolon                                            semi
  19:1   error  Expected indentation of 4 spaces but found 6               indent
  20:1   error  Expected indentation of 6 spaces but found 8               indent
  20:58  error  Extra semicolon                                            semi
  21:1   error  Expected indentation of 4 spaces but found 6               indent
  23:1   error  Expected indentation of 4 spaces but found 6               indent
  23:40  error  Extra semicolon                                            semi
  24:1   error  Expected indentation of 2 spaces but found 4               indent
  24:7   error  Extra semicolon                                            semi
  25:1   error  Expected indentation of 2 spaces but found 4               indent
  25:26  error  Extra semicolon                                            semi
  26:2   error  Newline required at end of file but not found              eol-last

✖ 42 problems (42 errors, 0 warnings)
  41 errors and 0 warnings potentially fixable with the `--fix` option.


 @ ./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.1.0@babel-loader/lib!./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.3@vue-loader/lib??vue-loader-options!./src/views/category/Category.vue?vue&type=script&lang=js& 72:0-50 132:26-37
 @ ./src/views/category/Category.vue?vue&type=script&lang=js&
 @ ./src/views/category/Category.vue
 @ ./src/views/category sync ^\.\/.*\.vue$
 @ ./src/utils/menus.js
 @ ./src/main.js
 @ multi ./src/main.js

 error  in ./src/plugins/apollo.js

Module Error (from ./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js):

/var/jenkins_home/workspace/SaleService/src/plugins/apollo.js
   4:8   error  A space is required after '{'                     object-curly-spacing
   4:19  error  A space is required before '}'                    object-curly-spacing
  12:48  error  Unexpected trailing comma                         comma-dangle
  13:1   error  Trailing spaces not allowed                       no-trailing-spaces
  17:1   error  Expected indentation of 2 spaces but found 4      indent
  18:1   error  Expected indentation of 4 spaces but found 6      indent
  19:1   error  Expected indentation of 6 spaces but found 8      indent
  20:1   error  Expected indentation of 4 spaces but found 6      indent
  21:1   error  Expected indentation of 2 spaces but found 4      indent
  21:7   error  Multiple spaces found before '//request拦截器'       no-multi-spaces
  21:9   error  Expected space or tab after '//' in comment       spaced-comment
  22:1   error  Trailing spaces not allowed                       no-trailing-spaces
  23:1   error  Expected indentation of 2 spaces but found 4      indent
  24:1   error  Expected indentation of 4 spaces but found 6      indent
  25:1   error  Expected indentation of 2 spaces but found 4      indent
  25:7   error  Multiple spaces found before '//response拦截器,...'  no-multi-spaces
  25:9   error  Expected space or tab after '//' in comment       spaced-comment
  33:8   error  Unexpected trailing comma                         comma-dangle
  37:1   error  Expected indentation of 2 spaces but found 4      indent
  37:32  error  Unexpected trailing comma                         comma-dangle
  38:3   error  Newline required at end of file but not found     eol-last

✖ 21 problems (21 errors, 0 warnings)
  21 errors and 0 warnings potentially fixable with the `--fix` option.


 @ ./src/main.js 13:0-50 38:18-32
 @ multi ./src/main.js

 error  in ./src/router.js

Module Error (from ./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js):

/var/jenkins_home/workspace/SaleService/src/router.js
  12:1   error  Expected indentation of 2 spaces but found 4   indent
  12:5   error  Expected space or tab after '//' in comment    spaced-comment
  13:1   error  Expected indentation of 2 spaces but found 5   indent
  22:1   error  Trailing spaces not allowed                    no-trailing-spaces
  23:41  error  Trailing spaces not allowed                    no-trailing-spaces
  25:1   error  Trailing spaces not allowed                    no-trailing-spaces
  26:1   error  Trailing spaces not allowed                    no-trailing-spaces
  26:1   error  More than 1 blank line not allowed             no-multiple-empty-lines
  30:41  error  Trailing spaces not allowed                    no-trailing-spaces
  32:1   error  Trailing spaces not allowed                    no-trailing-spaces
  36:41  error  Trailing spaces not allowed                    no-trailing-spaces
  38:1   error  Trailing spaces not allowed                    no-trailing-spaces
  42:42  error  Trailing spaces not allowed                    no-trailing-spaces
  43:87  error  Trailing spaces not allowed                    no-trailing-spaces
  47:1   error  Expected indentation of 4 spaces but found 8   indent
  48:1   error  Expected indentation of 4 spaces but found 8   indent
  49:1   error  Expected indentation of 4 spaces but found 8   indent
  50:1   error  Expected indentation of 4 spaces but found 8   indent
  51:1   error  Trailing spaces not allowed                    no-trailing-spaces
  52:1   error  Expected indentation of 4 spaces but found 8   indent
  53:1   error  Expected indentation of 4 spaces but found 8   indent
  54:1   error  Expected indentation of 4 spaces but found 8   indent
  55:1   error  Expected indentation of 4 spaces but found 8   indent
  55:37  error  Trailing spaces not allowed                    no-trailing-spaces
  56:1   error  Expected indentation of 4 spaces but found 8   indent
  57:1   error  Expected indentation of 4 spaces but found 8   indent
  58:1   error  Trailing spaces not allowed                    no-trailing-spaces
  59:1   error  Expected indentation of 4 spaces but found 8   indent
  61:1   error  Expected indentation of 4 spaces but found 8   indent
  62:1   error  Expected indentation of 4 spaces but found 8   indent
  63:1   error  Expected indentation of 6 spaces but found 12  indent
  64:1   error  Expected indentation of 6 spaces but found 12  indent
  65:1   error  Expected indentation of 6 spaces but found 12  indent
  66:1   error  Expected indentation of 6 spaces but found 12  indent
  67:1   error  Expected indentation of 4 spaces but found 8   indent
  68:1   error  Expected indentation of 4 spaces but found 9   indent
  69:1   error  Expected indentation of 6 spaces but found 12  indent
  70:1   error  Expected indentation of 6 spaces but found 12  indent
  71:1   error  Expected indentation of 6 spaces but found 12  indent
  72:1   error  Expected indentation of 6 spaces but found 12  indent
  72:25  error  Unexpected trailing comma                      comma-dangle
  74:1   error  Expected indentation of 4 spaces but found 8   indent
  75:1   error  Expected indentation of 6 spaces but found 12  indent
  76:1   error  Expected indentation of 6 spaces but found 12  indent
  77:1   error  Expected indentation of 4 spaces but found 8   indent
  78:1   error  Expected indentation of 2 spaces but found 4   indent
  79:3   error  Newline required at end of file but not found  eol-last

✖ 47 problems (47 errors, 0 warnings)
  47 errors and 0 warnings potentially fixable with the `--fix` option.


 @ ./src/main.js 8:0-30 23:0-6 28:15-21 36:10-16
 @ multi ./src/main.js

 error  in ./src/store/index.js

Module Error (from ./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js):

/var/jenkins_home/workspace/SaleService/src/store/index.js
   5:1   error  Expected indentation of 2 spaces but found 1 tab   indent
   6:1   error  Expected indentation of 4 spaces but found 2 tabs  indent
   7:1   error  Expected indentation of 4 spaces but found 2 tabs  indent
   7:57  error  Strings must use singlequote                       quotes
   8:1   error  Expected indentation of 4 spaces but found 2 tabs  indent
   8:9   error  Missing space before value for key 'token'         key-spacing
   9:1   error  Expected indentation of 2 spaces but found 1 tab   indent
  10:1   error  Expected indentation of 2 spaces but found 1 tab   indent
  11:1   error  Expected indentation of 4 spaces but found 2 tabs  indent
  12:1   error  Expected indentation of 6 spaces but found 3 tabs  indent
  12:23  error  Extra semicolon                                    semi
  13:1   error  Expected indentation of 4 spaces but found 2 tabs  indent
  14:1   error  Expected indentation of 4 spaces but found 2 tabs  indent
  15:1   error  Expected indentation of 6 spaces but found 3 tabs  indent
  15:24  error  Extra semicolon                                    semi
  16:1   error  Expected indentation of 4 spaces but found 2 tabs  indent
  17:1   error  Expected indentation of 4 spaces but found 2 tabs  indent
  18:1   error  Expected indentation of 6 spaces but found 3 tabs  indent
  18:28  error  Extra semicolon                                    semi
  19:1   error  Expected indentation of 4 spaces but found 2 tabs  indent
  20:1   error  Expected indentation of 4 spaces but found 2 tabs  indent
  21:1   error  Expected indentation of 6 spaces but found 3 tabs  indent
  21:23  error  Extra semicolon                                    semi
  22:1   error  Expected indentation of 4 spaces but found 2 tabs  indent
  22:4   error  Unexpected trailing comma                          comma-dangle
  23:1   error  Expected indentation of 2 spaces but found 1 tab   indent
  23:3   error  Unexpected trailing comma                          comma-dangle
  25:21  error  Extra semicolon                                    semi

✖ 28 problems (28 errors, 0 warnings)
  28 errors and 0 warnings potentially fixable with the `--fix` option.


 @ ./src/main.js 9:0-28 28:23-28 37:9-14
 @ multi ./src/main.js

 error  in ./src/utils/api.js

Module Error (from ./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js):

/var/jenkins_home/workspace/SaleService/src/utils/api.js
   4:1   error  Expected indentation of 2 spaces but found 4   indent
   5:1   error  Expected indentation of 4 spaces but found 8   indent
   6:1   error  Expected indentation of 4 spaces but found 8   indent
   7:1   error  Expected indentation of 4 spaces but found 8   indent
   8:1   error  Expected indentation of 2 spaces but found 4   indent
  10:25  error  Operator '=' must be spaced                    space-infix-ops
  10:30  error  A space is required after ','                  comma-spacing
  10:37  error  Missing space before =>                        arrow-spacing
  10:40  error  Missing space after =>                         arrow-spacing
  11:1   error  Expected indentation of 2 spaces but found 4   indent
  12:1   error  Expected indentation of 4 spaces but found 8   indent
  13:1   error  Expected indentation of 4 spaces but found 8   indent
  13:13  error  Missing space before value for key 'url'       key-spacing
  14:1   error  Expected indentation of 4 spaces but found 8   indent
  14:14  error  Missing space before value for key 'data'      key-spacing
  15:1   error  Expected indentation of 2 spaces but found 4   indent
  18:24  error  Operator '=' must be spaced                    space-infix-ops
  18:29  error  A space is required after ','                  comma-spacing
  18:36  error  Missing space before =>                        arrow-spacing
  18:39  error  Missing space after =>                         arrow-spacing
  19:1   error  Expected indentation of 2 spaces but found 4   indent
  20:1   error  Expected indentation of 4 spaces but found 8   indent
  20:16  error  Missing space before value for key 'method'    key-spacing
  21:1   error  Expected indentation of 4 spaces but found 8   indent
  21:13  error  Missing space before value for key 'url'       key-spacing
  22:1   error  Expected indentation of 4 spaces but found 8   indent
  22:16  error  Missing space before value for key 'params'    key-spacing
  23:1   error  Expected indentation of 2 spaces but found 4   indent
  25:27  error  Operator '=' must be spaced                    space-infix-ops
  25:32  error  A space is required after ','                  comma-spacing
  25:39  error  Missing space before =>                        arrow-spacing
  25:42  error  Missing space after =>                         arrow-spacing
  26:1   error  Expected indentation of 2 spaces but found 4   indent
  27:1   error  Expected indentation of 4 spaces but found 8   indent
  27:16  error  Missing space before value for key 'method'    key-spacing
  28:1   error  Expected indentation of 4 spaces but found 8   indent
  28:13  error  Missing space before value for key 'url'       key-spacing
  29:1   error  Expected indentation of 4 spaces but found 8   indent
  29:16  error  Missing space before value for key 'params'    key-spacing
  30:1   error  Expected indentation of 2 spaces but found 4   indent
  31:2   error  Newline required at end of file but not found  eol-last

✖ 41 problems (41 errors, 0 warnings)
  41 errors and 0 warnings potentially fixable with the `--fix` option.


 @ ./src/main.js 11:0-81 19:28-39 20:27-37 21:27-37 22:30-43
 @ multi ./src/main.js

 error  in ./src/utils/menus.js

Module Error (from ./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js):

/var/jenkins_home/workspace/SaleService/src/utils/menus.js
   2:1   error  Expected indentation of 2 spaces but found 1 tab      indent
   3:8   error  Strings must use singlequote                          quotes
   3:15  error  Extra semicolon                                       semi
   5:44  error  Block must not be padded by blank lines               padded-blocks
   6:1   error  Trailing spaces not allowed                           no-trailing-spaces
   7:1   error  More than 1 blank line not allowed                    no-multiple-empty-lines
   8:1   error  Expected indentation of 2 spaces but found 1 tab      indent
   9:1   error  Expected indentation of 4 spaces but found 2 tabs     indent
   9:9   error  Extra semicolon                                       semi
  10:1   error  Expected indentation of 2 spaces but found 1 tab      indent
  11:1   error  Expected indentation of 2 spaces but found 1 tab      indent
  11:13  error  Strings must use singlequote                          quotes
  12:1   error  Expected indentation of 4 spaces but found 2 tabs     indent
  12:24  error  Operator '==' must be spaced                          space-infix-ops
  12:24  error  Expected '===' and instead saw '=='                   eqeqeq
  13:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  13:8   error  'fmtRoutes' is never reassigned. Use 'const' instead  prefer-const
  13:48  error  Extra semicolon                                       semi
  14:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  14:31  error  Extra semicolon                                       semi
  15:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  15:41  error  Extra semicolon                                       semi
  16:1   error  Expected indentation of 4 spaces but found 2 tabs     indent
  17:1   error  Expected indentation of 2 spaces but found 1 tab      indent
  20:1   error  Expected indentation of 2 spaces but found 1 tab      indent
  20:6   error  'fmRoutes' is never reassigned. Use 'const' instead   prefer-const
  20:19  error  Extra semicolon                                       semi
  21:1   error  Expected indentation of 2 spaces but found 1 tab      indent
  21:27  error  Block must not be padded by blank lines               padded-blocks
  23:1   error  Expected indentation of 4 spaces but found 2 tabs     indent
  24:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  24:4   error  'path' is never reassigned. Use 'const' instead       prefer-const
  25:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  25:4   error  'component' is never reassigned. Use 'const' instead  prefer-const
  26:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  26:4   error  'name' is never reassigned. Use 'const' instead       prefer-const
  27:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  27:4   error  'meta' is never reassigned. Use 'const' instead       prefer-const
  28:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  28:4   error  'iconcls' is never reassigned. Use 'const' instead    prefer-const
  29:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  29:4   error  'enabled' is never reassigned. Use 'const' instead    prefer-const
  30:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  31:1   error  Expected indentation of 4 spaces but found 2 tabs     indent
  31:13  error  Extra semicolon                                       semi
  32:1   error  Expected indentation of 4 spaces but found 2 tabs     indent
  33:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  33:37  error  Extra semicolon                                       semi
  34:1   error  Expected indentation of 4 spaces but found 2 tabs     indent
  36:1   error  Expected indentation of 4 spaces but found 2 tabs     indent
  36:7   error  'fmRouter' is never reassigned. Use 'const' instead   prefer-const
  37:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  38:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  39:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  40:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  41:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  41:11  error  Missing space before value for key 'enable'           key-spacing
  42:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  43:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  44:1   error  Expected indentation of 8 spaces but found 4 tabs     indent
  44:30  error  Strings must use singlequote                          quotes
  45:1   error  Expected indentation of 10 spaces but found 5 tabs    indent
  45:58  error  Extra semicolon                                       semi
  46:1   error  Expected indentation of 8 spaces but found 4 tabs     indent
  46:37  error  Strings must use singlequote                          quotes
  47:1   error  Expected indentation of 10 spaces but found 5 tabs    indent
  47:63  error  Extra semicolon                                       semi
  48:1   error  Expected indentation of 8 spaces but found 4 tabs     indent
  48:37  error  Strings must use singlequote                          quotes
  49:1   error  Expected indentation of 10 spaces but found 5 tabs    indent
  49:63  error  Extra semicolon                                       semi
  50:1   error  Expected indentation of 8 spaces but found 4 tabs     indent
  50:37  error  Strings must use singlequote                          quotes
  51:1   error  Expected indentation of 10 spaces but found 5 tabs    indent
  51:62  error  Extra semicolon                                       semi
  52:1   error  Expected indentation of 8 spaces but found 4 tabs     indent
  52:6   error  Expected space(s) before "else"                       keyword-spacing
  52:36  error  Strings must use singlequote                          quotes
  53:1   error  Expected indentation of 10 spaces but found 5 tabs    indent
  53:62  error  Extra semicolon                                       semi
  54:1   error  Expected indentation of 8 spaces but found 4 tabs     indent
  54:6   error  Expected space(s) before "else"                       keyword-spacing
  54:36  error  Strings must use singlequote                          quotes
  55:1   error  Expected indentation of 10 spaces but found 5 tabs    indent
  55:66  error  Extra semicolon                                       semi
  56:1   error  Expected indentation of 8 spaces but found 4 tabs     indent
  56:6   error  Expected space(s) before "else"                       keyword-spacing
  56:36  error  Strings must use singlequote                          quotes
  57:1   error  Expected indentation of 10 spaces but found 5 tabs    indent
  57:64  error  Extra semicolon                                       semi
  58:1   error  Expected indentation of 8 spaces but found 4 tabs     indent
  58:6   error  Expected space(s) before "else"                       keyword-spacing
  58:36  error  Strings must use singlequote                          quotes
  59:1   error  Expected indentation of 10 spaces but found 5 tabs    indent
  59:67  error  Extra semicolon                                       semi
  60:1   error  Expected indentation of 8 spaces but found 4 tabs     indent
  60:6   error  Expected space(s) before "else"                       keyword-spacing
  60:36  error  Strings must use singlequote                          quotes
  61:1   error  Expected indentation of 10 spaces but found 5 tabs    indent
  61:63  error  Extra semicolon                                       semi
  62:1   error  Expected indentation of 8 spaces but found 4 tabs     indent
  63:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  64:1   error  Expected indentation of 4 spaces but found 2 tabs     indent
  65:1   error  Trailing spaces not allowed                           no-trailing-spaces
  66:1   error  Expected indentation of 4 spaces but found 2 tabs     indent
  66:3   error  Expected space(s) after "if"                          keyword-spacing
  66:21  error  Operator '==' must be spaced                          space-infix-ops
  66:21  error  Expected '===' and instead saw '=='                   eqeqeq
  66:25  error  Missing space before opening brace                    space-before-blocks
  67:1   error  Expected indentation of 6 spaces but found 3 tabs     indent
  67:27  error  Extra semicolon                                       semi
  68:1   error  Expected indentation of 4 spaces but found 2 tabs     indent
  69:1   error  Trailing spaces not allowed                           no-trailing-spaces
  70:1   error  Expected indentation of 2 spaces but found 1 tab      indent
  70:2   error  Block must not be padded by blank lines               padded-blocks
  71:1   error  Expected indentation of 2 spaces but found 1 tab      indent
  71:17  error  Extra semicolon                                       semi

✖ 117 problems (117 errors, 0 warnings)
  109 errors and 0 warnings potentially fixable with the `--fix` option.


 @ ./src/main.js 10:0-41 28:6-14
 @ multi ./src/main.js

 ERROR  Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sale_web@0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sale_web@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-07-09T23_27_16_480Z-debug.log
Build step 'Execute shell' marked build as failure
最初我是通过nodejs插件,来进行打包环境的安装及切换。

但是发现插件安装的node环境不能运行。结果发现docker部署的Jenkins容器是基于alpine linux的,
alpine linux是精简版的linux,由于太精简所以对很多软件的支持不是很好,所以造成nodejs插件安装的环境不能使用。
但是apline linux给我们提供了nodejs环境的软件源,所以我们可以通过apk add命令来进行安装,来解决nodejs环境的问题。
参考文章:https://blog.csdn.net/liumiaocn/article/details/102618269

gitlab更新就自动化部署部分参考文章:https://www.jianshu.com/p/6787a8b843d8
posted @ 2020-07-10 15:16  she11s  阅读(1532)  评论(0编辑  收藏  举报