summaryrefslogtreecommitdiffstats
path: root/jjb
diff options
context:
space:
mode:
authorAnaël Closson <ac2550@intl.att.com>2017-02-15 14:50:45 +0100
committerAnaël Closson <ac2550@intl.att.com>2017-02-15 15:01:27 +0100
commit63e090e8af3609560cb0c0bb98391efa4c11954b (patch)
treef46d1e6f227909cde5ab8980ddf4c2904c000da6 /jjb
parent9594597ec3c659c792990e5963fbcd4b9c84bf22 (diff)
Perform docker login before pusing images
Change-Id: I626e230ccf0d7892f7f6d41881dd49b806212651 Signed-off-by: Anaël Closson <ac2550@intl.att.com>
Diffstat (limited to 'jjb')
-rw-r--r--jjb/global-macros.yaml5
-rw-r--r--jjb/global-templates-java.yaml3
-rw-r--r--jjb/include-docker-login.sh12
3 files changed, 20 insertions, 0 deletions
diff --git a/jjb/global-macros.yaml b/jjb/global-macros.yaml
index 43f52f46c..5815ccf53 100644
--- a/jjb/global-macros.yaml
+++ b/jjb/global-macros.yaml
@@ -52,6 +52,11 @@
- docker.pull.registry=nexus3.openecomp.org:10001
- docker.push.registry=nexus3.openecomp.org:10003
+- builder:
+ name: docker-login
+ builders:
+ - shell: !include-raw: include-docker-login.sh
+
# PARAMETERS
- parameter:
name: ecomp-infra-parameters
diff --git a/jjb/global-templates-java.yaml b/jjb/global-templates-java.yaml
index a9a368ee2..e11a658a9 100644
--- a/jjb/global-templates-java.yaml
+++ b/jjb/global-templates-java.yaml
@@ -334,10 +334,13 @@
- timed: 'H 12 * * *'
builders:
+
- provide-maven-settings:
global-settings-file: 'global-settings'
settings-file: '{mvn-settings}'
+ - docker-login
+
- maven-docker-push-daily:
mvn-settings: '{mvn-settings}'
pom: '{docker-pom}'
diff --git a/jjb/include-docker-login.sh b/jjb/include-docker-login.sh
new file mode 100644
index 000000000..f583f73f2
--- /dev/null
+++ b/jjb/include-docker-login.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+DOCKER_REPOSITORIES=nexus3.openecomp.org:10001 \
+ nexus3.openecomp.org:10002 \
+ nexus3.openecomp.org:10003
+
+for DOCKER_REPOSITORY in $DOCKER_REPOSITORIES;
+do
+ USER=$(xpath -q -e "//servers/server[id='$DOCKER_REPOSITORY']/username/text()" "$SETTINGS_FILE")
+ PASS=$(xpath -q -e "//servers/server[id='$DOCKER_REPOSITORY']/password/text()" "$SETTINGS_FILE")
+ docker login $DOCKER_REPOSITORY -u $USER -p $PASS
+done