with open('scenarios.yaml.hidden') as _:
scenarios = yaml.safe_load(_)
- template = env.get_template('apex.yml.j2')
+ template = env.get_template('apex.yaml.j2')
print("Scenarios are: ")
pprint.pprint(scenarios)
output = template.render(scenarios=scenarios, gspathname=gspathname,
branch=branch, build_slave=build_slave)
- with open('./apex.yml', 'w') as fh:
+ with open('./apex.yaml', 'w') as fh:
fh.write(output)
if __name__ == "__main__":
- draft-published-event
- comment-added-contains-event:
comment-contains-value: 'recheck'
- - comment-added-contains-event:
- comment-contains-value: 'reverify'
projects:
- project-compare-type: 'REG_EXP'
project-pattern: 'apex|armband|bamboo|barometer|bottlenecks|calipso|compass4nfv|conductor|copper|cperf|daisy|doctor|dovetail|dpacc|enfv|fds|fuel|functest|pharos|releng|sandbox|yardstick|infra|ipv6|kvmfornfv|models|moon|netready'
-Subproject commit 779110b5cd63f3eabb63598a1be79d9b9ba85464
+Subproject commit 1493b95e0d80860a9d8aef83e22ee49d5988ad96
- 'origin/$BRANCH'
timeout: 15
per-build-tag: false
+ skip-tag: true
shallow-clone: false
use-author: false
ignore-notify: false
choosing-strategy: 'gerrit'
refspec: '$GERRIT_REFSPEC'
<<: *git-scm-defaults
+
+- scm:
+ name: git-scm-gerrit-with-submodules
+ scm:
+ - git:
+ choosing-strategy: 'gerrit'
+ refspec: '$GERRIT_REFSPEC'
+ submodule:
+ recursive: true
+ timeout: 20
+ <<: *git-scm-defaults
- scm:
name: git-scm-with-submodules
scm:
refspec: ''
branches:
- 'refs/heads/{branch}'
+ per-build-tag: false
skip-tag: true
wipe-workspace: true
submodule:
name: git-scm-openstack
scm:
- git: &git-scm-openstack-defaults
+ per-build-tag: false
+ skip-tag: true
url: '$GIT_BASE'
branches:
- 'origin/$BRANCH'
name: 'report-provision-result'
publishers:
- postbuildscript:
- script-only-if-succeeded: true
builders:
- - shell: |
- echo "export PROVISION_RESULT=PASS" >> $WORKSPACE/installer_track.sh
- echo "export INSTALLER=$INSTALLER_TYPE" >> $WORKSPACE/installer_track.sh
- echo "export TIMESTAMP_END="\'`date '+%Y-%m-%d %H:%M:%S.%3N'`\' >> $WORKSPACE/installer_track.sh
- - shell:
- !include-raw: installer-report.sh
+ - role: BOTH
+ build-on:
+ - SUCCESS
+ build-steps:
+ - shell: |
+ echo "export PROVISION_RESULT=PASS" >> $WORKSPACE/installer_track.sh
+ echo "export INSTALLER=$INSTALLER_TYPE" >> $WORKSPACE/installer_track.sh
+ echo "export TIMESTAMP_END="\'`date '+%Y-%m-%d %H:%M:%S.%3N'`\' >> $WORKSPACE/installer_track.sh
+ - shell:
+ !include-raw: installer-report.sh
+ mark-unstable-if-failed: true
- postbuildscript:
- script-only-if-succeeded: false
- script-only-if-failed: true
builders:
- - shell: |
- echo "export PROVISION_RESULT=FAIL" >> $WORKSPACE/installer_track.sh
- echo "export INSTALLER=$INSTALLER_TYPE" >> $WORKSPACE/installer_track.sh
- echo "export TIMESTAMP_END="\'`date '+%Y-%m-%d %H:%M:%S.%3N'`\' >> $WORKSPACE/installer_track.sh
- - shell:
- !include-raw: installer-report.sh
+ - role: BOTH
+ build-on:
+ - ABORTED
+ - FAILURE
+ - NOT_BUILT
+ - UNSTABLE
+ build-steps:
+ - shell: |
+ echo "export PROVISION_RESULT=FAIL" >> $WORKSPACE/installer_track.sh
+ echo "export INSTALLER=$INSTALLER_TYPE" >> $WORKSPACE/installer_track.sh
+ echo "export TIMESTAMP_END="\'`date '+%Y-%m-%d %H:%M:%S.%3N'`\' >> $WORKSPACE/installer_track.sh
+ - shell:
+ !include-raw: installer-report.sh
+ mark-unstable-if-failed: true
--- /dev/null
+---
+- project:
+ name: openci-odl
+
+ project: '{name}'
+
+ stream:
+ - master:
+ branch: '{stream}'
+ gs-pathname: ''
+ disabled: false
+
+ jobs:
+ - 'openci-odl-autorelease-daily-{stream}'
+ - 'openci-odl-promote-daily-{stream}'
+
+# This job gets triggered manually for the demo purposes.
+#
+# In prototype, either what this job does needs to be integrated to
+# ODL autorelease job or triggered by the upstream autorelease job.
+- job-template:
+ name: 'openci-odl-autorelease-daily-{stream}'
+
+ disabled: '{obj:disabled}'
+
+ concurrent: false
+
+ parameters:
+ - 'opnfv-build-defaults'
+
+ builders:
+ - shell: |
+ #!/bin/bash
+
+ echo "Will construct and publish an ArtifactPublishedEvent"
+
+# This job gets triggered by a ConfidenceLevelModifiedEvent published
+# by OPNFV jobs so ODL can promote the autorelease artifact even further.
+#
+# This job is created for the demo purposes and might not be there for
+# the prototype.
+- job-template:
+ name: 'openci-odl-promote-daily-{stream}'
+
+ disabled: '{obj:disabled}'
+
+ concurrent: false
+
+ parameters:
+ - 'opnfv-build-defaults'
+
+ triggers:
+ - jms-messaging:
+ provider-name: openci.activemq
+ selector: CI_TYPE = 'custom'
+ checks:
+ - field: origin
+ expected-value: 'OPNFV'
+ - field: type
+ expected-value: 'ConfidenceLevelModifiedEvent'
+
+ builders:
+ - shell: |
+ #!/bin/bash
+
+ echo
+ echo "Triggered by an event"
+ echo "----------------------------------"
+ echo $CI_MESSAGE
+ echo "----------------------------------"
+ echo " Promoted ODL Autorelease artifact as release candidate!"
--- /dev/null
+---
+- project:
+ name: openci-onap
+
+ project: '{name}'
+
+ stream:
+ - master:
+ branch: '{stream}'
+ gs-pathname: ''
+ disabled: false
+
+ jobs:
+ - 'openci-onap-autorelease-daily-{stream}'
+ - 'openci-onap-promote-daily-{stream}'
+
+# This job gets triggered manually for the demo purposes.
+#
+# In prototype, either what this job does needs to be integrated to
+# ONAP autorelease job or triggered by the upstream autorelease job.
+- job-template:
+ name: 'openci-onap-autorelease-daily-{stream}'
+
+ disabled: '{obj:disabled}'
+
+ concurrent: false
+
+ parameters:
+ - 'opnfv-build-defaults'
+
+ builders:
+ - shell: |
+ #!/bin/bash
+
+ echo "Will construct and publish an ArtifactPublishedEvent"
+
+# This job gets triggered by a ConfidenceLevelModifiedEvent published
+# by OPNFV jobs so ONAP can promote the autorelease artifact even further.
+#
+# This job is created for the demo purposes and might not be there for
+# the prototype.
+- job-template:
+ name: 'openci-onap-promote-daily-{stream}'
+
+ disabled: '{obj:disabled}'
+
+ concurrent: false
+
+ parameters:
+ - 'opnfv-build-defaults'
+
+ triggers:
+ - jms-messaging:
+ provider-name: openci.activemq
+ selector: CI_TYPE = 'custom'
+ checks:
+ - field: origin
+ expected-value: 'OPNFV'
+ - field: type
+ expected-value: 'ConfidenceLevelModifiedEvent'
+
+ builders:
+ - shell: |
+ #!/bin/bash
+
+ echo
+ echo "Triggered by an event"
+ echo "----------------------------------"
+ echo $CI_MESSAGE
+ echo "----------------------------------"
+ echo " Promoted ONAP Autorelease artifact as release candidate!"
- draft-published-event
- comment-added-contains-event:
comment-contains-value: 'recheck'
- - comment-added-contains-event:
- comment-contains-value: 'reverify'
projects:
- project-compare-type: 'REG_EXP'
project-pattern: 'releng|doctor|pharos'
--- /dev/null
+---
+- project:
+ name: releng-builder-jobs
+ project: 'releng'
+ project-name: 'releng'
+
+ build-timeout: 60
+ build-node: 'lf-build1'
+ gerrit-server-name: 'gerrit.opnfv.org'
+ jenkins-ssh-credential: 'd42411ac011ad6f3dd2e1fa34eaa5d87f910eb2e'
+ jjb-version: '2.0.3'
+ lftools-version: '<1.0.0'
+
+ jobs:
+ - '{project-name}-ci-jobs'
+++ /dev/null
----
-- project:
- name: releng-builder-jobs
- jobs:
- - 'releng-verify-jjb'
- - 'releng-merge-jjb'
- - 'releng-comment-jjb'
-
- project: 'releng'
-
-- job-template:
- name: releng-verify-jjb
-
- parameters:
- - project-parameter:
- project: '{project}'
- branch: 'master'
-
- 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: 'releng'
- branches:
- - branch-compare-type: 'ANT'
- branch-pattern: '**/master'
- file-paths:
- - compare-type: ANT
- pattern: jjb/**
- - compare-type: ANT
- pattern: jjb-templates/**
- - compare-type: ANT
- pattern: utils/**
-
-
- builders:
- - shell:
- !include-raw: verify-releng.sh
-
- publishers:
- - archive-artifacts:
- artifacts: 'job_output/*'
- - email-jenkins-admins-on-failure
-
-- job-template:
- name: releng-comment-jjb
-
- parameters:
- - project-parameter:
- project: '{project}'
- branch: 'master'
-
- scm:
- - git-scm-gerrit
-
- triggers:
- - experimental:
- project: '{project}'
- branch: 'master'
- files: 'jjb/**'
-
- builders:
- - shell:
- !include-raw-escape: generate-job-list.sh
- - report-build-result-to-gerrit
-
-- job-template:
- name: 'releng-merge-jjb'
-
- # builder-merge job to run JJB update
- #
- # This job's purpose is to update all the JJB
-
- parameters:
- - project-parameter:
- project: '{project}'
- branch: 'master'
-
- properties:
- - throttle:
- max-per-node: 1
- max-total: 1
- option: 'project'
-
- scm:
- - git-scm
-
- triggers:
- - gerrit:
- server-name: 'gerrit.opnfv.org'
- trigger-on:
- - change-merged-event
- - comment-added-contains-event:
- comment-contains-value: 'remerge'
- projects:
- - project-compare-type: 'ANT'
- project-pattern: 'releng'
- branches:
- - branch-compare-type: 'ANT'
- branch-pattern: '**/master'
- file-paths:
- - compare-type: ANT
- pattern: jjb/**
- - compare-type: ANT
- pattern: utils/**
-
- builders:
- - shell: |
- source /opt/virtualenv/jenkins-job-builder/bin/activate
- jenkins-jobs update -r --delete-old jjb/
+++ /dev/null
-#!/bin/bash
-# SPDX-license-identifier: Apache-2.0
-##############################################################################
-# Copyright (c) 2016 Linux Foundation 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
-##############################################################################
-#test for non-ascii characters, these can pass the test and end up breaking things in production
-for x in $(find . -name *\.yml -or -name *\.yaml -or -name *\.sh); do
-
- if LC_ALL=C grep -q '[^[:print:][:space:]]' "$x"; then
- echo "file "$x" contains non-ascii characters"
- exit 1
- fi
-
-done
-
-source /opt/virtualenv/jenkins-job-builder/bin/activate
-jenkins-jobs test -o job_output -r jjb/
# yamllint enable rule:line-length
- email-jenkins-admins-on-failure
- postbuildscript:
- script-only-if-succeeded: false
- script-only-if-failed: false
builders:
- - shell:
- !include-raw: ./xci-cleanup.sh
+ - role: BOTH
+ build-on:
+ - ABORTED
+ - FAILURE
+ - NOT_BUILT
+ - SUCCESS
+ - UNSTABLE
+ build-steps:
+ - shell: !include-raw: ./xci-cleanup.sh
+ mark-unstable-if-failed: true
# -------------------------------
# trigger macros
# yamllint enable rule:line-length
- email-jenkins-admins-on-failure
- postbuildscript:
- script-only-if-succeeded: false
- script-only-if-failed: false
builders:
- - shell:
- !include-raw: ./xci-cleanup.sh
+ - role: BOTH
+ build-on:
+ - ABORTED
+ - FAILURE
+ - NOT_BUILT
+ - SUCCESS
+ - UNSTABLE
+ build-steps:
+ - shell: !include-raw: ./xci-cleanup.sh
+ mark-unstable-if-failed: true
- job-template:
name: 'xci-{phase}-{pod}-{distro}-daily-{stream}'
publishers:
- postbuildscript:
- script-only-if-succeeded: false
- script-only-if-failed: false
builders:
- - shell:
- !include-raw: ./xci-cleanup.sh
+ - role: BOTH
+ build-on:
+ - ABORTED
+ - FAILURE
+ - NOT_BUILT
+ - SUCCESS
+ - UNSTABLE
+ build-steps:
+ - shell: !include-raw: ./xci-cleanup.sh
+ mark-unstable-if-failed: true
- job-template:
name: 'xci-merge-{distro}-{phase}-virtual-{stream}'
# skip-verify
# skip-deployment
# force-verify
-function override_generic_scenario() {
+function override_scenario() {
echo "Processing $GERRIT_PROJECT patchset $GERRIT_REFSPEC"
# ensure the metadata we record is consistent for all types of patches including skipped ones
fi
}
-# This function determines the impacted generic scenario by processing the
-# change and using diff to see what changed. If changed files belong to a scenario
-# its name gets recorded for deploying and testing the right scenario.
+# This function determines the default scenario for changes coming to releng-xci
+# by processing the Gerrit change and using diff to see what changed.
+#
+# The stuff in releng-xci is for the installer and other common things so the
+# determination is based on those.
#
-# Pattern to be searched in Changeset
-# releng-xci/scenarios/<scenario>/<impacted files>: <scenario>
-# releng-xci/xci/installer/osa/<impacted files>: os-nosdn-nofeature
-# releng-xci/xci/installer/kubespray/<impacted files>: k8-nosdn-nofeature
-# the rest: os-nosdn-nofeature
-function determine_generic_scenario() {
+# Pattern
+# releng-xci/installer/<installer_type>/<impacted files>: <scenario>
+function determine_default_scenario() {
echo "Processing $GERRIT_PROJECT patchset $GERRIT_REFSPEC"
# get the changeset
cd $WORKSPACE
- SCENARIOS=$(git diff HEAD^..HEAD --name-only -- 'xci/scenarios' | cut -d "/" -f 3 | uniq)
# We need to set default scenario for changes that mess with installers
INSTALLERS=$(git diff HEAD^..HEAD --name-only -- 'xci/installer' | cut -d "/" -f 3 | uniq)
- for CHANGED_SCENARIO in $SCENARIOS; do
- DEPLOY_SCENARIO[${#DEPLOY_SCENARIO[@]}]=$CHANGED_SCENARIO
- done
for CHANGED_INSTALLER in $INSTALLERS; do
case $CHANGED_INSTALLER in
kubespray)
esac
done
# For all other changes, we only need to set a default scenario if it's not set already
- if git diff HEAD^..HEAD --name-only | grep -q -v 'xci/installer\|xci/scenario'; then
+ if git diff HEAD^..HEAD --name-only | grep -q -v 'xci/installer'; then
[[ ${#DEPLOY_SCENARIO[@]} -eq 0 ]] && DEPLOY_SCENARIO[${#DEPLOY_SCENARIO[@]}]='os-nosdn-nofeature'
fi
# extract releng-xci sha
XCI_SHA=$(cd $WORKSPACE && git rev-parse HEAD)
- # extract scenario sha which is same as releng-xci sha for generic scenarios
+ # TODO: we need to fix this so we actually extract the scenario sha by cloning releng-xci-scenarios
+ # for the determined scenario. it is crucial for promotion...
SCENARIO_SHA=$XCI_SHA
}
-# This function determines the impacted external scenario by processing the Gerrit
+# This function determines the impacted scenario by processing the Gerrit
# change and using diff to see what changed. If changed files belong to a scenario
# its name gets recorded for deploying and testing the right scenario.
#
# Pattern
# <project-repo>/scenarios/<scenario>/<impacted files>: <scenario>
-function determine_external_scenario() {
+function determine_scenario() {
echo "Processing $GERRIT_PROJECT patchset $GERRIT_REFSPEC"
# remove the clone that is done via jenkins and place releng-xci there so the
/bin/rm -rf $WORK_DIRECTORY && mkdir -p $WORK_DIRECTORY
if [[ $GERRIT_PROJECT == "releng-xci" ]]; then
- override_generic_scenario
- determine_generic_scenario
-else
- determine_external_scenario
+ determine_default_scenario
fi
+override_scenario
+determine_scenario
# ensure single scenario is impacted
if [[ $(IFS=$'\n' echo ${DEPLOY_SCENARIO[@]} | wc -w) != 1 ]]; then
export BUILD_TAG=$BUILD_TAG
export NODE_NAME=$NODE_NAME
-if [[ ! -z ${WORKSPACE+x} && $GERRIT_PROJECT != "releng-xci" ]]; then
+if [[ $GERRIT_PROJECT != "releng-xci" ]]; then
export XCI_ANSIBLE_PARAMS="-e @/home/devuser/releng-xci/scenario_overrides.yml"
fi
./xci-deploy.sh | ts
EOF
-if [[ ! -z ${WORKSPACE+x} && $GERRIT_PROJECT != "releng-xci" ]]; then
+if [[ $GERRIT_PROJECT != "releng-xci" ]]; then
cat > scenario_overrides.yml <<-EOF
---
xci_scenarios_overrides:
publishers:
- postbuildscript:
- script-only-if-succeeded: false
- script-only-if-failed: false
builders:
- - shell:
- !include-raw: ./xci-cleanup.sh
+ - role: BOTH
+ build-on:
+ - ABORTED
+ - FAILURE
+ - NOT_BUILT
+ - SUCCESS
+ - UNSTABLE
+ build-steps:
+ - shell: !include-raw: ./xci-cleanup.sh
+ mark-unstable-if-failed: true
- job-template:
- python-six
- net-tools
- bc
+ - sysstat
+ - xmlstarlet
+ - facter
- name: install the 'Development tools' package group
yum:
- libnuma-dev
- shellcheck
- python-pip
+ - sysstat
+ - xmlstarlet
+ - facter
- name: Add Docker apt key.
apt_key: