Merge "Add license check job using new lhc"
authorAndrew Grimberg <agrimberg@linuxfoundation.org>
Sat, 23 Jun 2018 15:02:18 +0000 (15:02 +0000)
committerGerrit Code Review <gerrit@linuxfoundation.org>
Sat, 23 Jun 2018 15:02:18 +0000 (15:02 +0000)
.pre-commit-config.yaml [deleted file]
docs/jjb/lf-ci-jobs.rst
info-schema
jenkins-init-scripts/README
jjb/lf-ci-jobs.yaml
jjb/lf-macros.yaml
jjb/lf-python-jobs.yaml
shell/jenkins-configure-clouds.sh
tox.ini

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
deleted file mode 100644 (file)
index ce05348..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
----
-repos:
-  - repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v1.3.0
-    hooks:
-      - id: trailing-whitespace
index d752039..35bd248 100644 (file)
@@ -212,6 +212,7 @@ OpenStack Cloud plugin version supported:
 * 2.32
 * 2.33
 * 2.34
+* 2.35
 
 Cloud configuration are managed via a directory structure in ci-management as
 follows:
index c98a470..bb596c2 100644 (file)
@@ -13,7 +13,6 @@ $id: 'https://github.com/lfit/releng-global-jjb/blob/master/info-schema'
 
 required:
   - 'project'
-  - 'version'
   - 'project_creation_date'
   - 'project_category'
   - 'lifecycle_state'
index 8548786..2d85978 100644 (file)
@@ -11,5 +11,5 @@ it to Jenkins for job use.
 To use this create a managed file in Jenkins with the contents:
 
     #!/bin/bash
-    git clone https://gerrit.example.org/r/ci-management.git /opt/ciman
+    git clone --recurse-submodules https://gerrit.example.org/r/ci-management.git /opt/ciman
     /opt/ciman/jjb/global-jjb/jenkins-init-scripts/init.sh
index 8645941..ed6a5c5 100644 (file)
         pattern: '.*\.groovy'
       - compare-type: REG_EXP
         pattern: '.*\.sh'
+      - compare-type: REG_EXP
+        pattern: '.*\.bat'
+      - compare-type: REG_EXP
+        pattern: '.*\.ps1'
       - compare-type: REG_EXP
         pattern: '.*\.(yaml|yml)'
       - compare-type: REG_EXP
     github_included_regions:
       - '.*\.groovy'
       - '.*\.sh'
+      - '.*\.bat'
+      - '.*\.ps1'
       - '.*\.(yaml|yml)'
       - '.*\/global-jjb'
 
               file-paths:
                 - compare-type: REG_EXP
                   pattern: 'packer\/provision\/.*\.sh'
+                - compare-type: REG_EXP
+                  pattern: 'packer\/provision\/.*\.bat'
+                - compare-type: REG_EXP
+                  pattern: 'packer\/provision\/.*\.ps1'
                 - compare-type: REG_EXP
                   pattern: 'packer\/provision\/{templates}\.yaml'
                 - compare-type: REG_EXP
           # included-regions MUST match Gerrit Trigger file-paths
           included-regions:
             - 'packer\/provision\/.*\.sh'
+            - 'packer\/provision\/.*\.bat'
+            - 'packer\/provision\/.*\.ps1'
             - 'packer\/provision\/{templates}\.yaml'
             - 'packer\/provision\/local-{templates}\.yaml'
             - 'packer\/templates\/{templates}\.json'
index 2fbb825..1267197 100644 (file)
     builders:
       - inject:
           properties-content: |
-              PROJECT='{project}'
-              GERRIT_COMMIT_MESSAGE='{gerrit-commit-message}'
-              GERRIT_HOST='{gerrit-host}'
-              GERRIT_TOPIC='{gerrit-topic}'
-              GERRIT_USER='{gerrit-user}'
-              REVIEWERS_EMAIL='{reviewers-email}'
+              PROJECT={project}
+              GERRIT_COMMIT_MESSAGE={gerrit-commit-message}
+              GERRIT_HOST={gerrit-host}
+              GERRIT_TOPIC={gerrit-topic}
+              GERRIT_USER={gerrit-user}
+              REVIEWERS_EMAIL={reviewers-email}
       - shell: !include-raw-escape: ../shell/gerrit-push-patch.sh
 
 - builder:
index a647d9e..e55f11c 100644 (file)
       - lf-infra-tox-parameters:
           tox-dir: '{tox-dir}'
           tox-envs: '{tox-envs}'
+      - bool:
+          name: PARALLEL
+          default: '{parallel}'
+          description: Tox test type used to configure serial or parallel testing.
 
     wrappers:
       - lf-infra-wrappers:
           submodule-recursive: '{submodule-recursive}'
           choosing-strategy: gerrit
 
-    parameters:
-      - bool:
-          name: PARALLEL
-          default: '{parallel}'
-          description: Tox test type used to configure serial or parallel testing.
-
-
     triggers:
       - gerrit:
           server-name: '{gerrit-server-name}'
index 3f7dd6a..da0b732 100644 (file)
@@ -46,8 +46,21 @@ mkdir -p "$SCRIPT_DIR"
 
 silos="${jenkins_silos:-jenkins}"
 
+set +x  # Disable `set -x` to prevent printing passwords
+echo "Configuring $silo"
+JENKINS_URL=$(crudini --get "$HOME"/.config/jenkins_jobs/jenkins_jobs.ini "$silo" url)
+JENKINS_USER=$(crudini --get "$HOME"/.config/jenkins_jobs/jenkins_jobs.ini "$silo" user)
+JENKINS_PASSWORD=$(crudini --get "$HOME"/.config/jenkins_jobs/jenkins_jobs.ini "$silo" password)
+export JENKINS_URL
+export JENKINS_USER
+export JENKINS_PASSWORD
+OS_PLUGIN_VER="$(lftools jenkins plugins list \
+    | grep 'Openstack Cloud Plugin' | awk -F':' '{print $2}')"
+
 set -eu -o pipefail
 
+version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
+
 get_cfg() {
     if [ -z ${3+x} ]; then
         >&2 echo "Usage: get_cfg CFG_FILE SETTING DEFAULT"
@@ -63,7 +76,7 @@ get_cfg() {
         exit 1
     fi
 
-    cfg=$(grep "${setting^^}" "$cfg_file" | tail -1 | awk -F'=' '{print $2}')
+    cfg=$(grep "^${setting^^}=" "$cfg_file" | tail -1 | awk -F'=' '{print $2}')
     cfg=${cfg:-"$default"}
     echo "$cfg"
 }
@@ -153,6 +166,7 @@ get_minion_options() {
     if [ "$silo" == "sandbox" ]; then
         instance_cap=$(get_cfg "$cfg_file" SANDBOX_CAP "null")
     fi
+    min_instance_cap=$(get_cfg "$cfg_file" MIN_INSTANCE_CAP "null")
 
     floating_ip_pool=$(get_cfg "$cfg_file" FLOATING_IP_POOL "")
     security_groups=$(get_cfg "$cfg_file" SECURITY_GROUPS "default")
@@ -164,25 +178,49 @@ get_minion_options() {
     fs_root=$(get_cfg "$cfg_file" FS_ROOT "/w")
     retention_time=$(get_cfg "$cfg_file" RETENTION_TIME "0")
 
-    if [ ! -z "$volume_size" ]; then
-        echo "    new BootSource.VolumeFromImage(\"$image_name\", $volume_size),"
-    else
-        echo "    new BootSource.Image(\"$image_name\"),"
+    if version_ge "$OS_PLUGIN_VER" "2.35"; then
+        if [ ! -z "$volume_size" ]; then
+            echo "    new BootSource.VolumeFromImage(\"$image_name\", $volume_size),"
+        else
+            echo "    new BootSource.Image(\"$image_name\"),"
+        fi
+        echo "    \"${flavors[${hardware_id}]}\","
+        echo "    \"$network_id\","
+        echo "    \"$user_data_id\","
+        echo "    $instance_cap,"
+        echo "    $min_instance_cap,"
+        echo "    \"$floating_ip_pool\","
+        echo "    \"$security_groups\","
+        echo "    \"$availability_zone\","
+        echo "    $start_timeout,"
+        echo "    \"$key_pair_name\","
+        echo "    $num_executors,"
+        echo "    \"$jvm_options\","
+        echo "    \"$fs_root\","
+        echo "    new LauncherFactory.SSH(\"$key_pair_name\", \"\"),"
+        echo "    $retention_time"
+
+    else  # SlaveOptions() structure for versions <= 2.34
+        if [ ! -z "$volume_size" ]; then
+            echo "    new BootSource.VolumeFromImage(\"$image_name\", $volume_size),"
+        else
+            echo "    new BootSource.Image(\"$image_name\"),"
+        fi
+        echo "    \"${flavors[${hardware_id}]}\","
+        echo "    \"$network_id\","
+        echo "    \"$user_data_id\","
+        echo "    $instance_cap,"
+        echo "    \"$floating_ip_pool\","
+        echo "    \"$security_groups\","
+        echo "    \"$availability_zone\","
+        echo "    $start_timeout,"
+        echo "    \"$key_pair_name\","
+        echo "    $num_executors,"
+        echo "    \"$jvm_options\","
+        echo "    \"$fs_root\","
+        echo "    new LauncherFactory.SSH(\"$key_pair_name\", \"\"),"
+        echo "    $retention_time"
     fi
-    echo "    \"${flavors[${hardware_id}]}\","
-    echo "    \"$network_id\","
-    echo "    \"$user_data_id\","
-    echo "    $instance_cap,"
-    echo "    \"$floating_ip_pool\","
-    echo "    \"$security_groups\","
-    echo "    \"$availability_zone\","
-    echo "    $start_timeout,"
-    echo "    \"$key_pair_name\","
-    echo "    $num_executors,"
-    echo "    \"$jvm_options\","
-    echo "    \"$fs_root\","
-    echo "    new LauncherFactory.SSH(\"$key_pair_name\", \"\"),"
-    echo "    $retention_time"
 }
 
 get_template_cfg() {
@@ -253,13 +291,5 @@ for silo in $silos; do
         cat "$insert_file" >> "$script_file"
     done
 
-    set +x  # Disable `set -x` to prevent printing passwords
-    echo "Configuring $silo"
-    JENKINS_URL=$(crudini --get "$HOME"/.config/jenkins_jobs/jenkins_jobs.ini "$silo" url)
-    JENKINS_USER=$(crudini --get "$HOME"/.config/jenkins_jobs/jenkins_jobs.ini "$silo" user)
-    JENKINS_PASSWORD=$(crudini --get "$HOME"/.config/jenkins_jobs/jenkins_jobs.ini "$silo" password)
-    export JENKINS_URL
-    export JENKINS_USER
-    export JENKINS_PASSWORD
     lftools jenkins groovy "$script_file"
 done
diff --git a/tox.ini b/tox.ini
index c5578f7..2d4d91e 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,14 +1,8 @@
 [tox]
 minversion = 1.6
-envlist = check-hooks,coala,jjb,jjb-compare-xml,license
+envlist = coala,jjb,jjb-compare-xml,license
 skipsdist = true
 
-[testenv:check-hooks]
-deps = pre-commit
-commands =
-    pre-commit install
-    pre-commit run --all-files
-
 [testenv:coala]
 basepython = python3
 deps =