From 3549b847cd28995dc232e6468c911503f628fda3 Mon Sep 17 00:00:00 2001 From: rohitsakala Date: Mon, 16 Jan 2017 10:25:49 +0530 Subject: Add docker update builder to jenkins job JIRA: FUNCTEST-688 Change-Id: I67717f4a7ecfdc0c7bfbb5ed664aa6573c02d463 Signed-off-by: rohitsakala --- jjb/releng/testapi-automate.yml | 11 +++++++++++ jjb/releng/testapi-docker-update.sh | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 jjb/releng/testapi-docker-update.sh diff --git a/jjb/releng/testapi-automate.yml b/jjb/releng/testapi-automate.yml index 2a2f7b6d4..9139394ed 100644 --- a/jjb/releng/testapi-automate.yml +++ b/jjb/releng/testapi-automate.yml @@ -16,6 +16,10 @@ project: '{project}' - gerrit-parameter: branch: '{branch}' + - string: + name: DOCKER_TAG + default: "latest" + description: "Tag name for testapi docker image" - 'opnfv-build-defaults' scm: @@ -39,6 +43,7 @@ pattern: 'utils/**' builders: + - docker-update - start-testapi-server - testapi-doc-build - upload-doc-artifact @@ -48,6 +53,12 @@ # job builders ################################ +- builder: + name: docker-update + builders: + - shell: | + bash ./jjb/releng/testapi-docker-update.sh + - builder: name: testapi-doc-build builders: diff --git a/jjb/releng/testapi-docker-update.sh b/jjb/releng/testapi-docker-update.sh new file mode 100644 index 000000000..84f5c3217 --- /dev/null +++ b/jjb/releng/testapi-docker-update.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -o errexit +set -o nounset + +cd $WORKSPACE/utils/test/testapi/docker/ + +# Remove previous containers +docker ps -a | grep "opnfv/testapi" | awk '{ print $1 }' | xargs -r docker rm -f + +# Remove previous images +docker images | grep "opnfv/testapi" | awk '{ print $3 }' | xargs -r docker rmi -f + +# Start build +docker build --no-cache -t opnfv/testapi:$DOCKER_TAG . + +# Push Image +docker push opnfv/testapi:$DOCKER_TAG -- cgit 1.2.3-korg