diff options
Diffstat (limited to 'jjb')
-rw-r--r-- | jjb/calipso/calipso.yml | 59 | ||||
-rwxr-xr-x | jjb/dovetail/dovetail-run.sh | 31 | ||||
-rw-r--r-- | jjb/releng/automate.yml | 6 | ||||
-rw-r--r-- | jjb/releng/docker-deploy.sh | 156 | ||||
-rw-r--r-- | jjb/xci/xci-verify-jobs.yml | 22 |
5 files changed, 212 insertions, 62 deletions
diff --git a/jjb/calipso/calipso.yml b/jjb/calipso/calipso.yml new file mode 100644 index 000000000..b8d10eb89 --- /dev/null +++ b/jjb/calipso/calipso.yml @@ -0,0 +1,59 @@ +- project: + name: calipso + + project: '{name}' + + jobs: + - 'calipso-verify-{stream}' + + stream: + - master: + branch: '{stream}' + disabled: false + +- job-template: + name: 'calipso-verify-{stream}' + + disabled: '{obj:disabled}' + + parameters: + - project-parameter: + project: '{project}' + branch: '{branch}' + + scm: + - git-scm-gerrit + + triggers: + - gerrit: + server-name: 'gerrit.opnfv.org' + trigger-on: + - patchset-created-event: + exclude-drafts: 'false' + exclude-trivial-rebase: 'false' + exclude-no-code-change: 'false' + - draft-published-event + - comment-added-contains-event: + comment-contains-value: 'recheck' + - comment-added-contains-event: + comment-contains-value: 'reverify' + projects: + - project-compare-type: 'ANT' + project-pattern: '{project}' + branches: + - branch-compare-type: 'ANT' + branch-pattern: '**/{branch}' + + builders: + - verify-unit-tests + +- builder: + name: verify-unit-tests + builders: + - shell: | + #!/bin/bash + set -o errexit + set -o nounset + set -o pipefail + cd $WORKSPACE + PYTHONPATH=$PWD/app python3 -m unittest discover -s app/test/fetch diff --git a/jjb/dovetail/dovetail-run.sh b/jjb/dovetail/dovetail-run.sh index 7bbecc129..d05b309cd 100755 --- a/jjb/dovetail/dovetail-run.sh +++ b/jjb/dovetail/dovetail-run.sh @@ -160,6 +160,37 @@ if [ $(docker ps | grep "opnfv/dovetail:${DOCKER_TAG}" | wc -l) == 0 ]; then exit 1 fi +# Modify tempest_conf.yaml file +tempest_conf_file=${DOVETAIL_CONFIG}/tempest_conf.yaml +if [ ${INSTALLER_TYPE} == 'compass' ]; then + volume_device='vdb' +else + volume_device='vdc' +fi + +cat << EOF >$tempest_conf_file + +compute: + min_compute_nodes: 2 + volume_device_name: ${volume_device} + min_microversion: 2.0 + max_microversion: latest + +compute-feature-enabled: + live_migration: True + block_migration_for_live_migration: True + block_migrate_cinder_iscsi: True + attach_encrypted_volume: True + +EOF + +echo "${tempest_conf_file}..." +cat ${tempest_conf_file} + +cp_tempest_cmd="docker cp ${DOVETAIL_CONFIG}/tempest_conf.yaml $container_id:/home/opnfv/dovetail/dovetail/userconfig" +echo "exec command: ${cp_tempest_cmd}" +$cp_tempest_cmd + list_cmd="dovetail list ${TESTSUITE}" run_cmd="dovetail run --testsuite ${TESTSUITE} -d" echo "Container exec command: ${list_cmd}" diff --git a/jjb/releng/automate.yml b/jjb/releng/automate.yml index d12ee5d68..c6ca37fa9 100644 --- a/jjb/releng/automate.yml +++ b/jjb/releng/automate.yml @@ -237,16 +237,16 @@ name: 'testapi-automate-docker-deploy-macro' builders: - shell: | - bash ./jjb/releng/docker-deploy.sh "sudo docker run -dti -p 8082:8000 + sudo bash ./jjb/releng/docker-deploy.sh "sudo docker run -dti --name testapi -p 8082:8000 -e mongodb_url=mongodb://172.17.0.1:27017 -e base_url=http://testresults.opnfv.org/test opnfv/testapi" \ - "http://testresults.opnfv.org/test/swagger/APIs" "testapi" + "http://testresults.opnfv.org/test/" "testapi" - builder: name: 'reporting-automate-docker-deploy-macro' builders: - shell: | - bash ./jjb/releng/docker-deploy.sh "sudo docker run -itd -p 8084:8000 opnfv/reporting" \ + sudo bash ./jjb/releng/docker-deploy.sh "sudo docker run -itd --name reporting -p 8084:8000 opnfv/reporting" \ "http://testresults.opnfv.org/reporting2/reporting/index.html" "reporting" - builder: diff --git a/jjb/releng/docker-deploy.sh b/jjb/releng/docker-deploy.sh index 2a3e078ae..1e8357717 100644 --- a/jjb/releng/docker-deploy.sh +++ b/jjb/releng/docker-deploy.sh @@ -16,89 +16,137 @@ # specific language governing permissions and limitations * # under the License. * -# Assigning Variables + command=$1 url=$2 module=$3 -function check() { +REPO="opnfv" +latest_image=$REPO/$module:latest +old_image=$REPO/$module:old +latest_container_name=$module +old_container_name=$module"_old" +latest_container_id= +old_container_id= +new_start_container= + +function DEBUG() { + echo `date "+%Y-%m-%d %H:%M:%S.%N"` ": $1" +} - # Verify hosted +function check_connectivity() { + # check update status via test the connectivity of provide url sleep 5 cmd=`curl -s --head --request GET ${url} | grep '200 OK' > /dev/null` rc=$? - echo $rc - - if [[ $rc == 0 ]] - then + DEBUG $rc + if [[ $rc == 0 ]]; then return 0 else return 1 fi - } -echo "Getting contianer Id of the currently running one" -contId=$(sudo docker ps | grep "opnfv/${module}:latest" | awk '{print $1}') - -echo $contId -echo "Pulling the latest image" -sudo docker pull opnfv/${module}:latest +function pull_latest_image() { + DEBUG "pull latest image $latest_image" + docker pull $latest_image +} -echo "Deleting old containers of opnfv/${module}:old" -sudo docker ps -a | grep "opnfv/${module}" | grep "old" | awk '{print $1}' | xargs -r sudo docker rm -f +function get_latest_running_container() { + latest_container_id=`docker ps -q --filter name=^/$latest_container_name$` +} -echo "Deleting old images of opnfv/${module}:latest" -sudo docker images | grep "opnfv/${module}" | grep "old" | awk '{print $3}' | xargs -r sudo docker rmi -f +function get_old_running_container() { + old_container_id=`docker ps -q --filter name=^/$old_container_name$` +} +function delete_old_image() { + DEBUG "delete old image: $old_image" + docker rmi -f $old_image +} -if [[ -z "$contId" ]] -then - echo "No running ${module} container" +function delete_old_container() { + DEBUG "delete old container: $old_container_name" + docker ps -a -q --filter name=^/$old_container_name$ | xargs docker rm -f &>/dev/null +} - echo "Removing stopped ${module} containers in the previous iterations" - sudo docker ps -f status=exited | grep "opnfv_${module}" | awk '{print $1}' | xargs -r sudo docker rm -f -else - echo $contId +function delete_latest_container() { + DEBUG "delete latest container: $module" + docker ps -a -q --filter name=^/$latest_container_name$ | xargs docker rm -f &>/dev/null +} - echo "Get the image id of the currently running conatiner" - currImgId=$(sudo docker ps | grep "$contId" | awk '{print $2}') - echo $currImgId +function delete_latest_image() { + DEBUG "delete latest image: $REPO/$module:latest" + docker rmi -f $latest_image +} - if [[ -z "$currImgId" ]] - then - echo "No image id found for the container id" - exit 1 - fi +function change_image_tag_2_old() { + DEBUG "change image tag 2 old" + docker tag $latest_image $old_image + docker rmi -f $latest_image +} - echo "Changing current image tag to old" - sudo docker tag "$currImgId" opnfv/${module}:old +function mark_latest_container_2_old() { + DEBUG "mark latest container to be old" + docker rename "$latest_container_name" "$old_container_name" +} - echo "Removing stopped ${module} containers in the previous iteration" - sudo docker ps -f status=exited | grep "opnfv_${module}" | awk '{print $1}' | xargs -r sudo docker rm -f +function stop_old_container() { + DEBUG "stop old container" + docker stop "$old_container_name" +} - echo "Renaming the running container name to opnfv_${module} as to identify it." - sudo docker rename $contId opnfv_${module} +function run_latest_image() { + new_start_container=`$command` + DEBUG "run latest image: $new_start_container" +} - echo "Stop the currently running container" - sudo docker stop $contId +get_latest_running_container +get_old_running_container + +if [[ ! -z $latest_container_id ]]; then + DEBUG "latest container is running: $latest_container_id" + delete_old_container + delete_old_image + change_image_tag_2_old + mark_latest_container_2_old + pull_latest_image + stop_old_container + run_latest_image + +elif [[ ! -z $old_container_id ]]; then + DEBUG "old container is running: $old_container_id" + delete_latest_container + delete_latest_image + pull_latest_image + stop_old_container + run_latest_image +else + DEBUG "no container is running" + delete_old_container + delete_old_image + delete_latest_container + delete_latest_image + pull_latest_image + run_latest_image fi -echo "Running a container with the new image" -$command:latest - -if check; then - echo "TestResults Module Hosted." +if check_connectivity; then + DEBUG "CONGRATS: $module update successfully" else - echo "TestResults Module Failed" - if [[ $(sudo docker images | grep "opnfv/${module}" | grep "old" | awk '{print $3}') ]]; then - echo "Running old Image" - $command:old - exit 1 + DEBUG "ATTENTION: $module update failed" + id=`docker ps -a -q --filter name=^/$old_container_name$` + if [[ ! -z $id ]]; then + DEBUG "start old container instead" + docker stop $new_start_container + docker start $id + fi + if ! check_connectivity; then + DEBUG "BIG ISSUE: no container is running normally" fi + exit 1 fi -# Echo Images and Containers -sudo docker images -sudo docker ps -a +docker images +docker ps -a diff --git a/jjb/xci/xci-verify-jobs.yml b/jjb/xci/xci-verify-jobs.yml index 6bc064253..8d1ee55a4 100644 --- a/jjb/xci/xci-verify-jobs.yml +++ b/jjb/xci/xci-verify-jobs.yml @@ -109,6 +109,10 @@ - label: name: SLAVE_LABEL default: 'xci-virtual-{distro}' + - string: + name: GIT_BASE + default: https://gerrit.opnfv.org/gerrit/$PROJECT + description: 'Git URL to use on this Jenkins Slave' builders: - description-setter: @@ -130,7 +134,7 @@ condition: SUCCESSFUL projects: - name: 'xci-verify-healthcheck-{type}-{stream}' - current-parameters: false + current-parameters: true predefined-parameters: | DISTRO={distro} DEPLOY_SCENARIO=os-nosdn-nofeature-noha @@ -162,7 +166,7 @@ parameters: - string: name: DISTRO - default: '{distro}' + default: 'xenial' - string: name: DEPLOY_SCENARIO default: 'os-nosdn-nofeature-noha' @@ -173,11 +177,15 @@ name: XCI_FLAVOR default: 'mini' - string: - name: XCI_DEVEL_ROOT - default: $WORKSPACE + name: OPNFV_RELENG_DEV_PATH + default: $WORKSPACE/ - string: name: ANSIBLE_VERBOSITY default: '-vvvv' + - string: + name: GIT_BASE + default: https://gerrit.opnfv.org/gerrit/$PROJECT + description: 'Git URL to use on this Jenkins Slave' wrappers: - ssh-agent-wrapper @@ -202,7 +210,11 @@ - shell: | #!/bin/bash - cd $WORKSPACE + # for some reason, the PATH is not set correctly + # setting PATH for ansible stuff + export PATH=/home/jenkins/.local/bin:$PATH + + cd $WORKSPACE/xci ./xci-deploy.sh - builder: |