【问题标题】:How to upload file to google drive using jenkins pipeline如何使用詹金斯管道将文件上传到谷歌驱动器
【发布时间】:2019-11-28 16:20:25
【问题描述】:

我想在我的 Jenkinsfile 管道中添加一个步骤,以将 apk 上传到谷歌驱动器,然后获取上传文件的可共享链接。

【问题讨论】:

    标签: jenkins continuous-integration jenkins-pipeline jenkins-plugins


    【解决方案1】:

    你检查过this吗?好像有点用处

    【讨论】:

      【解决方案2】:

      以下是添加将文件上传到谷歌云的阶段的一些一般步骤:

      1. 下载 jenkins google Google OAuth Credentials 插件和 Google Cloud Storage 插入: https://plugins.jenkins.io/google-oauth-plugin/
        https://plugins.jenkins.io/google-storage-plugin/
      2. 创建一个凭据参数(在 jenkins/configure 中),类型为:“来自私钥的 Google 服务帐户”,如果您没有该项目的服务帐户,请使用通过以下操作获得的凭据 json 创建它:https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating
      3. 创建 GCP 存储桶:https://cloud.google.com/storage/docs/creating-buckets
      4. 在jenkins中,进入“pipeline-syntax”并创建构建步骤,指令可以在:https://plugins.jenkins.io/google-storage-plugin/
      5. jenkins 文件上传代码示例(由步骤 4 生成):
      googleStorageUpload bucket: 'gs://my-jenkins-bucket-from-part-3', credentialsId: 'my-jenkins-credentials-from-part-2', pattern: 'my_file_to_upload.zip'
      
      1. 请注意,您可能会遇到存储桶权限问题,请正确配置它们或打开存储桶供公众访问(不推荐):
      in GCP, Activate Cloud Shell:
      gsutil defacl ch -u allUsers:R gs://my-jenkins-bucket-from-part-3
      gsutil acl ch -u allUsers:O gs://my-jenkins-bucket-from-part-3
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-03-05
        • 1970-01-01
        • 2019-02-27
        • 1970-01-01
        • 2017-09-06
        • 2018-11-10
        • 2015-02-20
        • 2019-01-09
        相关资源
        最近更新 更多