[英]How I can access to a file saved in Gitlab CI/CD artifact in the next stages and increase it's version
I have a spring boot application and I deployed it in the first stage and now I have a jar file.我有一个 spring 启动应用程序,我在第一阶段部署了它,现在我有一个 jar 文件。 my question is how to access this jar file in the next stage and how I can run it.
我的问题是如何在下一阶段访问这个 jar 文件以及如何运行它。 second question is HOW can I increase its version number?
第二个问题是如何增加它的版本号? for example jar file name is spring.0.0.1.jar and I want to increase version number after every push.
例如 jar 文件名是 spring.0.0.1.jar 我想在每次推送后增加版本号。 is this possible?
这可能吗?
You can save the jar file as an artifact and access it in the second stages jobs' script area.您可以将 jar 文件保存为工件并在第二阶段作业的脚本区域中访问它。 For example
例如
FirstJob:
stage: FirstStage
scrip:
- <your commands here>
artifacs:
paths:
- ./artifacts/myOutput.jar
Now your "myOutput.jar" is accessible in the artifacts folder for all following jobs.现在您的“myOutput.jar”可以在以下所有作业的工件文件夹中访问。 See here: https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html
看这里: https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html
As far as I know there is no way of handing down variables between pipelines in GitLab CI so this would not be possible if I'm right.据我所知,没有办法在 GitLab CI 中的管道之间传递变量,所以如果我是对的,这是不可能的。 Since artifacts don't get added to the repository, previous artifacts are not available to following pipelines either.
由于工件不会添加到存储库中,因此之前的工件也不可用于后续管道。 Yet, if I had to come up with a solution on the spot, I'd try:
然而,如果我必须当场想出一个解决方案,我会尝试:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.