--- # Releng macros # # NOTE: make sure macros are listed in execution ordered. # # 1. parameters/properties # 2. scm # 3. triggers # 4. wrappers # 5. prebuilders (maven only, configured like Builders) # 6. builders (maven, freestyle, matrix, etc..) # 7. postbuilders (maven only, configured like Builders) # 8. publishers/reporters/notifications - parameter: name: project-parameter parameters: - string: name: PROJECT default: '{project}' description: "JJB configured PROJECT parameter to identify an opnfv Gerrit project" - string: name: GS_BASE default: artifacts.opnfv.org/$PROJECT description: "URL to Google Storage." - string: name: GS_BASE_PROXY default: build.opnfv.org/artifacts.opnfv.org/$PROJECT description: "URL to Google Storage proxy" - string: name: BRANCH default: '{branch}' description: "JJB configured BRANCH parameter (e.g. master, stable/danube)" - string: name: GERRIT_BRANCH default: '{branch}' description: "JJB configured GERRIT_BRANCH parameter (deprecated)" - property: name: logrotate-default properties: - build-discarder: days-to-keep: 60 num-to-keep: 200 artifact-days-to-keep: 60 artifact-num-to-keep: 200 - scm: name: git-scm scm: - git: &git-scm-defaults credentials-id: '$SSH_CREDENTIAL_ID' url: '$GIT_BASE' branches: - 'origin/$BRANCH' timeout: 15 - scm: name: git-scm-gerrit scm: - git: choosing-strategy: 'gerrit' refspec: '$GERRIT_REFSPEC' <<: *git-scm-defaults - scm: name: git-scm-with-submodules scm: - git: credentials-id: '$SSH_CREDENTIAL_ID' url: '$GIT_BASE' refspec: '' branches: - 'refs/heads/{branch}' skip-tag: true wipe-workspace: true submodule: recursive: true timeout: 20 - trigger: name: 'daily-trigger-disabled' triggers: - timed: '' - trigger: name: 'weekly-trigger-disabled' triggers: - timed: '' - trigger: name: gerrit-trigger-patchset-created 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}' file-paths: - compare-type: 'ANT' pattern: '{files}' skip-vote: successful: false failed: false unstable: false notbuilt: false - trigger: name: gerrit-trigger-change-merged 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: '{project}' branches: - branch-compare-type: 'ANT' branch-pattern: '**/{branch}' file-paths: - compare-type: 'ANT' pattern: '{files}' - trigger: name: gerrit-trigger-tag-created triggers: - gerrit: server-name: 'gerrit.opnfv.org' trigger-on: - ref-updated-event projects: - project-compare-type: 'ANT' project-pattern: '{project}' branches: - branch-compare-type: 'ANT' branch-pattern: 'refs/tags/**' - trigger: name: 'experimental' triggers: - gerrit: server-name: 'gerrit.opnfv.org' trigger-on: - comment-added-contains-event: comment-contains-value: 'check-experimental' projects: - project-compare-type: 'ANT' project-pattern: '{project}' branches: - branch-compare-type: 'ANT' branch-pattern: '**/{branch}' file-paths: - compare-type: 'ANT' pattern: '{files}' skip-vote: successful: true failed: true unstable: true notbuilt: true - wrapper: name: ssh-agent-wrapper wrappers: - ssh-agent-credentials: users: - 'd42411ac011ad6f3dd2e1fa34eaa5d87f910eb2e' - wrapper: name: build-timeout wrappers: - timeout: timeout: '{timeout}' timeout-var: 'BUILD_TIMEOUT' fail: true - wrapper: name: fix-workspace-permissions wrappers: - pre-scm-buildstep: - shell: | #!/bin/bash sudo chown -R $USER:$USER $WORKSPACE || exit 1 - builder: name: upload-under-review-docs-to-opnfv-artifacts builders: - shell: | #!/bin/bash set -o errexit set -o pipefail set -o xtrace export PATH=$PATH:/usr/local/bin/ [[ $GERRIT_CHANGE_NUMBER =~ .+ ]] [[ -d docs/_build/ ]] || exit 0 echo echo "###########################" echo "UPLOADING DOCS UNDER REVIEW" echo "###########################" echo gs_base="artifacts.opnfv.org/$PROJECT/review" gs_path="$gs_base/$GERRIT_CHANGE_NUMBER" local_path="upload/$GERRIT_CHANGE_NUMBER" mkdir -p upload mv docs/_build/html/ "$local_path" gsutil -m cp -r "$local_path" "gs://$gs_base" gsutil -m setmeta \ -h "Content-Type:text/html" \ -h "Cache-Control:private, max-age=0, no-transform" \ "gs://$gs_path"/**.html > /dev/null 2>&1 echo "Document link(s):" >> gerrit_comment.txt find "$local_path" | grep -e 'index.html$' -e 'pdf$' | \ sed -e "s|^$local_path| http://$gs_path|" >> gerrit_comment.txt # To take advantage of this macro, have your build write # out the file 'gerrit_comment.txt' with information to post # back to gerrit and include this macro in the list of builders. - builder: name: report-build-result-to-gerrit builders: - shell: | #!/bin/bash set -o errexit set -o pipefail set -o xtrace export PATH=$PATH:/usr/local/bin/ if [[ -e gerrit_comment.txt ]] ; then echo echo "posting review comment to gerrit..." echo cat gerrit_comment.txt echo ssh -p 29418 gerrit.opnfv.org \ "gerrit review -p $GERRIT_PROJECT \ -m '$(cat gerrit_comment.txt)' \ $GERRIT_PATCHSET_REVISION \ --notify NONE" fi - builder: name: remove-old-docs-from-opnfv-artifacts builders: - shell: | #!/bin/bash set -o errexit set -o pipefail set -o xtrace export PATH=$PATH:/usr/local/bin/ [[ $GERRIT_CHANGE_NUMBER =~ .+ ]] gs_path="artifacts.opnfv.org/$PROJECT/review/$GERRIT_CHANGE_NUMBER" if gsutil ls "gs://$gs_path" > /dev/null 2>&1 ; then echo echo "Deleting Out-of-dated Documents..." gsutil -m rm -r "gs://$gs_path" fi gs_path="artifacts.opnfv.org/review/$GERRIT_CHANGE_NUMBER" if gsutil ls "gs://$gs_path" > /dev/null 2>&1 ; then echo echo "Deleting Out-of-dated Documents..." gsutil -m rm -r "gs://$gs_path" fi - builder: name: lint-python-code builders: - shell: | #!/bin/bash set -o errexit set -o pipefail set -o xtrace export PATH=$PATH:/usr/local/bin/ virtualenv -p python2.7 $WORKSPACE/releng_flake8 source $WORKSPACE/releng_flake8/bin/activate # install python packages pip install "flake8==2.6.2" # generate and upload lint log echo "Running flake8 code on $PROJECT ..." # Get number of flake8 violations. If none, this will be an # empty string: "" FLAKE_COUNT="$(find . \ -path './releng_flake8' -prune -o \ -path './.tox' -prune -o \ -type f -name "*.py" -print | \ xargs flake8 --exit-zero -qq --count 2>&1)" # Ensure we start with a clean environment rm -f lint.log if [ ! -z $FLAKE_COUNT ]; then echo "Flake8 Violations: $FLAKE_COUNT" > lint.log find . \ -path './releng_flake8' -prune -o \ -path './.tox' -prune -o \ -type f -name "*.py" -print | \ xargs flake8 --exit-zero --first >> violation.log SHOWN=$(wc -l violation.log | cut -d' ' -f1) echo -e "First $SHOWN shown\n---" >> lint.log cat violation.log >> lint.log sed -r -i '4,$s/^/ /g' lint.log rm violation.log fi deactivate - builder: name: report-lint-result-to-gerrit builders: - shell: | #!/bin/bash set -o errexit set -o pipefail set -o xtrace export PATH=$PATH:/usr/local/bin/ # If no violations were found, no lint log will exist. if [[ -e lint.log ]] ; then echo -e "\nposting linting report to gerrit...\n" cat lint.log echo ssh -p 29418 gerrit.opnfv.org \ "gerrit review -p $GERRIT_PROJECT \ -m \"$(cat lint.log)\" \ $GERRIT_PATCHSET_REVISION \ --notify NONE" exit 1 fi - builder: name: upload-review-docs builders: - upload-under-review-docs-to-opnfv-artifacts - report-build-result-to-gerrit - builder: name: check-bash-syntax builders: - shell: "find . -name '*.sh' | xargs bash -n" - builder: name: lint-yaml-code builders: - shell: | #!/bin/bash set -o errexit set -o pipefail set -o xtrace export PATH=$PATH:/usr/local/bin/ # install python packages sudo pip install "yamllint==1.8.2" # generate and upload lint log echo "Running yaml code on $PROJECT ..." # Get list of yaml files YAML_FILES=$(git --no-pager diff --diff-filter=MCRAT --name-only HEAD^1 | egrep "ya?ml$") || true #If YAML_FILES is none exit with 0 if [ -z "$YAML_FILES" ]; then exit 0 fi # Ensure we start with a clean environment rm -f yaml-violation.log lint.log # Yamllint files only in patchset for yamlfile in $YAML_FILES; do yamllint $yamlfile >> yaml-violation.log || true done if [ -s "yaml-violation.log" ]; then SHOWN=$(grep -c -v "^$" yaml-violation.log) echo -e "First $SHOWN shown\n---" > lint.log cat yaml-violation.log >> lint.log sed -r -i '4,$s/^/ /g' lint.log fi - builder: name: clean-workspace builders: - shell: | #!/bin/bash set -o errexit set -o nounset set -o pipefail sudo /bin/rm -rf "$WORKSPACE" - builder: name: clean-workspace-log builders: - shell: | find $WORKSPACE -type f -name '*.log' | xargs rm -f - publisher: name: archive-artifacts publishers: - archive: artifacts: '{artifacts}' allow-empty: true fingerprint: true latest-only: true - publisher: name: publish-coverage publishers: - cobertura: report-file: "coverage.xml" only-stable: "true" health-auto-update: "false" stability-auto-update: "false" zoom-coverage-chart: "true" targets: - files: healthy: 10 unhealthy: 20 failing: 30 - method: healthy: 50 unhealthy: 40 failing: 30 # The majority of the email-ext plugin options are set to the default # for this macro so they can be managed through Jenkins' global # settings. - publisher: name: email-jenkins-admins-on-failure publishers: - email-ext: content-type: text attach-build-log: true compress-log: true always: false failure: true send-to: - recipients # Email PTL publishers - email_ptl_defaults: &email_ptl_defaults name: 'email_ptl_defaults' content-type: text attach-build-log: true attachments: '*.log' compress-log: true always: true subject: '{subject}' - publisher: &email_apex_ptl_defaults name: 'email-apex-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > trozet@redhat.com - publisher: name: 'email-apex-os-net-config-ptl' <<: *email_apex_ptl_defaults - publisher: name: 'email-apex-puppet-tripleo-ptl' <<: *email_apex_ptl_defaults - publisher: name: 'email-apex-tripleo-heat-templates-ptl' <<: *email_apex_ptl_defaults - publisher: name: 'email-armband-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > bob.monkman@arm.com - publisher: name: 'email-auto-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > tina.tsou@arm.com - publisher: name: 'email-availability-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > fuqiao@chinamobile.com - publisher: name: 'email-bamboo-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > donaldh@cisco.com - publisher: name: 'email-barometer-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > aasmith@redhat.com - publisher: name: 'email-bottlenecks-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > gabriel.yuyang@huawei.com - publisher: name: 'email-calipso-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > korlev@cisco.com - publisher: name: 'email-clover-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > stephen.wong1@huawei.com - publisher: &email_compass4nfv_ptl_defaults name: 'email-compass4nfv-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > chigang@huawei.com - publisher: name: 'email-compass-containers-ptl' <<: *email_compass4nfv_ptl_defaults - publisher: name: 'email-conductor-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > limingjiang@huawei.com - publisher: name: 'email-container4nfv-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > jiaxuan@chinamobile.com - publisher: name: 'email-copper-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > aimeeu.opensource@gmail.com - publisher: name: 'email-cperf-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > matt.welch@intel.com - publisher: name: 'email-daisy-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > hu.zhijiang@zte.com.cn - publisher: name: 'email-doctor-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > r-mibu@cq.jp.nec.com - publisher: name: 'email-domino-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > ulas.kozat@huawei.com - publisher: name: 'email-dovetail-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > hongbo.tianhongbo@huawei.com - publisher: name: 'email-dpacc-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > denglingli@chinamobile.com - publisher: name: 'email-enfv-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > JBuchanan@advaoptical.com - publisher: name: 'email-escalator-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > kong.wei2@zte.com.cn - publisher: name: 'email-fastpathmetrics-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > maryam.tahhan@intel.com - publisher: name: 'email-fds-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > fbrockne@cisco.com - publisher: name: 'email-fuel-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > gelkinbard@mirantis.com - publisher: name: 'email-functest-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > cedric.ollivier@orange.com - publisher: name: 'email-ipv6-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > bh526r@att.com - publisher: name: 'email-joid-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > artur.tyloch@canonical.com - publisher: name: 'email-kvmfornfv-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > raghuveer.reddy@intel.com - publisher: name: 'email-models-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > bs3131@att.com - publisher: name: 'email-moon-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > ruan.he@orange.com - publisher: name: 'email-multisite-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > joehuang@huawei.com - publisher: name: 'email-netready-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > georg.kunz@ericsson.com - publisher: name: 'email-nfvbench-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > ahothan@cisco.com - publisher: name: 'email-octopus-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > ulrich.kleber@huawei.com - publisher: name: 'email-onosfw-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > su.wei@huawei.com - publisher: name: 'email-openretriever-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > jiaxuan@chinamobile.com - publisher: name: 'email-opera-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > Yingjun.li@huawei.com - publisher: name: 'email-opnfvdocs-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > sofia.wallin@ericsson.com - publisher: name: 'email-orchestra-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > giuseppe.carella@fokus.fraunhofer.de - publisher: name: 'email-ovn4nfv-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > trinath.somanchi@gmail.com - publisher: name: 'email-ovno-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > wsmackie@juniper.net - publisher: name: 'email-ovsnfv-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > MarkD.Graymark.d.gray@intel.com - publisher: name: 'email-parser-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > shang.xiaodong@zte.com.cn - publisher: &email_pharos_ptl_defaults name: 'email-pharos-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > jack.morgan@intel.com - publisher: name: 'email-pharos-tools-ptl' <<: *email_pharos_ptl_defaults - publisher: name: 'email-promise-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > kunzmann@docomolab-euro.com - publisher: name: 'email-qtip-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > wu.zhihui1@zte.com.cn - publisher: &email_releng_ptl_defaults name: 'email-releng-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > fatih.degirmenci@ericsson.com - publisher: name: 'email-releng-anteater-ptl' <<: *email_releng_ptl_defaults - publisher: name: 'email-releng-testresults-ptl' <<: *email_releng_ptl_defaults - publisher: name: 'email-releng-utils-ptl' <<: *email_releng_ptl_defaults - publisher: name: 'email-releng-xci-ptl' <<: *email_releng_ptl_defaults - publisher: name: 'email-samplevnf-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > deepak.s@intel.com - publisher: name: 'email-sdnvpn-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > tim.irnich@ericsson.com - publisher: name: 'email-securityscanning-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > lhinds@redhat.com - publisher: name: 'email-sfc-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > ManuelBuilmbuil@suse.com - publisher: name: 'email-snaps-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > s.pisarski@cablelabs.com - publisher: name: 'email-stor4nfv-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > shane.wang@intel.com - publisher: name: 'email-storperf-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > mark.beierl@emc.com - publisher: name: 'email-ves-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > bryan.sullivan@att.com - publisher: name: 'email-vswitchperf-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > sridhar.rao@spirent.com - publisher: name: 'email-yardstick-ptl' publishers: - email-ext: <<: *email_ptl_defaults recipients: > ross.b.brattain@intel.com