另一个项目中使用的一个项目的 Gitlabs 工件 [英] Gitlabs artifact of one project used in further projects

查看:25
本文介绍了另一个项目中使用的一个项目的 Gitlabs 工件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • 在 CI 阶段使用 docker 容器时,在项目之间携带工件(jar、class、war)的最佳方式是什么.

让我详细解释一下我的问题,请不要停止阅读... =)

Let me explain my issue in details, please don't stop the reading... =)

  • 单元测试
  • 等等……
  • 单元测试
  • 等等……
  • 构建(失败)
    • 这里我需要一个在 project1 中生成的工件(jar)
    • 我正在使用 docker,所以在每个 .gitlab-ci.yml 中我都会有独立的容器
    • project1 一切正常
    • 如果我在 .gitlab-ci.yml 中使用shell"而不是 dockers,我可以将 project1 中的 jar 文件保存在磁盘中,并在 project2 启动构建时使用
    • 今天我在调用 project2 时触发 project1 完成工作良好
    • 我的工件不是 RPM,所以我不会添加到我的 repo 中

    推荐答案

    你好,你一定要看看由 get-last-successful-build-artifact.sh 开发的脚本>morph027.

    Hello you must take a look at a script named get-last-successful-build-artifact.sh and developed by morph027.

    https://gitlab.com/morph027/gitlab-ci-helpers

    此脚本允许下载工件并将其解压缩到项目根目录中.它使用 Gitlab API 来检索最新的成功构建并下载相应的工件.只需稍微更新一下脚本,您就可以组合多个工件并解压缩到任意位置.

    This script allow to download an artifact and unzip it in the project root. It use Gitlab API to retrieve latest successful build and download corresponding artifact. You can combine multiple artifacts and unzip wherever you want just by updating the script a little.

    我目前也在启动 PHP 库 来处理构建工件,但它在一个非常早期的阶段,目前与 laravel 并列.

    I'm also currently starting a PHP library to handle build artifacts but it's in a very early stage and tied with laravel for the moment.

    目前还没有简单的方法来处理项目之间的工件使用情况,您必须使用这些工具构建自己的.

    For the moment there is no easy way to handle artifact usage between projects, you must build your own using that tools.

    我认为使用 shell executor 不是正确的解决方案,它非常危险,因为您无法验证构建期间使用的服务器上的文件!

    I think using shell executor is not the right solution, it's very dangerous because you can't verify the file on the server used during the build !

    希望有帮助:)

    这篇关于另一个项目中使用的一个项目的 Gitlabs 工件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆