Rewrite OPNFV docs' shellcheck 92/73792/3
authorCédric Ollivier <cedric.ollivier@orange.com>
Fri, 6 Jan 2023 13:13:49 +0000 (14:13 +0100)
committerCédric Ollivier <cedric.ollivier@orange.com>
Fri, 6 Jan 2023 13:29:12 +0000 (14:29 +0100)
Change-Id: I2c2e4f02463685a4450bede445fa62c1f408c435
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
jjb/opnfvdocs/opnfvdocs.yaml

index a963d77..3047a74 100644 (file)
 ---
-########################
-# 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