Skip to content

Commit

Permalink
#10 encountering issue #11
Browse files Browse the repository at this point in the history
- to be able to docker push, a credentials is needed to be pre-stored in the jenkins container.
- I created a set of credentials (for docker hub) in Jenkins in the credentials module.
- this output a credentials.xml in JENKINS_HOME, which I then extracted.
- I am pushing this credentials XML into JENKINS_HOME while building the Jenkins image
- However, it seems the same encoding is not used everytime so the credentials.xml is not valid across Jenkins installations.
- i.e pulling this from one running Jenkins instance, then pushing it into a different instance does not seem to work.

As a result, docker push does not work unless you manually edit the credentials through UI before docker-pushing .

Notes:
- have tried using jenkins-cli. Could not figure out (despite trying for hours) how to use create-credentials-by-xml.
- have tried using the docker remote API call as well (curl -X POST /images/name/push). Encountering weird login issue.
  • Loading branch information
savishy committed Aug 5, 2016
1 parent 202f70d commit 053aca1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
19 changes: 19 additions & 0 deletions dockerfiles/jenkins-ci/credentials.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version='1.0' encoding='UTF-8'?>
<com.cloudbees.plugins.credentials.SystemCredentialsProvider plugin="credentials@1.25">
<domainCredentialsMap class="hudson.util.CopyOnWriteMap$Hash">
<entry>
<com.cloudbees.plugins.credentials.domains.Domain>
<specifications/>
</com.cloudbees.plugins.credentials.domains.Domain>
<java.util.concurrent.CopyOnWriteArrayList>
<com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl>
<scope>GLOBAL</scope>
<id>8301e62d-4eac-4abc-a2c1-fb5ed00aef0e</id>
<description>Docker Hub Vish</description>
<username>docker-username</username>
<password>encoded-password</password>
</com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl>
</java.util.concurrent.CopyOnWriteArrayList>
</entry>
</domainCredentialsMap>
</com.cloudbees.plugins.credentials.SystemCredentialsProvider>
6 changes: 3 additions & 3 deletions dockerfiles/jenkins-ci/plugins.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ git-client:1.19.6
ssh-credentials:1.11
matrix-project:1.6
scm-api:1.0
credentials:1.25
credentials:2.1.4
workflow-scm-step:1.14.2

git:2.5.3
Expand All @@ -23,8 +23,8 @@ git:2.5.3
deploy:1.10

# dependencies for docker build step
authentication-tokens:1.1
docker-commons:1.2
authentication-tokens:1.3
docker-commons:1.4.0

# docker
docker-build-step:1.35

0 comments on commit 053aca1

Please sign in to comment.