engine: Create job skeletons for ansible lint and shellcheck 52/3052/5
authorFatih Degirmenci <fdegir@gmail.com>
Tue, 3 Dec 2019 17:18:09 +0000 (18:18 +0100)
committerFatih Degirmenci <fdegir@gmail.com>
Wed, 4 Dec 2019 09:41:25 +0000 (10:41 +0100)
This change enables ansible-lint for ansible files and
shellcheck for shell scripts. Initially the jobs will be
run in none-voting fashion in order not to block patches
from being merged. Voting will be enabled once the existing
problems are fixed.

Change-Id: I032d0fd67ea2e181d9fe46e66f476dbe0e55f7b4

jjb/cloud-infra/cloud-infra-engine-verify-deploy.yaml [moved from jjb/cloud-infra/cloud-infra-verify-engine.yaml with 100% similarity]
jjb/cloud-infra/cloud-infra-engine-verify-lint.yaml [new file with mode: 0644]
jjb/cloud-infra/cloud-infra-macros.yaml
jjb/cloud-infra/scripts/cloud-infra-ansible-lint.sh [new file with mode: 0644]
jjb/cloud-infra/scripts/cloud-infra-shellcheck.sh [new file with mode: 0644]

diff --git a/jjb/cloud-infra/cloud-infra-engine-verify-lint.yaml b/jjb/cloud-infra/cloud-infra-engine-verify-lint.yaml
new file mode 100644 (file)
index 0000000..ed0121f
--- /dev/null
@@ -0,0 +1,104 @@
+---
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 Nordix Foundation.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+- project:
+    name: 'cloud-infra-lint'
+
+    project: 'infra/engine'
+
+    stream:
+      - 'master':
+          branch: '{stream}'
+          disabled: false
+          successful: true
+          failed: true
+          unstable: true
+          notbuilt: true
+
+    lint-type:
+      - ansible-lint
+      - shellcheck
+
+    jobs:
+      - 'cloud-infra-verify-engine-{lint-type}-{stream}'
+
+- job-template:
+    name: 'cloud-infra-verify-engine-{lint-type}-{stream}'
+
+    disabled: '{obj:disabled}'
+
+    concurrent: true
+
+    node: infra-ubuntu1804
+
+    parameters:
+      - project-parameters:
+          project: '{project}'
+          branch: '{branch}'
+      - nordix-gerrit-parameters
+
+    properties:
+      - logrotate
+
+    wrappers:
+      - build-timeout:
+          timeout: 150
+      - fix-workspace-permissions
+
+    scm:
+      - git-scm-gerrit:
+          ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
+          branch: '{branch}'
+          refspec: $GERRIT_REFSPEC
+          wipe_workspace: true
+          clean_before: false
+
+    triggers:
+      - gerrit:
+          server-name: 'Nordix Gerrit'
+          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: 'REG_EXP'
+              project-pattern: 'infra\/engine'
+              branches:
+                - branch-compare-type: 'ANT'
+                  branch-pattern: '**/{branch}'
+              file-paths:
+                - compare-type: 'ANT'
+                  pattern: '**'
+          skip-vote:
+            successful: '{obj:successful}'
+            failed: '{obj:failed}'
+            unstable: '{obj:unstable}'
+            notbuilt: '{obj:notbuilt}'
+          custom-url: '* $JOB_NAME $BUILD_URL'
+
+    builders:
+      - 'cloud-infra-{lint-type}-macro'
+
+# vim: set ts=2 sw=2 expandtab:
index 398f7e108140333692e84dd84aef1f39e3f88986..6d90afe06e32db67ec59d384c402b5cee8bff2c4 100644 (file)
       - shell:
           !include-raw: ./scenario-promote.sh
 
+- builder:
+    name: 'cloud-infra-ansible-lint-macro'
+    builders:
+      - shell:
+          !include-raw: ./scripts/cloud-infra-ansible-lint.sh
+
+- builder:
+    name: 'cloud-infra-shellcheck-macro'
+    builders:
+      - shell:
+          !include-raw: ./scripts/cloud-infra-shellcheck.sh
+
 # vim: set ts=2 sw=2 expandtab:
diff --git a/jjb/cloud-infra/scripts/cloud-infra-ansible-lint.sh b/jjb/cloud-infra/scripts/cloud-infra-ansible-lint.sh
new file mode 100644 (file)
index 0000000..db8fba2
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+cd $WORKSPACE
+echo "Hello, World!"
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/jjb/cloud-infra/scripts/cloud-infra-shellcheck.sh b/jjb/cloud-infra/scripts/cloud-infra-shellcheck.sh
new file mode 100644 (file)
index 0000000..db8fba2
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+cd $WORKSPACE
+echo "Hello, World!"
+
+# vim: set ts=2 sw=2 expandtab: