From 92324d11228d89a7b2020158489422619aed05e4 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Fri, 6 Jan 2023 14:13:49 +0100 Subject: Rewrite OPNFV docs' shellcheck MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I2c2e4f02463685a4450bede445fa62c1f408c435 Signed-off-by: Cédric Ollivier --- jjb/opnfvdocs/opnfvdocs.yaml | 139 ++++++++++++++----------------------------- 1 file changed, 44 insertions(+), 95 deletions(-) diff --git a/jjb/opnfvdocs/opnfvdocs.yaml b/jjb/opnfvdocs/opnfvdocs.yaml index a963d7726..3047a740e 100644 --- a/jjb/opnfvdocs/opnfvdocs.yaml +++ b/jjb/opnfvdocs/opnfvdocs.yaml @@ -1,113 +1,62 @@ --- -######################## -# Job configuration for opnfvdocs -######################## -- project: - - name: opnfvdocs - - project: '{name}' - - jobs: - - 'opnfvdocs-verify-shellcheck-{stream}' - - 'opnfvdocs-merge-shellcheck-{stream}' - - stream: - - master: - branch: '{stream}' - gs-pathname: '' - disabled: false - - nile: - branch: 'stable/{stream}' - gs-pathname: '/{stream}' - disabled: false - -######################## -# job templates -######################## - -- job-template: - name: 'opnfvdocs-verify-shellcheck-{stream}' - - disabled: '{obj:disabled}' - - parameters: - - project-parameter: - project: $GERRIT_PROJECT - branch: '{branch}' - - string: - name: GIT_CLONE_BASE - default: ssh://gerrit.opnfv.org:29418 - description: "Used for overriding the GIT URL coming from parameters macro." - - 'opnfv-build-defaults' - +- scm: + name: opnfvdocs-scm scm: - - git-scm-gerrit - + - git: + url: 'https://gerrit.opnfv.org/gerrit/opnfvdocs' + refspec: '+refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/changes/*' + branches: + - '{ref}' + +- builder: + name: opnfvdocs-lint-bash-code + builders: + - shell: | + #!/bin/bash + echo "Checking bash code..." + for f in $(egrep '\.sh$' modified_files) + do + bash -n "$f" 2>> bash-violation.log + done + if [[ -s bash-violation.log ]]; then + echo -e "Bash syntax error(s)\n---" >> violation.log + sed -e 's/^/ /g' bash-violation.log >> violation.log + fi + +- trigger: + name: opnfvdocs-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 + - patchset-created-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: '{project}' + - project-compare-type: 'ANT' + project-pattern: 'opnfvdocs' branches: - branch-compare-type: 'ANT' - branch-pattern: '**/{branch}' - skip-vote: - successful: true - failed: true - unstable: true - notbuilt: true - - builders: - - lint-bash-code + branch-pattern: master + - branch-compare-type: 'ANT' + branch-pattern: stable/nile - job-template: - name: 'opnfvdocs-merge-shellcheck-{stream}' - - disabled: '{obj:disabled}' - + name: opnfvdocs-verify-shellcheck parameters: - - project-parameter: - project: $GERRIT_PROJECT - branch: '{branch}' - - string: - name: GIT_CLONE_BASE - default: ssh://gerrit.opnfv.org:29418 - description: "Used for overriding the GIT URL coming from parameters macro." - - string: - name: GS_URL - default: '$GS_BASE{gs-pathname}' - description: "Directory where the build artifact will be located upon\ - \ the completion of the build." - - 'opnfv-build-defaults' - + - label: + name: node + default: opnfv-build scm: - - git-scm - + - opnfvdocs-scm: + ref: $GERRIT_REFSPEC triggers: - - gerrit: - server-name: 'gerrit.opnfv.org' - trigger-on: - - change-merged-event - - comment-added-contains-event: - comment-contains-value: 'remerge' - projects: - - project-compare-type: 'REG_EXP' - project-pattern: '{project}' - branches: - - branch-compare-type: 'ANT' - branch-pattern: '**/{branch}' - + - opnfvdocs-patchset-created builders: - - lint-bash-code + - opnfvdocs-lint-bash-code + +- project: + name: opnfvdocs + jobs: + - opnfvdocs-verify-shellcheck -- cgit 1.2.3-korg