]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
cephadm-ansible: update scripts 1810/head
authorGuillaume Abrioux <gabrioux@redhat.com>
Fri, 14 May 2021 11:57:59 +0000 (13:57 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Fri, 14 May 2021 11:57:59 +0000 (13:57 +0200)
This updates the build and teardown scripts so the playbook in
cephadm-ansible repository can be tested with the upstream ci.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
cephadm-ansible-prs/build/build
cephadm-ansible-prs/build/teardown
cephadm-ansible-prs/config/definitions/ceph-ansible-prs.yml [deleted file]
cephadm-ansible-prs/config/definitions/cephadm-ansible-prs.yml [new file with mode: 0644]

index fed5a94469abdab68f01b95fe942da497908ed42..a2edde822895fb43d6ef9318909eab30fbbe66b5 100644 (file)
@@ -1,4 +1,19 @@
 #!/bin/bash
 
-# placeholder for now
-/bin/true
+# the following two methods exist in scripts/build_utils.sh
+pkgs=( "tox" )
+install_python_packages "pkgs[@]"
+
+# XXX this might not be needed
+source $VENV/activate
+
+WORKDIR=$(mktemp -td tox.XXXXXXXXXX)
+
+delete_libvirt_vms
+clear_libvirt_networks
+restart_libvirt_services
+update_vagrant_boxes
+
+rm -rf "${HOME}"/ansible/facts/*
+
+"${VENV}"/tox --workdir="${TEMPVENV}" -c tox.ini -r -v -- --provider=libvirt
index fed5a94469abdab68f01b95fe942da497908ed42..9ce6137ff21ebd6bacf2b72ec4fb9dfdae4074f3 100644 (file)
@@ -1,4 +1,9 @@
 #!/bin/bash
 
-# placeholder for now
-/bin/true
+cd "${WORKSPACE}"/tests
+
+# the method exists in scripts/build_utils.sh
+teardown_vagrant_tests
+
+# clean fact cache
+rm -rf "${HOME}"/ansible/facts/*
diff --git a/cephadm-ansible-prs/config/definitions/ceph-ansible-prs.yml b/cephadm-ansible-prs/config/definitions/ceph-ansible-prs.yml
deleted file mode 100644 (file)
index fd8a573..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-- project:
-    name: cephadm-ansible-prs-smithi
-    worker_labels: 'vagrant && libvirt && smithi'
-    scenario:
-      - all_daemons
-    jobs:
-      - 'cephadm-ansible-prs-auto'
-
-- job-template:
-    name: 'cephadm-ansible-prs-{scenario}'
-    id: 'cephadm-ansible-prs-auto'
-    node: '{worker_labels}'
-    concurrent: true
-    defaults: global
-    display-name: 'cephadm-ansible: Pull Requests [{scenario}]'
-    quiet-period: 5
-    block-downstream: false
-    block-upstream: false
-    retry-count: 3
-    properties:
-      - github:
-          url: https://github.com/ceph/cephadm-ansible
-      - build-discarder:
-          days-to-keep: 90
-          num-to-keep: -1
-          artifact-days-to-keep: -1
-          artifact-num-to-keep: -1
-
-    parameters:
-      - string:
-          name: sha1
-          description: "A pull request ID, like 'origin/pr/72/head'"
-
-    triggers:
-      - github-pull-request:
-          cancel-builds-on-update: true
-          allow-whitelist-orgs-as-admins: true
-          org-list:
-            - ceph
-          skip-build-phrase: '^jenkins do not test.*|.*\[skip ci\].*'
-          trigger-phrase: '^jenkins test {scenario}|jenkins test all.*'
-          only-trigger-phrase: false
-          github-hooks: true
-          permit-all: true
-          auto-close-on-fail: false
-          status-context: "Testing: {scenario}"
-          started-status: "Running: {scenario}"
-          success-status: "OK - {scenario}"
-          failure-status: "FAIL - {scenario}"
-
-    scm:
-      - git:
-          url: https://github.com/ceph/cephadm-ansible.git
-          branches:
-            - ${{sha1}}
-          refspec: +refs/pull/*:refs/remotes/origin/pr/*
-          browser: auto
-          timeout: 20
-          skip-tag: true
-          wipe-workspace: false
-
-    builders:
-      - inject:
-          properties-content: |
-            SCENARIO={scenario}
-      - conditional-step:
-          condition-kind: shell
-          condition-command: |
-            #!/bin/bash
-            # Returns 1 if only .rst and README files were modified
-            echo "Checking if only rst and READMEs were modified"
-            git show HEAD | grep -qo ^Merge:
-            if [ $? -eq 0 ]; then
-              git diff --name-only $(git show HEAD | grep ^Merge: | cut -d ':' -f2) | grep -v '\.rst\|README'
-              if [ $? -eq 1 ]; then
-                echo "Only docs were modified.  Skipping the rest of the job."
-                exit 1
-              fi
-            fi
-          on-evaluation-failure: dont-run
-          steps:
-            - shell:
-                !include-raw-escape:
-                  - ../../../scripts/build_utils.sh
-                  - ../../build/build
-
-    publishers:
-      - postbuildscript:
-          builders:
-            - role: SLAVE
-              build-on:
-                  - FAILURE
-                  - ABORTED
-              build-steps:
-                - shell:
-                    !include-raw-escape:
-                      - ../../../scripts/build_utils.sh
-                      - ../../build/teardown
-
-      - archive:
-          artifacts: 'logs/**'
-          allow-empty: true
-          latest-only: false
-
-    wrappers:
-      - inject-passwords:
-          global: true
-          mask-password-params: true
-      - credentials-binding:
-          - username-password-separated:
-              credential-id: ceph-ansible-upstream-ci
-              username: DOCKER_HUB_USERNAME
-              password: DOCKER_HUB_PASSWORD
-
diff --git a/cephadm-ansible-prs/config/definitions/cephadm-ansible-prs.yml b/cephadm-ansible-prs/config/definitions/cephadm-ansible-prs.yml
new file mode 100644 (file)
index 0000000..fd8a573
--- /dev/null
@@ -0,0 +1,114 @@
+- project:
+    name: cephadm-ansible-prs-smithi
+    worker_labels: 'vagrant && libvirt && smithi'
+    scenario:
+      - all_daemons
+    jobs:
+      - 'cephadm-ansible-prs-auto'
+
+- job-template:
+    name: 'cephadm-ansible-prs-{scenario}'
+    id: 'cephadm-ansible-prs-auto'
+    node: '{worker_labels}'
+    concurrent: true
+    defaults: global
+    display-name: 'cephadm-ansible: Pull Requests [{scenario}]'
+    quiet-period: 5
+    block-downstream: false
+    block-upstream: false
+    retry-count: 3
+    properties:
+      - github:
+          url: https://github.com/ceph/cephadm-ansible
+      - build-discarder:
+          days-to-keep: 90
+          num-to-keep: -1
+          artifact-days-to-keep: -1
+          artifact-num-to-keep: -1
+
+    parameters:
+      - string:
+          name: sha1
+          description: "A pull request ID, like 'origin/pr/72/head'"
+
+    triggers:
+      - github-pull-request:
+          cancel-builds-on-update: true
+          allow-whitelist-orgs-as-admins: true
+          org-list:
+            - ceph
+          skip-build-phrase: '^jenkins do not test.*|.*\[skip ci\].*'
+          trigger-phrase: '^jenkins test {scenario}|jenkins test all.*'
+          only-trigger-phrase: false
+          github-hooks: true
+          permit-all: true
+          auto-close-on-fail: false
+          status-context: "Testing: {scenario}"
+          started-status: "Running: {scenario}"
+          success-status: "OK - {scenario}"
+          failure-status: "FAIL - {scenario}"
+
+    scm:
+      - git:
+          url: https://github.com/ceph/cephadm-ansible.git
+          branches:
+            - ${{sha1}}
+          refspec: +refs/pull/*:refs/remotes/origin/pr/*
+          browser: auto
+          timeout: 20
+          skip-tag: true
+          wipe-workspace: false
+
+    builders:
+      - inject:
+          properties-content: |
+            SCENARIO={scenario}
+      - conditional-step:
+          condition-kind: shell
+          condition-command: |
+            #!/bin/bash
+            # Returns 1 if only .rst and README files were modified
+            echo "Checking if only rst and READMEs were modified"
+            git show HEAD | grep -qo ^Merge:
+            if [ $? -eq 0 ]; then
+              git diff --name-only $(git show HEAD | grep ^Merge: | cut -d ':' -f2) | grep -v '\.rst\|README'
+              if [ $? -eq 1 ]; then
+                echo "Only docs were modified.  Skipping the rest of the job."
+                exit 1
+              fi
+            fi
+          on-evaluation-failure: dont-run
+          steps:
+            - shell:
+                !include-raw-escape:
+                  - ../../../scripts/build_utils.sh
+                  - ../../build/build
+
+    publishers:
+      - postbuildscript:
+          builders:
+            - role: SLAVE
+              build-on:
+                  - FAILURE
+                  - ABORTED
+              build-steps:
+                - shell:
+                    !include-raw-escape:
+                      - ../../../scripts/build_utils.sh
+                      - ../../build/teardown
+
+      - archive:
+          artifacts: 'logs/**'
+          allow-empty: true
+          latest-only: false
+
+    wrappers:
+      - inject-passwords:
+          global: true
+          mask-password-params: true
+      - credentials-binding:
+          - username-password-separated:
+              credential-id: ceph-ansible-upstream-ci
+              username: DOCKER_HUB_USERNAME
+              password: DOCKER_HUB_PASSWORD
+