summaryrefslogtreecommitdiffstats
path: root/jjb/armband
diff options
context:
space:
mode:
Diffstat (limited to 'jjb/armband')
-rw-r--r--jjb/armband/armband-ci-jobs.yml193
-rwxr-xr-xjjb/armband/armband-deploy.sh79
-rwxr-xr-xjjb/armband/armband-download-artifact.sh66
-rw-r--r--jjb/armband/armband-project-jobs.yml (renamed from jjb/armband/armband.yml)40
-rwxr-xr-xjjb/armband/build.sh (renamed from jjb/armband/armband-build.sh)0
-rwxr-xr-xjjb/armband/upload-artifacts.sh86
6 files changed, 454 insertions, 10 deletions
diff --git a/jjb/armband/armband-ci-jobs.yml b/jjb/armband/armband-ci-jobs.yml
new file mode 100644
index 000000000..f9cb1e917
--- /dev/null
+++ b/jjb/armband/armband-ci-jobs.yml
@@ -0,0 +1,193 @@
+# jenkins job templates for Armband
+- project:
+ name: 'armband-ci'
+ project: 'armband'
+ installer: 'fuel'
+
+#--------------------------------
+# BRANCH ANCHORS
+#--------------------------------
+ master: &master
+ stream: master
+ branch: '{stream}'
+ gs-pathname: ''
+ brahmaputra: &brahmaputra
+ stream: brahmaputra
+ branch: 'stable/{stream}'
+ gs-pathname: '/{stream}'
+#--------------------------------
+# POD, INSTALLER, AND BRANCH MAPPING
+#--------------------------------
+# brahmaputra
+#--------------------------------
+ pod:
+ - arm-pod1:
+ <<: *brahmaputra
+#--------------------------------
+# master
+#--------------------------------
+# No master deploys for now
+# - arm-pod1:
+# <<: *master
+#--------------------------------
+# scenarios
+#--------------------------------
+ scenario:
+ # HA scenarios
+ - 'os-odl_l2-nofeature-ha':
+ auto-trigger-name: 'brahmaputra-trigger-daily-disabled'
+
+ # NOHA scenarios
+ - 'os-odl_l2-nofeature-noha':
+ auto-trigger-name: 'brahmaputra-trigger-daily-disabled'
+
+ jobs:
+ - 'armband-{scenario}-{pod}-daily-{stream}'
+ - 'armband-deploy-{pod}-daily-{stream}'
+
+########################
+# job templates
+########################
+- job-template:
+ name: 'armband-{scenario}-{pod}-daily-{stream}'
+
+ concurrent: false
+
+ properties:
+ - throttle:
+ enabled: true
+ max-total: 1
+ max-per-node: 1
+ - build-blocker:
+ use-build-blocker: true
+ blocking-jobs:
+ - 'armband-os-.*?-{pod}-daily-{stream}'
+ block-level: 'NODE'
+
+ wrappers:
+ - build-name:
+ name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO'
+
+ triggers:
+ - '{auto-trigger-name}'
+
+ parameters:
+ - project-parameter:
+ project: '{project}'
+ - '{installer}-defaults'
+ - '{pod}-defaults':
+ installer: '{installer}'
+ - string:
+ name: DEPLOY_SCENARIO
+ default: '{scenario}'
+ - armband-ci-parameter:
+ gs-pathname: '{gs-pathname}'
+
+ builders:
+ - trigger-builds:
+ - project: 'armband-deploy-{pod}-daily-{stream}'
+ current-parameters: false
+ predefined-parameters:
+ DEPLOY_SCENARIO={scenario}
+ same-node: true
+ block: true
+ - trigger-builds:
+ - project: 'functest-{installer}-{pod}-daily-{stream}'
+ current-parameters: false
+ predefined-parameters:
+ DEPLOY_SCENARIO={scenario}
+ block: true
+ same-node: true
+ block-thresholds:
+ build-step-failure-threshold: 'never'
+ failure-threshold: 'never'
+ unstable-threshold: 'FAILURE'
+
+- job-template:
+ name: 'armband-deploy-{pod}-daily-{stream}'
+
+ concurrent: false
+
+ properties:
+ - throttle:
+ enabled: true
+ max-total: 1
+ max-per-node: 1
+ - build-blocker:
+ use-build-blocker: true
+ blocking-jobs:
+ - 'armband-deploy-{pod}-daily-{stream}'
+ - 'armband-deploy-generic-daily-.*'
+ block-level: 'NODE'
+
+ parameters:
+ - project-parameter:
+ project: '{project}'
+ - '{installer}-defaults'
+ - '{pod}-defaults':
+ installer: '{installer}'
+ - string:
+ name: DEPLOY_SCENARIO
+ default: 'os-odl_l2-nofeature-ha'
+ - armband-ci-parameter:
+ gs-pathname: '{gs-pathname}'
+
+ scm:
+ - git-scm:
+ credentials-id: '{ssh-credentials}'
+ refspec: ''
+ branch: '{branch}'
+
+ wrappers:
+ - build-name:
+ name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO'
+
+ builders:
+ - shell:
+ !include-raw-escape: ./armband-download-artifact.sh
+ - shell:
+ !include-raw-escape: ./armband-deploy.sh
+
+ publishers:
+ - email:
+ recipients: josep.puigdemont@enea.com armband@enea.com
+
+########################
+# parameter macros
+########################
+- parameter:
+ name: armband-ci-parameter
+ parameters:
+ - string:
+ name: BUILD_DIRECTORY
+ default: $WORKSPACE/build_output
+ description: "Directory where the build artifact will be located upon the completion of the build."
+ - string:
+ name: CACHE_DIRECTORY
+ default: $HOME/opnfv/cache/$INSTALLER_TYPE
+ description: "Directory where the cache to be used during the build is located."
+ - string:
+ name: GS_URL
+ default: artifacts.opnfv.org/$PROJECT{gs-pathname}
+ description: "URL to Google Storage."
+
+########################
+# trigger macros
+########################
+# CI PODs
+#----------------------------------------------------------
+# Enea Armband POD 1 Triggers running against master branch
+#----------------------------------------------------------
+# No triggers for master for now
+- trigger:
+ name: 'armband-os-odl_l2-nofeature-ha-arm-pod1-master-trigger'
+ triggers:
+ - timed: ''
+
+#---------------------------------------------------------------
+# Enea Armband POD 1 Triggers running against brahmaputra branch
+#---------------------------------------------------------------
+- trigger:
+ name: 'armband-os-odl_l2-nofeature-ha-arm-pod1-brahmaputra-trigger'
+ triggers:
+ - timed: '0 6 * * *'
diff --git a/jjb/armband/armband-deploy.sh b/jjb/armband/armband-deploy.sh
new file mode 100755
index 000000000..222a388e6
--- /dev/null
+++ b/jjb/armband/armband-deploy.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2016 Ericsson AB and others.
+# (c) 2016 Enea Software AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+set -o errexit
+set -o nounset
+set -o pipefail
+
+# source the file so we get OPNFV vars
+source latest.properties
+
+# echo the info about artifact that is used during the deployment
+echo "Using ${OPNFV_ARTIFACT_URL/*\/} for deployment"
+
+if [[ "$JOB_NAME" =~ "merge" ]]; then
+ # set simplest scenario for virtual deploys to run for merges
+ DEPLOY_SCENARIO="os-nosdn-nofeature-ha"
+else
+ # for none-merge deployments
+ # checkout the commit that was used for building the downloaded artifact
+ # to make sure the ISO and deployment mechanism uses same versions
+ echo "Checking out $OPNFV_GIT_SHA1"
+ git checkout $OPNFV_GIT_SHA1 --quiet
+fi
+
+# set deployment parameters
+export TMPDIR=$HOME/tmpdir
+BRIDGE=${DEFAULT_BRIDGE:-pxebr}
+LAB_NAME=${NODE_NAME/-*}
+POD_NAME=${NODE_NAME/*-}
+
+# we currently support enea
+if [[ ! "$LAB_NAME" =~ "enea" ]]; then
+ echo "Unsupported/unidentified lab $LAB_NAME. Cannot continue!"
+ exit 1
+else
+ echo "Using configuration for $LAB_NAME"
+fi
+
+# create TMPDIR if it doesn't exist
+mkdir -p $TMPDIR
+
+cd $WORKSPACE
+if [[ $LAB_CONFIG_URL =~ ^git:// ]]; then
+ git clone --quiet --branch ${GIT_BRANCH##origin/} $LAB_CONFIG_URL lab-config
+ LAB_CONFIG_URL=file://${WORKSPACE}/lab-config
+fi
+
+# construct the command
+DEPLOY_COMMAND="$WORKSPACE/ci/deploy.sh -b ${LAB_CONFIG_URL} -l $LAB_NAME -p $POD_NAME -s $DEPLOY_SCENARIO -i file://$WORKSPACE/opnfv.iso -H -B $BRIDGE -S $TMPDIR"
+
+# log info to console
+echo "Deployment parameters"
+echo "--------------------------------------------------------"
+echo "Scenario: $DEPLOY_SCENARIO"
+echo "Lab: $LAB_NAME"
+echo "POD: $POD_NAME"
+echo "ISO: ${OPNFV_ARTIFACT_URL/*\/}"
+echo
+echo "Starting the deployment using $INSTALLER_TYPE. This could take some time..."
+echo "--------------------------------------------------------"
+echo
+
+# start the deployment
+echo "Issuing command"
+echo "$DEPLOY_COMMAND"
+echo
+
+$DEPLOY_COMMAND
+
+echo
+echo "--------------------------------------------------------"
+echo "Deployment is done successfully!"
diff --git a/jjb/armband/armband-download-artifact.sh b/jjb/armband/armband-download-artifact.sh
new file mode 100755
index 000000000..15ad67d6e
--- /dev/null
+++ b/jjb/armband/armband-download-artifact.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2016 Ericsson AB and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+set -o errexit
+set -o pipefail
+
+if [[ "$JOB_NAME" =~ "merge" ]]; then
+ echo "Downloading http://$GS_URL/opnfv-gerrit-$GERRIT_CHANGE_NUMBER.properties"
+ # get the properties file for the Armband Fuel ISO built for a merged change
+ curl -s -o $WORKSPACE/latest.properties http://$GS_URL/opnfv-gerrit-$GERRIT_CHANGE_NUMBER.properties
+else
+ # get the latest.properties file in order to get info regarding latest artifact
+ echo "Downloading http://$GS_URL/latest.properties"
+ curl -s -o $WORKSPACE/latest.properties http://$GS_URL/latest.properties
+fi
+
+# check if we got the file
+# FIXME: the file is created even if it didn't exist on the host
+# We should check that the contents are sane
+[[ -f latest.properties ]] || exit 1
+
+# source the file so we get artifact metadata
+source latest.properties
+
+# echo the info about artifact that is used during the deployment
+OPNFV_ARTIFACT=${OPNFV_ARTIFACT_URL/*\/}
+echo "Using $OPNFV_ARTIFACT for deployment"
+
+# using ISOs for verify & merge jobs from local storage will be enabled later
+if [[ ! "$JOB_NAME" =~ (verify|merge) ]]; then
+ # check if we already have the ISO to avoid redownload
+ ISOSTORE="/iso_mount/opnfv_ci/${GIT_BRANCH##*/}"
+ if [[ -f "$ISOSTORE/$OPNFV_ARTIFACT" ]]; then
+ echo "ISO exists locally. Skipping the download and using the file from ISO store"
+ ln -s $ISOSTORE/$OPNFV_ARTIFACT $WORKSPACE/opnfv.iso
+ echo "--------------------------------------------------------"
+ echo
+ ls -al $WORKSPACE/opnfv.iso
+ echo
+ echo "--------------------------------------------------------"
+ echo "Done!"
+ exit 0
+ fi
+fi
+
+# log info to console
+echo "Downloading the $INSTALLER_TYPE artifact using URL http://$OPNFV_ARTIFACT_URL"
+echo "This could take some time..."
+echo "--------------------------------------------------------"
+echo
+
+# download the file
+curl -s -o $WORKSPACE/opnfv.iso http://$OPNFV_ARTIFACT_URL
+
+# The file is always created, check that it is in fact an ISO image
+[[ $(file $WORKSPACE/opnfv.iso) =~ ISO ]]
+
+echo
+echo "--------------------------------------------------------"
+echo "Done!"
diff --git a/jjb/armband/armband.yml b/jjb/armband/armband-project-jobs.yml
index 75c0e7a7b..b40949d27 100644
--- a/jjb/armband/armband.yml
+++ b/jjb/armband/armband-project-jobs.yml
@@ -9,6 +9,7 @@
jobs:
- 'armband-verify-{stream}'
+ - 'armband-build-daily-{stream}'
stream:
- master:
@@ -72,15 +73,11 @@
max-per-node: 1
parameters:
- - project-parameters:
+ - project-parameter:
project: '{project}'
- 'arm-build1-defaults'
- - choice:
- name: FORCE_BUILD
- choices:
- - 'false'
- - 'true'
- description: 'Force build even if there are no changes in the armband repo. Default false'
+ - armband-project-parameter:
+ gs-pathname: '{gs-pathname}'
scm:
- git-scm:
@@ -89,18 +86,41 @@
branch: '{branch}'
triggers:
- -pollscm:
+ - pollscm:
cron: '0 H/4 * * *'
wrappers:
- -timeout:
+ - timeout:
timeout: 360
fail: true
builders:
- shell:
- !include-raw-escape: ./armband-build.sh
+ !include-raw-escape: ./build.sh
+ - shell:
+ !include-raw-escape: ./upload-artifacts.sh
publishers:
- email:
recipients: josep.puigdemont@enea.com armband@enea.com
+
+########################
+# parameter macros
+########################
+- parameter:
+ name: armband-project-parameter
+ parameters:
+ - string:
+ name: BUILD_DIRECTORY
+ default: $WORKSPACE/build_output
+ description: "Directory where the build artifact will be located upon the completion of the build."
+ - string:
+ name: GS_URL
+ default: artifacts.opnfv.org/$PROJECT{gs-pathname}
+ description: "URL to Google Storage."
+ - choice:
+ name: FORCE_BUILD
+ choices:
+ - 'false'
+ - 'true'
+ description: 'Force build even if there are no changes in the armband repo. Default false'
diff --git a/jjb/armband/armband-build.sh b/jjb/armband/build.sh
index 81917f6de..81917f6de 100755
--- a/jjb/armband/armband-build.sh
+++ b/jjb/armband/build.sh
diff --git a/jjb/armband/upload-artifacts.sh b/jjb/armband/upload-artifacts.sh
new file mode 100755
index 000000000..f4e84e9d2
--- /dev/null
+++ b/jjb/armband/upload-artifacts.sh
@@ -0,0 +1,86 @@
+#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2016 Ericsson AB and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+set -o pipefail
+
+# check if we built something
+if [ -f $WORKSPACE/.noupload ]; then
+ echo "Nothing new to upload. Exiting."
+ /bin/rm -f $WORKSPACE/.noupload
+ exit 0
+fi
+
+# source the opnfv.properties to get ARTIFACT_VERSION
+source $WORKSPACE/opnfv.properties
+
+# storing ISOs for verify & merge jobs will be done once we get the disk array
+if [[ ! "$JOB_NAME" =~ (verify|merge) ]]; then
+ # store ISO locally on NFS first
+ ISOSTORE="/home/jenkins/opnfv/iso_store"
+ if [[ -d "$ISOSTORE" ]]; then
+ # remove all but most recent 3 ISOs first to keep iso_mount clean & tidy
+ cd $ISOSTORE
+ ls -tp | grep -v '/' | tail -n +4 | xargs -d '\n' /bin/rm -f --
+
+ # store ISO
+ echo "Storing latest ISO in local storage"
+ touch .storing
+ /bin/cp -f $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso \
+ $ISOSTORE/opnfv-$OPNFV_ARTIFACT_VERSION.iso
+ rm .storing
+ fi
+fi
+
+# log info to console
+echo "Uploading armband artifacts. This could take some time..."
+echo
+
+echo "Started at $(date)"
+cd $WORKSPACE
+# upload artifact and additional files to google storage
+gsutil cp $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso \
+ gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
+gsutil cp $WORKSPACE/opnfv.properties \
+ gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
+if [[ ! "$JOB_NAME" =~ (verify|merge) ]]; then
+ gsutil cp $WORKSPACE/opnfv.properties \
+ gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
+elif [[ "$JOB_NAME" =~ "merge" ]]; then
+ echo "Uploaded Armband Fuel ISO for a merged change"
+fi
+echo "Ended at $(date)"
+
+gsutil -m setmeta \
+ -h "Content-Type:text/html" \
+ -h "Cache-Control:private, max-age=0, no-transform" \
+ gs://$GS_URL/latest.properties \
+ gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > /dev/null 2>&1
+
+gsutil -m setmeta \
+ -h "Cache-Control:private, max-age=0, no-transform" \
+ gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > /dev/null 2>&1
+
+# disabled errexit due to gsutil setmeta complaints
+# BadRequestException: 400 Invalid argument
+# check if we uploaded the file successfully to see if things are fine
+gsutil ls gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > /dev/null 2>&1
+if [[ $? -ne 0 ]]; then
+ echo "Problem while uploading artifact!"
+ echo "Check log $WORKSPACE/gsutil.iso.log on the machine where this build is done."
+ exit 1
+fi
+
+echo "Done!"
+echo
+echo "--------------------------------------------------------"
+echo
+echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
+echo
+echo "--------------------------------------------------------"
+echo