[JIRA] (JENKINS-39684) Use docker images from private registry

3 views
Skip to first unread message

pwolf@cloudbees.com (JIRA)

unread,
Nov 11, 2016, 4:52:03 PM11/11/16
to jenkinsc...@googlegroups.com
Patrick Wolf created an issue
 
Jenkins / Story JENKINS-39684
Use docker images from private registry
Issue Type: Story Story
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin
Created: 2016/Nov/11 9:51 PM
Priority: Minor Minor
Reporter: Patrick Wolf

When using an agent directive in Declarative Pipeline there is no way to specify the Docker Registry to use. In Scripted Pipline this is available via the withRegistry wrapper

docker.withRegistry('https://docker.mycorp.com/', 'docker-login') {
  git '…'
  docker.build('myapp').push('latest')
}

For Declarative we should allow admins to create a default registry to be used by all Pipelines at the master level or the folder level. We should also allow a specific registry setting in the language itself via the agent directive.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

pwolf@cloudbees.com (JIRA)

unread,
Nov 11, 2016, 4:54:01 PM11/11/16
to jenkinsc...@googlegroups.com
Patrick Wolf commented on Story JENKINS-39684
 
Re: Use docker images from private registry

Michael Neale James Dumay

Do you guys have any suggestions for the syntax?

mneale@cloudbees.com (JIRA)

unread,
Nov 14, 2016, 5:29:01 PM11/14/16
to jenkinsc...@googlegroups.com

Patrick Wolf Andrew Bayer I think the agent syntax was made flexible enough to cater for this.

agent docker:"foo" registry:

{... config for registry}

would something like that work? or the docker item take a block in that case with all the config needed? (Andrew would be able to comment on what is best)

andrew.bayer@gmail.com (JIRA)

unread,
Nov 16, 2016, 12:59:02 PM11/16/16
to jenkinsc...@googlegroups.com

Hrm. I don't like the idea of mixing closures with string values in the agent config. That ship has already sailed, I think. I'll play around with it, but I don't think it'll work well. Most likely, we'll need straight key/value pairings.

andrew.bayer@gmail.com (JIRA)

unread,
Nov 16, 2016, 1:01:02 PM11/16/16
to jenkinsc...@googlegroups.com

Ok, turns out it's technically possible, but I'm really unsure about the syntactic feel.

andrew.bayer@gmail.com (JIRA)

unread,
Nov 16, 2016, 1:45:02 PM11/16/16
to jenkinsc...@googlegroups.com

I tell a lie - there's no viable way to fit non-String agent values into the AST. Grr.

andrew.bayer@gmail.com (JIRA)

unread,
Nov 16, 2016, 1:48:01 PM11/16/16
to jenkinsc...@googlegroups.com
Andrew Bayer edited a comment on Story JENKINS-39684
I tell a lie - there's no viable way to fit non- closure {{ String}} {{ agent}} values into the AST. Grr. We *could* do maps, though. So I'd lean towards this syntax:

{code}
agent docker:'foo', registry:[url:'http://...', username:'...', password:'...']
{code}

Still need to think how we'd fit credentials into that, though.

mneale@cloudbees.com (JIRA)

unread,
Nov 16, 2016, 8:13:01 PM11/16/16
to jenkinsc...@googlegroups.com

that looks reasonable. I am not aware how registry works today with withCredentials, but perhaps its a matter of takign a credentialId as an option?

p.leibiger@codecraft.de (JIRA)

unread,
Dec 19, 2016, 6:34:02 AM12/19/16
to jenkinsc...@googlegroups.com

Current syntax looks like this withDockerRegistry([credentialsId: 'foo', url: 'https://docker.foo.com']).
Tried to add it as wrapper but obviously that didn't work out.

p.leibiger@codecraft.de (JIRA)

unread,
Dec 19, 2016, 6:38:01 AM12/19/16
to jenkinsc...@googlegroups.com

Maybe the agent syntax always needs to be a closure, away from strings.
In the future there might be a lot of parameters for different kinds of agents.

mneale@cloudbees.com (JIRA)

unread,
Dec 20, 2016, 2:21:01 AM12/20/16
to jenkinsc...@googlegroups.com

Peter Leibiger I know Andrew Bayer was looking at making the agent syntax more extensible: https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/73 - so perhaps that is the place to add in registry support?

p.leibiger@codecraft.de (JIRA)

unread,
Dec 20, 2016, 6:03:01 AM12/20/16
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Jan 7, 2017, 7:14:02 PM1/7/17
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Jan 7, 2017, 7:14:02 PM1/7/17
to jenkinsc...@googlegroups.com
Andrew Bayer started work on Story JENKINS-39684
 
Change By: Andrew Bayer
Status: Open In Progress

andrew.bayer@gmail.com (JIRA)

unread,
Jan 7, 2017, 7:14:03 PM1/7/17
to jenkinsc...@googlegroups.com

p.leibiger@codecraft.de (JIRA)

unread,
Jan 9, 2017, 6:19:01 AM1/9/17
to jenkinsc...@googlegroups.com

I can probably test this sometime this week.

scm_issue_link@java.net (JIRA)

unread,
Jan 19, 2017, 5:47:03 PM1/19/17
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Andrew Bayer
Path:
pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipeline.java
pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfile.java
pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy
pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineScript.groovy
http://jenkins-ci.org/commit/pipeline-model-definition-plugin/d76175b8b7d302fe46cccfda2bca36eb9f857974
Log:
[FIXED JENKINS-39684] Add registryUrl and registryCredentialsId

Added to both docker and dockerfile agent types. Not sure how to test
this, honestly.

andrew.bayer@gmail.com (JIRA)

unread,
Jan 19, 2017, 5:48:02 PM1/19/17
to jenkinsc...@googlegroups.com
Change By: Andrew Bayer
Status: In Review Resolved
Resolution: Fixed

p.leibiger@codecraft.de (JIRA)

unread,
Jan 23, 2017, 10:10:01 AM1/23/17
to jenkinsc...@googlegroups.com

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:26:14 PM10/22/19
to jenkinsc...@googlegroups.com
Liam Newman closed an issue as Fixed
 

Bulk closing resolved issues.

Change By: Liam Newman
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages