【问题标题】:Deploy Files to Windows Host Machines from Jenkins从 Jenkins 将文件部署到 Windows 主机
【发布时间】:2018-09-10 12:21:51
【问题描述】:

我在 Windows 服务器上安装了 Jenkins,我希望将发布的 VisualStudio 文件复制到多个 Windows 主机 [LoadBalanced 环境]。

将文件从 Jenkins [托管在 Windows] 复制到多个 Windows 主机(在 LB 场上运行)的最推荐方法是什么。有没有直接的插件呢?

除了多个 jenkins 构建步骤之外,是否有任何直接的方法可以将构建文件复制到目标服务器?

【问题讨论】:

    标签: windows jenkins jenkins-plugins continuous-deployment msdeploy


    【解决方案1】:

    如果您使用pipelines,您可以将一个任务拆分为多个任务,然后可以执行in parallel。你可以这样做:

    pipeline {
        agent none
        stages {
            stage('build') {
                parallel {
                    stage('build-1') {
                        agent {
                            label "windows"
                        }
                        steps {
                            bat "build-1.bat"
                        }
                    }
                    stage('build-2') {
                        agent {
                            label "windows"
                        }
                        steps {
                            bat "build-2.bat"
                        }
                    }
                    stage('build-3') {
                        agent {
                            label "windows"
                        }
                        steps {
                            bat "build-3.bat"
                        }
                    }
                }
            }
        }
    }
    

    将从您的 SCM(Subversion、Git 等)复制文件,并启动构建脚本以执行您需要完成的任何构建操作。

    【讨论】:

    • 感谢您的积分。您对将文件从詹金斯复制到多个远程 Windows 服务器有什么建议吗?或者,这可以使用 msdeploy 来完成吗?
    • 这通常是通过使用checkout scm 指令从源代码控制系统(Subversion 或 Git 或类似)签出来完成的,但没有什么能阻止您通过其他方式(如 msdeploy)拉或推工件。唯一的诀窍是,如果您决定推出自己的解决方案,您有责任确保构建不会相互冲突。例如,如果同时启动两个构建,您可能会意外清除正在使用的工作区。
    猜你喜欢
    • 1970-01-01
    • 2020-03-17
    • 1970-01-01
    • 2019-02-28
    • 2018-09-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-19
    相关资源
    最近更新 更多