[英]Jfrog artifactory intigration with jenkins
I created a local docker repository on jfrog artifactory now, I want to push the docker image using jenkins pipeline.我现在在 jfrog 工件上创建了一个本地 docker 存储库,我想使用 jenkins 管道推送 docker 图像。 can some one guide me and provide some resource link as well
有人可以指导我并提供一些资源链接吗
Thanks谢谢
You can find the complete snippet here https://github.com/jfrog/project-examples/blob/master/jenkins-examples/pipeline-examples/declarative-examples/docker-push-example/Jenkinsfile你可以在这里找到完整的代码片段https://github.com/jfrog/project-examples/blob/master/jenkins-examples/pipeline-examples/declarative-examples/docker-push-example/Jenkinsfile
ARTIFACTORY_DOCKER_REGISTRY should be IP/Artifactory-Repo-Key/IMAGE:TAG
ARTIFACTORY_DOCKER_REGISTRY 应该是
IP/Artifactory-Repo-Key/IMAGE:TAG
HOST should be docker daemon. HOST 应该是 docker 守护进程。
Given Artifactory acts as any other docker registry, you can simply use the Docker step in a Pipeline and do something like the below.鉴于 Artifactory 充当任何其他 docker 注册表,您可以简单地在管道中使用Docker 步骤并执行以下操作。
docker.withRegistry('https://artifactoryu.registryy', 'credentials-id') {
def customImage = docker.build("my-image:${env.BUILD_ID}")
/* Push the container to the custom Registry */
customImage.push()
}
Else you can simply use a shell script to do this.否则,您可以简单地使用 shell 脚本来执行此操作。
sh'''
docker login ${server-name}.jfrog.io
docker tag <image name> ${server-name}.jfrog.io/{repo-name}/<image name>
docker push ${server-name}.jfrog.io/{repo-name}/<image name>
'''
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.