]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-iscsi-config-flake8: initial version 1088/head
authorJason Dillaman <dillaman@redhat.com>
Tue, 24 Jul 2018 16:32:08 +0000 (12:32 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 24 Jul 2018 16:34:30 +0000 (12:34 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
ceph-iscsi-config-flake8/build/build [new file with mode: 0755]
ceph-iscsi-config-flake8/config/JENKINS_URL [new file with mode: 0644]
ceph-iscsi-config-flake8/config/definitions/ceph-iscsi-config-flake8.yml [new file with mode: 0644]

diff --git a/ceph-iscsi-config-flake8/build/build b/ceph-iscsi-config-flake8/build/build
new file mode 100755 (executable)
index 0000000..2653643
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+set -e
+set -x
+
+function generate_filelist(){
+   if [[ "$pull_request_id" -eq "" || "${ghprbCommentBody:-}" = "jenkins flake8 all" ]]
+   then
+       find . -name '*.py'
+   else
+       curl -XGET "https://api.github.com/repos/ceph/ceph-iscsi-config/pulls/$pull_request_id/files" |
+       jq '.[].filename' |  # just the files please
+       tr -d '"' |  # remove the quoting from JSON
+       grep ".py$" # just the python
+   fi
+
+}
+
+function check(){
+    local file
+    while read -r filename; do
+        pushd "$(dirname "$filename")"
+        file=$(basename "$filename")
+        sudo docker run --rm -v "$workspace"/ceph-iscsi-config/tox.ini:/tox.ini -v "$(pwd)"/"$file":/"$file" eeacms/flake8 /"$file"
+        popd
+    done
+    return $?
+}
+
+function main() {
+    # install some of our dependencies if running on a jenkins slave
+    if [[ -n "$HUDSON_URL" ]]
+    then
+        sudo yum -y install epel-release
+        sudo yum -y install docker jq
+        sudo systemctl start docker
+        pull_request_id=${ghprbPullId:-$2}
+        workspace=${WORKSPACE:-$1}
+    else
+        if ! command -v docker || ! command -v jq
+        then
+            echo "docker or jq is/are missing, install it/them"
+            exit 1
+        fi
+        pull_request_id=${ghprbPullId:-$2}
+        workspace=${WORKSPACE:-$1}
+    fi
+
+
+    pushd "$workspace/ceph-iscsi-config"
+    generate_filelist | check
+    popd
+    exit $?
+}
+
+main "$@"
diff --git a/ceph-iscsi-config-flake8/config/JENKINS_URL b/ceph-iscsi-config-flake8/config/JENKINS_URL
new file mode 100644 (file)
index 0000000..e97cf67
--- /dev/null
@@ -0,0 +1 @@
+2.jenkins.ceph.com
diff --git a/ceph-iscsi-config-flake8/config/definitions/ceph-iscsi-config-flake8.yml b/ceph-iscsi-config-flake8/config/definitions/ceph-iscsi-config-flake8.yml
new file mode 100644 (file)
index 0000000..0185d35
--- /dev/null
@@ -0,0 +1,57 @@
+- scm:
+    name: ceph-iscsi-config
+    scm:
+      - git:
+          url: https://github.com/ceph/ceph-iscsi-config.git
+          branches:
+            - ${sha1}
+          refspec: +refs/pull/*:refs/remotes/origin/pr/*
+          browser: auto
+          timeout: 20
+          skip-tag: true
+          wipe-workspace: false
+          basedir: "ceph-iscsi-config"
+
+- job:
+    name: ceph-iscsi-config-flake8
+    node: small && centos7
+    defaults: global
+    display-name: 'ceph-iscsi-config-flake8'
+    properties:
+      - build-discarder:
+          days-to-keep: 15
+          num-to-keep: 30
+          artifact-days-to-keep: -1
+          artifact-num-to-keep: -1
+      - github:
+          url: https://github.com/ceph/ceph-iscsi-config/
+
+    parameters:
+      - string:
+          name: sha1
+          description: "A pull request ID, like 'origin/pr/72/head'"
+
+    triggers:
+      - github-pull-request:
+          admin-list:
+            - dillaman
+          org-list:
+            - ceph
+          trigger-phrase: 'jenkins flake8'
+          only-trigger-phrase: false
+          github-hooks: true
+          permit-all: true
+          auto-close-on-fail: false
+          status-context: "Testing: flake8"
+          started-status: "Running: flake8"
+          success-status: "OK"
+          failure-status: "FAIL - please clean up for merge"
+
+    scm:
+      - ceph-iscsi-config
+
+    builders:
+      - shell:
+          !include-raw:
+            - ../../build/build
+