diff options
Diffstat (limited to 'jjb/global/releng-macros.yml')
-rw-r--r-- | jjb/global/releng-macros.yml | 101 |
1 files changed, 70 insertions, 31 deletions
diff --git a/jjb/global/releng-macros.yml b/jjb/global/releng-macros.yml index 3afd355e6..10835f6a3 100644 --- a/jjb/global/releng-macros.yml +++ b/jjb/global/releng-macros.yml @@ -1,4 +1,15 @@ -# OLD Releng macros +# 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 @@ -27,38 +38,27 @@ - scm: name: git-scm scm: - - git: - credentials-id: '{credentials-id}' + - git: &git-scm-defaults + credentials-id: '$SSH_CREDENTIAL_ID' url: '$GIT_BASE' - refspec: '' branches: - - 'origin/{branch}' - skip-tag: true - wipe-workspace: true + - 'origin/$GERRIT_BRANCH' + timeout: 15 - scm: - name: gerrit-trigger-scm + name: git-scm-gerrit scm: - git: - credentials-id: '{credentials-id}' - url: '$GIT_BASE' - refspec: '{refspec}' - branches: - - 'origin/$GERRIT_BRANCH' - skip-tag: true - choosing-strategy: '{choosing-strategy}' - timeout: 15 + choosing-strategy: 'gerrit' + refspec: '$GERRIT_REFSPEC' + <<: *git-scm-defaults - trigger: name: 'daily-trigger-disabled' triggers: - timed: '' -- trigger: - name: 'weekly-trigger-disabled' - triggers: - - timed: '' - +# NOTE: unused macro, but we may use this for some jobs. - trigger: name: gerrit-trigger-patch-submitted triggers: @@ -79,6 +79,7 @@ - branch-compare-type: 'ANT' branch-pattern: '**/{branch}' +# NOTE: unused macro, but we may use this for some jobs. - trigger: name: gerrit-trigger-patch-merged triggers: @@ -95,16 +96,12 @@ - branch-compare-type: 'ANT' branch-pattern: '**/{branch}' -- publisher: - name: archive-artifacts - publishers: - - archive: - artifacts: '{artifacts}' - allow-empty: true - fingerprint: true - latest-only: true - -# New Releng macros +- wrapper: + name: ssh-agent-wrapper + wrappers: + - ssh-agent-credentials: + users: + - 'd42411ac011ad6f3dd2e1fa34eaa5d87f910eb2e' - builder: name: build-html-and-pdf-docs-output @@ -355,3 +352,45 @@ 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 + pip install "yamllint==1.6.0" + + # generate and upload lint log + echo "Running yaml code on $PROJECT ..." + + # Ensure we start with a clean environment + rm -f yaml-violation.log lint.log + + # Get number of yaml violations. If none, this will be an + # empty string: "" + find . \ + -type f -name "*.yml" -print \ + -o -name "*.yaml" -print | \ + xargs yamllint > yaml-violation.log || true + + if [ -s "yaml-violation.log" ]; then + SHOWN=$(cat yaml-violation.log| grep -v "^$" |wc -l) + echo -e "First $SHOWN shown\n---" > lint.log + cat yaml-violation.log >> lint.log + sed -r -i '4,$s/^/ /g' lint.log + fi + +- publisher: + name: archive-artifacts + publishers: + - archive: + artifacts: '{artifacts}' + allow-empty: true + fingerprint: true + latest-only: true |