From: Guillaume Abrioux Date: Fri, 14 May 2021 11:57:59 +0000 (+0200) Subject: cephadm-ansible: update scripts X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1810%2Fhead;p=ceph-build.git cephadm-ansible: update scripts 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 --- diff --git a/cephadm-ansible-prs/build/build b/cephadm-ansible-prs/build/build index fed5a944..a2edde82 100644 --- a/cephadm-ansible-prs/build/build +++ b/cephadm-ansible-prs/build/build @@ -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 diff --git a/cephadm-ansible-prs/build/teardown b/cephadm-ansible-prs/build/teardown index fed5a944..9ce6137f 100644 --- a/cephadm-ansible-prs/build/teardown +++ b/cephadm-ansible-prs/build/teardown @@ -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 index fd8a5737..00000000 --- a/cephadm-ansible-prs/config/definitions/ceph-ansible-prs.yml +++ /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 index 00000000..fd8a5737 --- /dev/null +++ b/cephadm-ansible-prs/config/definitions/cephadm-ansible-prs.yml @@ -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 +