summaryrefslogtreecommitdiffstats
path: root/jjb
diff options
context:
space:
mode:
authorrohitsakala <rohitsakala@gmail.com>2017-06-29 22:08:05 +0530
committerSakala Venkata Krishna Rohit <rohitsakala@gmail.com>2017-07-02 19:46:25 +0000
commit0466d549e60cb77068242a2df1bac0cbe262975a (patch)
treeed02760df775245a012c60a7927447886c6e34c0 /jjb
parent1a1d548a72bd91ca1f1241ec8fb4c8afb944ab88 (diff)
Add jenkins jobs for automatic reporting dashboard deployment
Jenkins Jobs have been added for automating the deployment of the reporting dashboard. Also multijob has been added for automating the update of docker in the docker hub and generating docs which is empty for now. Modified unit tests of reporting to make it run from any directory. Modified the testapi jenkins jobs yaml file to generic so that many other modules which may have the same usecases can be integrated easily just like the reporting one that is done now. Change-Id: Id13a55416e17199dae1dd6ce64f7c167d117ba37 Signed-off-by: Sakala Venkata Krishna Rohit <rohitsakala@gmail.com>
Diffstat (limited to 'jjb')
-rw-r--r--jjb/releng/automate.yml (renamed from jjb/releng/testapi-automate.yml)92
-rw-r--r--jjb/releng/docker-deploy.sh (renamed from jjb/releng/testapi-docker-deploy.sh)26
-rw-r--r--jjb/releng/docker-update.sh34
-rw-r--r--jjb/releng/testapi-docker-update.sh18
4 files changed, 103 insertions, 67 deletions
diff --git a/jjb/releng/testapi-automate.yml b/jjb/releng/automate.yml
index dd76538a3..9eb281de3 100644
--- a/jjb/releng/testapi-automate.yml
+++ b/jjb/releng/automate.yml
@@ -1,20 +1,22 @@
- project:
- name: testapi-automate
+ name: utils-automate
stream:
- master:
branch: '{stream}'
- gs-pathname: ''
+
+ module:
+ - 'testapi'
+ - 'reporting'
phase:
- - 'docker-update'
- 'docker-deploy':
slave-label: 'testresults'
- 'generate-doc'
jobs:
- - 'testapi-automate-{stream}'
- - 'testapi-automate-{phase}-{stream}'
- - 'testapi-verify-{stream}'
+ - '{module}-automate-{stream}'
+ - '{module}-automate-{phase}-{stream}'
+ - '{module}-verify-{stream}'
project: 'releng'
@@ -44,7 +46,7 @@
- mongodb-backup
- job-template:
- name: 'testapi-verify-{stream}'
+ name: '{module}-verify-{stream}'
parameters:
- project-parameter:
@@ -76,10 +78,11 @@
branch-pattern: '**/{branch}'
file-paths:
- compare-type: 'ANT'
- pattern: 'utils/test/testapi/**'
+ pattern: 'utils/test/{module}/**'
builders:
- - run-unit-tests
+ - shell: |
+ bash ./utils/test/{module}/run_test.sh
publishers:
- junit:
@@ -101,7 +104,7 @@
failing: 30
- job-template:
- name: 'testapi-automate-{stream}'
+ name: '{module}-automate-{stream}'
project-type: multijob
@@ -118,8 +121,12 @@
branch: '{branch}'
- string:
name: DOCKER_TAG
- default: "latest"
- description: "Tag name for testapi docker image"
+ default: 'latest'
+ description: 'Tag name for {module} docker image'
+ - string:
+ name: MODULE_NAME
+ default: '{module}'
+ description: "Name of the module"
- 'opnfv-build-defaults'
scm:
@@ -146,24 +153,17 @@
branch-pattern: '**/{branch}'
file-paths:
- compare-type: 'ANT'
- pattern: 'utils/test/testapi/**'
+ pattern: 'utils/test/{module}/**'
builders:
- description-setter:
description: "Built on $NODE_NAME"
- - multijob:
- name: docker-update
- condition: SUCCESSFUL
- projects:
- - name: 'testapi-automate-docker-update-{stream}'
- current-parameters: true
- kill-phase-on: FAILURE
- abort-all-job: true
+ - docker-update
- multijob:
name: docker-deploy
condition: SUCCESSFUL
projects:
- - name: 'testapi-automate-docker-deploy-{stream}'
+ - name: '{module}-automate-docker-deploy-{stream}'
current-parameters: false
predefined-parameters: |
GIT_BASE=$GIT_BASE
@@ -175,7 +175,7 @@
name: generate-doc
condition: SUCCESSFUL
projects:
- - name: 'testapi-automate-generate-doc-{stream}'
+ - name: '{module}-automate-generate-doc-{stream}'
current-parameters: true
kill-phase-on: FAILURE
abort-all-job: true
@@ -184,7 +184,7 @@
- 'email-publisher'
- job-template:
- name: 'testapi-automate-{phase}-{stream}'
+ name: '{module}-automate-{phase}-{stream}'
properties:
- throttle:
@@ -196,10 +196,6 @@
- project-parameter:
project: '{project}'
branch: '{branch}'
- - string:
- name: DOCKER_TAG
- default: "latest"
- description: "Tag name for testapi docker image"
wrappers:
- ssh-agent-wrapper
@@ -213,28 +209,16 @@
builders:
- description-setter:
description: "Built on $NODE_NAME"
- - 'testapi-automate-{phase}-macro'
+ - '{module}-automate-{phase}-macro'
################################
# job builders
################################
- builder:
- name: mongodb-backup
- builders:
- - shell: |
- bash ./jjb/releng/testapi-backup-mongodb.sh
-
-- builder:
- name: 'run-unit-tests'
+ name: 'docker-update'
builders:
- - shell: |
- bash ./utils/test/testapi/run_test.sh
-
-- builder:
- name: 'testapi-automate-docker-update-macro'
- builders:
- - shell: |
- bash ./jjb/releng/testapi-docker-update.sh
+ - shell:
+ !include-raw: ./docker-update.sh
- builder:
name: 'testapi-automate-generate-doc-macro'
@@ -255,10 +239,26 @@
bash ./utils/test/testapi/htmlize/push-doc-artifact.sh
- builder:
+ name: 'reporting-automate-generate-doc-macro'
+ builders:
+ - shell: echo "To Be Done"
+
+- builder:
name: 'testapi-automate-docker-deploy-macro'
builders:
- shell: |
- bash ./jjb/releng/testapi-docker-deploy.sh
+ bash ./jjb/releng/docker-deploy.sh 'sudo docker run -dti -p 8082:8000 -e mongodb_url=mongodb://172.17.0.1:27017 -e swagger_url=http://testresults.opnfv.org/test opnfv/testapi' "http://testresults.opnfv.org/test/swagger/APIs"
+- builder:
+ name: 'reporting-automate-docker-deploy-macro'
+ builders:
+ - shell: |
+ bash ./jjb/releng/docker-deploy.sh 'sudo docker run -itd -p 8084:8000 -e SERVER_URL=http://testresults.opnfv.org/reporting2:8084 opnfv/reporting' "http://testresults.opnfv.org/reporting2/reporting/index.html"
+
+- builder:
+ name: mongodb-backup
+ builders:
+ - shell: |
+ bash ./jjb/releng/testapi-backup-mongodb.sh
################################
# job publishers
@@ -268,6 +268,6 @@
name: 'email-publisher'
publishers:
- email:
- recipients: rohitsakala@gmail.com feng.xiaowei@zte.com.cn
+ recipients: rohitsakala@gmail.com feng.xiaowei@zte.com.cn morgan.richomme@orange.com
notify-every-unstable-build: false
send-to-individuals: true
diff --git a/jjb/releng/testapi-docker-deploy.sh b/jjb/releng/docker-deploy.sh
index 02c5e3a27..b3b930fc4 100644
--- a/jjb/releng/testapi-docker-deploy.sh
+++ b/jjb/releng/docker-deploy.sh
@@ -1,10 +1,30 @@
#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one *
+# or more contributor license agreements. See the NOTICE file *
+# distributed with this work for additional information *
+# regarding copyright ownership. The ASF licenses this file *
+# to you under the Apache License, Version 2.0 (the *
+# "License"); you may not use this file except in compliance *
+# with the License. You may obtain a copy of the License at *
+# *
+# http://www.apache.org/licenses/LICENSE-2.0 *
+# *
+# Unless required by applicable law or agreed to in writing, *
+# software distributed under the License is distributed on an *
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+# KIND, either express or implied. See the License for the *
+# specific language governing permissions and limitations *
+# under the License. *
+
+# Assigning Variables
+command=$1
+url=$2
function check() {
# Verify hosted
sleep 5
- cmd=`curl -s --head --request GET http://testresults.opnfv.org/test/swagger/APIs | grep '200 OK' > /dev/null`
+ cmd=`curl -s --head --request GET ${url} | grep '200 OK' > /dev/null`
rc=$?
echo $rc
@@ -63,7 +83,7 @@ else
fi
echo "Running a container with the new image"
-sudo docker run -dti -p "8082:8000" -e "mongodb_url=mongodb://172.17.0.1:27017" -e "swagger_url=http://testresults.opnfv.org/test" opnfv/testapi:latest
+$command:latest
if check; then
echo "TestResults Hosted."
@@ -71,7 +91,7 @@ else
echo "TestResults Hosting Failed"
if [[ $(sudo docker images | grep "opnfv/testapi" | grep "old" | awk '{print $3}') ]]; then
echo "Running old Image"
- sudo docker run -dti -p "8082:8000" -e "mongodb_url=mongodb://172.17.0.1:27017" -e "swagger_url=http://testresults.opnfv.org/test" opnfv/testapi:old
+ $command:old
exit 1
fi
fi
diff --git a/jjb/releng/docker-update.sh b/jjb/releng/docker-update.sh
new file mode 100644
index 000000000..559ac835c
--- /dev/null
+++ b/jjb/releng/docker-update.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one *
+# or more contributor license agreements. See the NOTICE file *
+# distributed with this work for additional information *
+# regarding copyright ownership. The ASF licenses this file *
+# to you under the Apache License, Version 2.0 (the *
+# "License"); you may not use this file except in compliance *
+# with the License. You may obtain a copy of the License at *
+# *
+# http://www.apache.org/licenses/LICENSE-2.0 *
+# *
+# Unless required by applicable law or agreed to in writing, *
+# software distributed under the License is distributed on an *
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+# KIND, either express or implied. See the License for the *
+# specific language governing permissions and limitations *
+# under the License. *
+
+set -o errexit
+set -o nounset
+
+cd $WORKSPACE/utils/test/$MODULE_NAME/docker/
+
+# Remove previous containers
+docker ps -a | grep "opnfv/$MODULE_NAME" | awk '{ print $1 }' | xargs -r docker rm -f
+
+# Remove previous images
+docker images | grep "opnfv/$MODULE_NAME" | awk '{ print $3 }' | xargs -r docker rmi -f
+
+# Start build
+docker build --no-cache -t opnfv/$MODULE_NAME:$DOCKER_TAG .
+
+# Push Image
+docker push opnfv/$MODULE_NAME:$DOCKER_TAG
diff --git a/jjb/releng/testapi-docker-update.sh b/jjb/releng/testapi-docker-update.sh
deleted file mode 100644
index 84f5c3217..000000000
--- a/jjb/releng/testapi-docker-update.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/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