如何从GitLab CI将构建发布到Artifactory? [英] How to publish builds to Artifactory from GitLab CI?
问题描述
我正在寻找一种简单干净的方法来将使用GitLab CI构建的人工制品发布到Artifactory.
我能够发现 https://gitlab.com/gitlab-org/omnibus/blob/af8af9552966348a15dc1bf488efb29a8ca27111/lib/omnibus/publishers/artifactory_publisher.rb ,但我找不到任何有关如何配置它以使其正常工作的文档./p>
注意:我正在寻找gitlab_ci.yaml方法,而不是在外部实现它.
在基本级别上,可以使用 您可以将此文件复制到GitLab运行程序的主目录-在我的情况下为 完成后,跑步者将使用该配置向Artifactory进行身份验证.如果您不想使用API密钥,则还有很多其他的身份验证方法-请查看JFrog CLI文档. 在继续之前,请确保"jfrog"可执行文件位于已知位置,并且具有gitlab-runner用户的执行权限.在这里,您可以在 I am looking for an easy and clean way to publish artefacts build with GitLab CI onto Artifactory. I was able to spot https://gitlab.com/gitlab-org/omnibus/blob/af8af9552966348a15dc1bf488efb29a8ca27111/lib/omnibus/publishers/artifactory_publisher.rb but I wasnt able to find any documentation regarding how I am supposed to configure it to make it work. Note: I am looking for a gitlab_ci.yaml approach, not as in implementing it externally. At a basic level, this can be done with the JFrog CLI tools. Unless you want to embed configuration in your This will prompt for your Artifactory URL and an API key by default. After entering these items, you'll find You can copy this file to the GitLab runner's home directory - in my case, Once that is done, the runner will authenticate with Artifactory using that configuration. There are a bunch of other possibilities for authentication if you don't want to use API keys - check the JFrog CLI docs. Before moving on, make sure the 'jfrog' executable is in a known location, with execute permissions for the gitlab-runner user. From here you can call the utility within your
这篇关于如何从GitLab CI将构建发布到Artifactory?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!/home/gitlab-runner/.jfrog/jfrog-cli.conf
.gitlab-ci.yml
中调用该实用程序-这是node.js
应用程序的一个简单示例,该应用程序会将Git标记作为工件版本传递:stages:
- build-package
build-package:
stage: build-package
script:
- npm install
- tar -czf test-project.tar.gz *
- /usr/local/bin/jfrog rt u --build-name="Test Project" --build-number="${CI_BUILD_TAG}" test-project.tar.gz test-repo
.gitlab-ci.yml
(I don't) you will first need to run (on your runner):jfrog rt c
~/.jfrog/jfrog-cli.conf
containing JSON like so: {
"artifactory": {
"url": "http://artifactory.localdomain:8081/artifactory/",
"apiKey": "AKCp2V77EgrbwK8NB8z3LdvCkeBPq2axeF3MeVK1GFYhbeN5cfaWf8xJXLKkuqTCs5obpzxzu"
}
}
/home/gitlab-runner/.jfrog/jfrog-cli.conf
.gitlab-ci.yml
- here is a minimal example for a node.js
app that will pass the Git tag as the artifact version:stages:
- build-package
build-package:
stage: build-package
script:
- npm install
- tar -czf test-project.tar.gz *
- /usr/local/bin/jfrog rt u --build-name="Test Project" --build-number="${CI_BUILD_TAG}" test-project.tar.gz test-repo