惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

小众软件
小众软件
V
Visual Studio Blog
博客园 - 三生石上(FineUI控件)
Last Week in AI
Last Week in AI
Blog — PlanetScale
Blog — PlanetScale
爱范儿
爱范儿
J
Java Code Geeks
A
About on SuperTechFans
F
Fortinet All Blogs
B
Blog
aimingoo的专栏
aimingoo的专栏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Engineering at Meta
Engineering at Meta
Y
Y Combinator Blog
有赞技术团队
有赞技术团队
G
Google Developers Blog
Apple Machine Learning Research
Apple Machine Learning Research
V
V2EX
博客园_首页
博客园 - 叶小钗
罗磊的独立博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
Docker
云风的 BLOG
云风的 BLOG

时间的朋友

Windows 命令行密码重置 Anaconda安装 typescript 注解解读1 Konvajs Shape加载自定义图片 sshpass 使用 why-is-node-running webgl笔记 SharedArrayBuffer is not defined blender 常用快捷键 | 时间的朋友 vue -- v3.4commit提交记录2 vue2 升级vue3报错问题整理 着色器 expressjs 源码 hyper-V arch linux 网络配置 element input数字格式化 three 拼接货架 WebAudio笔记 Windows nginx重启bat脚本 vue -- v3.4commit提交记录 URI malformed vue3 -- Class 对象在组件中使用范例 | 时间的朋友 ruby 安装和升级 element-plus 老版本cascader使用卡死问题 vue3 内置Transition组件 | 时间的朋友 前端memo的实现 | 时间的朋友 Vue -- vue-class-component源码 | 时间的朋友 linux 优化脚本 typescript 装饰器 | 时间的朋友 microbundle 源码 | 时间的朋友 WSL2问题解决WslRegisterDistribution failed with error: 0x800701bc
jenkins 配置模板代码 | 时间的朋友
2023-02-08 · via 时间的朋友

Published: · LastMod: February 10, 2023 · 301 words

 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
def pkgName = "pkgname"
node {
    properties([
        parameters([
            booleanParam(description: '是否发布生产', name: 'isprod')
        ])
    ])


    stage('clone') {
        checkout([$class: 'GitSCM', branches: [
            [name: '$branch']
        ], extensions: [], userRemoteConfigs: [
            [credentialsId: '1e3f22cb', url: 'git']
        ]])
    }

    stage('install&build') {
        sh 'yarn install --registry=https://registry.npmmirror.com'
        
        // 修改源码打包目录
        sh 'sed -i "s#../../html/modules/##g" vue.config.js'
        // 测试环境修改path路径
        if (params.isprod) {
            sh 'sed -i "s#shoreside/#shoreside/prod/#g" ./src/settings.js'
        } else {
            sh 'sed -i "s#shoreside/#shoreside/test/#g" ./src/settings.js'
        }

        sh 'yarn run build:prod'

        // 回退文件改动
        sh """
            git checkout ./vue.config.js
            git checkout ./src/settings.js
        """
        // 压缩目录
        sh "tar -zcvf ${pkgName}.tar.gz ${pkgName}/"
    }

    stage('deploy') {
        // oss
        def OSS_PATH = "/test/html/modules/${pkgName}"
        if (params.isprod) {
            OSS_PATH = "/prod/html/modules/${pkgName}"
        }
        aliyunOSSUpload accessKeyId: 'key', accessKeySecret: 'value', bucketName: 'ihaiking', endpoint: 'oss-cn-shanghai.aliyuncs.com', localPath: "/${pkgName}", maxRetries: '3', remotePath: OSS_PATH

        // ftp
        // 远程服务器地址
        def SERVER_PATH = "/data/vptest/land"
        if (params.isprod) {
            SERVER_PATH = '/data/vp/land'
        }

        def EXECUTE_SHELL = """
            source /etc/profile 
            cd ${SERVER_PATH}
            tar --overwrite -zxvf ${pkgName}.tar.gz -C ./html/modules
        """
        def SOURCE_FILE = "${pkgName}.tar.gz"
        sshPublisher(publishers: [sshPublisherDesc(configName: '(192.168.0.19_prd)', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: EXECUTE_SHELL, execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: SERVER_PATH, remoteDirectorySDF: false, removePrefix: '', sourceFiles: SOURCE_FILE)], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
    }
}