# this is the job configuration for bgs - project: name: compass installer: 'compass' jobs: - 'compass-verify' - 'compass-merge' - 'compass-daily-{stream}' - 'compass-build-iso' - 'compass-build-ppa' - 'compass-deploy-virtual-{flavor}' - 'compass-deploy-bare-huawei-us' # stream: branch with - in place of / (eg. stable-helium) # branch: branch (eg. stable/helium) stream: - master: branch: 'master' flavor: - cluster-odl: conf: 'virtual_cluster_odl' node: 'huawei-deploy-vm' - cluster-onos: conf: 'virtual_cluster_onos' node: 'huawei-deploy-vm' - cluster: conf: 'virtual_cluster' node: 'huawei-deploy-vm' project: 'compass4nfv' ######################## # job templates ######################## - job-template: name: 'compass-verify' disabled: false node: 'huawei-deploy-vm' concurrent: true properties: - throttle: enabled: true max-total: 3 max-per-node: 1 logrotate: daysToKeep: 30 numToKeep: 10 artifactDaysToKeep: -1 artifactNumToKeep: -1 parameters: - project-parameter: project: '{project}' - gerrit-parameter: branch: 'master' - compass-parameter: installer: '{installer}' - string: name: FLAVOR_CONF default: 'virtual_cluster' description: "" scm: - gerrit-trigger-scm: credentials-id: '{ssh-credentials}' refspec: '$GERRIT_REFSPEC' choosing-strategy: 'gerrit' triggers: - gerrit: 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: '**/master' forbidden-file-paths: - compare-type: ANT pattern: 'docs/**' builders: - 'builder-compass-build-iso' - 'builder-compass-deploy-virtual-flavor' publishers: - archive: artifacts: 'ansible.log' allow-empty: 'true' fingerprint: true - job-template: name: 'compass-merge' # builder-merge job to run JJB update # # This job's purpose is to update all the JJB node: huawei-build concurrent: true properties: - throttle: enabled: true max-total: 3 max-per-node: 1 logrotate: daysToKeep: 30 numToKeep: 40 artifactDaysToKeep: -1 artifactNumToKeep: 5 parameters: - project-parameter: project: '{project}' - gerrit-parameter: branch: 'master' - compass-parameter: installer: '{installer}' scm: - gerrit-trigger-scm: credentials-id: '{ssh-credentials}' refspec: '' choosing-strategy: 'default' triggers: - gerrit: trigger-on: - change-merged-event - comment-added-contains-event: comment-contains-value: 'remerge' projects: - project-compare-type: 'ANT' project-pattern: '{project}' branches: - branch-compare-type: 'ANT' branch-pattern: '**/master' builders: - 'builder-compass-merge' - job-template: name: 'compass-daily-{stream}' node: huawei-build concurrent: true properties: - throttle: enabled: true max-total: 1 max-per-node: 1 parameters: - project-parameter: project: '{project}' - compass-parameter: installer: '{installer}' scm: - git-scm: credentials-id: '{ssh-credentials}' refspec: '' branch: '{branch}' triggers: - timed: '@midnight' logrotate: daysToKeep: 30 numToKeep: 10 artifactDaysToKeep: -1 artifactNumToKeep: -1 builders: - trigger-builds: - project: 'compass-build-iso' git-revision: true block: true - trigger-builds: - project: 'compass-deploy-virtual-cluster' git-revision: true block: true # - trigger-builds: # - project: 'compass-deploy-virtual-cluster-odl' # git-revision: true # block: true - trigger-builds: - project: 'compass-deploy-virtual-cluster-onos' git-revision: true block: true - job-template: name: 'compass-build-iso' node: ericsson-build concurrent: true properties: - throttle: enabled: true max-total: 1 max-per-node: 1 logrotate: daysToKeep: 30 numToKeep: 10 artifactDaysToKeep: -1 artifactNumToKeep: -1 parameters: - project-parameter: project: '{project}' - compass-parameter: installer: '{installer}' scm: - git-scm: credentials-id: '{ssh-credentials}' refspec: '' branch: 'master' builders: - 'builder-compass-build-iso' - 'builder-compass-upload-artifact' - 'builder-compass-workspace-cleanup' - job-template: name: 'compass-build-ppa' description: "build ppa(using docker) in huawei lab" node: huawei-build concurrent: true properties: - throttle: enabled: true max-total: 1 max-per-node: 1 logrotate: daysToKeep: 30 numToKeep: 10 artifactDaysToKeep: -1 artifactNumToKeep: -1 parameters: - project-parameter: project: '{project}' - compass-parameter: installer: '{installer}' scm: - git-scm: credentials-id: '{ssh-credentials}' refspec: '' branch: 'master' triggers: - timed: 'H 16 * * *' builders: - 'builder-compass-make-ppa' - job-template: name: 'compass-deploy-virtual-{flavor}' disabled: false node: '{node}' concurrent: true properties: - throttle: enabled: true max-total: 1 max-per-node: 1 parameters: - project-parameter: project: '{project}' - compass-parameter: installer: '{installer}' - string: name: FLAVOR_CONF default: '{conf}' description: "" logrotate: daysToKeep: 30 numToKeep: 10 artifactDaysToKeep: -1 artifactNumToKeep: -1 builders: - 'builder-compass-ci-preclean-workspace' - 'builder-compass-download-artifact' - 'builder-compass-deploy-virtual-flavor' publishers: - archive: artifacts: 'ansible.log' allow-empty: 'true' fingerprint: true - job-template: name: 'compass-deploy-bare-huawei-us' disabled: false node: 'huawei-us-deploy-bare-1' concurrent: true properties: - throttle: enabled: true max-total: 1 max-per-node: 1 parameters: - project-parameter: project: '{project}' - compass-parameter: installer: '{installer}' logrotate: daysToKeep: 30 numToKeep: 10 artifactDaysToKeep: -1 artifactNumToKeep: -1 builders: - 'builder-compass-ci-preclean-workspace' - 'builder-compass-download-artifact' - 'builder-compass-deploy-bare' publishers: - archive: artifacts: 'ansible.log' allow-empty: 'true' fingerprint: true ######################## # parameter macros ######################## - parameter: name: compass-parameter parameters: - string: name: INSTALLER default: '{installer}' description: "Installer to use." - 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/$PROJECT description: "Directory where the cache to be used during the build is located." - string: name: GIT_BASE default: https://gerrit.opnfv.org/gerrit/$PROJECT description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW." - string: name: GS_URL default: artifacts.opnfv.org/$PROJECT/ description: "URL to Google Storage." - string: name: GS_URL_PROXY default: build.opnfv.org/artifacts/$PROJECT/ description: "URL to Google Storage proxy" - string: name: installer_ip default: "192.168.200.2" - string: name: PPA_REPO default: "http://205.177.226.235:9999" - string: name: PPA_CACHE default: "$WORKSPACE/work/repo/" ######################## # builder macros ######################## - builder: name: 'builder-compass-merge' builders: - shell: | #!/bin/bash echo "Hello World!" - builder: name: 'builder-compass-make-ppa' builders: - shell: | #!/bin/bash set -x set -o errexit set -o nounset set -o pipefail # make ppa cd $WORKSPACE/ ./build/make_repo.sh # calc MD5 of ppa cd $PPA_CACHE for i in $(find *.gz *.iso *.img -type f) do md5=$(md5sum $i | cut -d ' ' -f1) echo $md5 > $i.md5 curl -T $i $PPA_REPO curl -T $i.md5 $PPA_REPO done - builder: name: 'builder-compass-build-iso' builders: - shell: | #!/bin/bash set -o errexit set -o nounset set -o pipefail # log info to console echo "Starting the build of $INSTALLER. This could take some time..." echo "--------------------------------------------------------" echo # create the cache directory if it doesn't exist [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY # set OPNFV_ARTIFACT_VERSION export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S") # start the build if [ -d $PPA_CACHE ] then cp $PPA_CACHE/*.tar.gz $PPA_CACHE/*.iso $PPA_CACHE/*.img $CACHE_DIRECTORY/ -f fi cd $WORKSPACE/ ./build.sh --iso-dir $BUILD_DIRECTORY/ --iso-name compass.iso -c $CACHE_DIRECTORY # list the build artifacts ls -al $BUILD_DIRECTORY # save information regarding artifact into file ( echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION" echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)" echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)" echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso" echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/compass.iso | cut -d' ' -f1)" echo "OPNFV_BUILD_URL=$BUILD_URL" ) > $BUILD_DIRECTORY/opnfv.properties echo echo "--------------------------------------------------------" echo "Done!" - builder: name: 'builder-compass-deploy-virtual-flavor' builders: - shell: | #!/bin/bash set -x # log info to console echo "Starting the deployment on virtual environment using $INSTALLER. This could take some time..." echo "--------------------------------------------------------" echo export ISO_URL=file://$BUILD_DIRECTORY/compass.iso cd $WORKSPACE ./deploy.sh $FLAVOR_CONF if [ $? -ne 0 ]; then echo "depolyment failed!" deploy_ret=1 fi echo echo "--------------------------------------------------------" echo "Done!" ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" sshpass -p root scp 2>/dev/null $ssh_options root@${installer_ip}:/var/ansible/run/openstack_juno-opnfv2/ansible.log ./ &> /dev/null exit $deploy_ret - builder: name: 'builder-compass-deploy-bare' builders: - shell: | #!/bin/bash set -x # log info to console echo "Starting the deployment on baremetal environment using $INSTALLER. This could take some time..." echo "--------------------------------------------------------" echo export CONFDIR=$WORKSPACE/deploy/conf/hardware_environment/huawei_us_lab/pod1 export ISO_URL=file://$BUILD_DIRECTORY/compass.iso export EXTERNAL_NIC=eth0 export INSTALL_NIC=eth1 cd $WORKSPACE ./deploy.sh --dha $CONFDIR/dha.yml --network $CONFDIR/network.yml if [ $? -ne 0 ]; then echo "depolyment failed!" deploy_ret=1 fi echo echo "--------------------------------------------------------" echo "Done!" ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" sshpass -p root scp 2>/dev/null $ssh_options root@${installer_ip}:/var/ansible/run/openstack_juno-opnfv2/ansible.log ./ &> /dev/null exit $deploy_ret - builder: name: 'builder-compass-upload-artifact' builders: - shell: | #!/bin/bash set -o errexit set -o nounset set -o pipefail # log info to console echo "Uploading the $INSTALLER artifact. This could take some time..." echo "--------------------------------------------------------" echo # source the opnfv.properties to get ARTIFACT_VERSION source $BUILD_DIRECTORY/opnfv.properties # upload artifact and additional files to google storage gsutil cp $BUILD_DIRECTORY/compass.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1 gsutil cp $BUILD_DIRECTORY/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1 gsutil cp $BUILD_DIRECTORY/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1 echo echo "--------------------------------------------------------" echo "Done!" echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso" - builder: name: 'builder-compass-download-artifact' builders: - shell: | #!/bin/bash set -o errexit set -o nounset set -o pipefail # log info to console echo "Downloading the $INSTALLER artifact. This could take some time..." echo "--------------------------------------------------------" echo # get the latest.properties file in order to get info regarding latest artifact [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY curl -s -o $BUILD_DIRECTORY/latest.properties http://$GS_URL/latest.properties # check if we got the file [[ -f $BUILD_DIRECTORY/latest.properties ]] || exit 1 # source the file so we get OPNFV vars source $BUILD_DIRECTORY/latest.properties # download the file curl -s -o $BUILD_DIRECTORY/compass.iso http://$OPNFV_ARTIFACT_URL > gsutil.iso.log 2>&1 # list the file ls -al $BUILD_DIRECTORY/compass.iso echo echo "--------------------------------------------------------" echo "Done!" - builder: name: 'builder-compass-workspace-cleanup' builders: - shell: | #!/bin/bash set -o errexit set -o nounset set -o pipefail # delete everything that is in $WORKSPACE /bin/rm -rf $WORKSPACE - builder: name: 'builder-compass-ci-preclean-workspace' builders: - shell: | #!/bin/bash set -o errexit set -o nounset set -o pipefail cd $WORKSPACE/.. sudo rm $WORKSPACE -rf git clone $GIT_BASE $WORKSPACE