简体   繁体   中英

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. 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

ARTIFACTORY_DOCKER_REGISTRY should be IP/Artifactory-Repo-Key/IMAGE:TAG

HOST should be docker daemon.

Given Artifactory acts as any other docker registry, you can simply use the Docker step in a Pipeline and do something like the below.

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.

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>
'''

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM