-6ren">
gpt4 book ai didi

Jenkins 管道 : how to upload artifacts with s3 plugin

转载 作者:行者123 更新时间:2023-12-03 23:24:20 24 4
gpt4 key购买 nike

我试图在成功构建后将工件上传到 s3 存储桶,但我找不到任何可实现到阶段/节点块的工作示例。

有什么想法(安装了 s3 插件,jenkins v2.32)?

node {
sh 'echo ""> 1.jar'
archiveArtifacts artifacts: '1.jar', fingerprint: true
// upload to s3 bucket ???
}

最佳答案

详细步骤:

  • 安装流水线 AWS 插件。
    转到管理 Jenkins -> 管理插件 -> 可用选项卡 -> 按“管道 AWS”过滤。
    安装插件。
  • 根据您的环境添加凭据。这里的例子:

    Jenkins > 凭据 > 系统 > 全局凭据(不受限制)-> 添加

    种类 = AWS 凭证
    并添加您的 AWS 凭证

    请注意 ID
  • 然后在你的 Pipeline 项目中(类似于我使用的代码)
    node {

    stage('Upload') {

    dir('path/to/your/project/workspace'){

    pwd(); //Log current directory

    withAWS(region:'yourS3Region',credentials:'yourIDfromStep2') {

    def identity=awsIdentity();//Log AWS credentials

    // Upload files from working directory 'dist' in your project workspace
    s3Upload(bucket:"yourBucketName", workingDir:'dist', includePathPattern:'**/*');
    }

    };
    }
    }
  • 关于 Jenkins 管道 : how to upload artifacts with s3 plugin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42074736/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com