From bfcde7d69a73942f2c5f146db09340ac8b9915db Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Wed, 30 Jun 2021 01:42:36 +0200 Subject: [PATCH] ceph-ansible: drop pr-syntax-check This is now done using GitHub workflows. Signed-off-by: Guillaume Abrioux --- ceph-ansible-pr-syntax-check/build/build | 89 ------------------- .../config/JENKINS_URL | 1 - .../ceph-ansible-pr-syntax-check.yml | 63 ------------- 3 files changed, 153 deletions(-) delete mode 100644 ceph-ansible-pr-syntax-check/build/build delete mode 100644 ceph-ansible-pr-syntax-check/config/JENKINS_URL delete mode 100644 ceph-ansible-pr-syntax-check/config/definitions/ceph-ansible-pr-syntax-check.yml diff --git a/ceph-ansible-pr-syntax-check/build/build b/ceph-ansible-pr-syntax-check/build/build deleted file mode 100644 index 2e52cb5f..00000000 --- a/ceph-ansible-pr-syntax-check/build/build +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash - -set -e - -# the following two methods exist in scripts/build_utils.sh -# shellcheck disable=SC2034 -# force virtualenv to be created earlier for this occurence, so we are not stuck because of ansible-lint dependencie, -# which would enforce latest ansible version to be installed. -TEMPVENV=$(create_venv_dir) -VENV=${TEMPVENV}/bin -virtualenv $TEMPVENV - -"$VENV"/pip install --upgrade pip -"$VENV"/pip install -r "$WORKSPACE"/ceph-ansible/requirements.txt -if [[ "$ghprbTargetBranch" == "stable-3.2" ]]; then - "$VENV"/pip install 'ansible-lint<4.2' -else - "$VENV"/pip install ansible-lint -fi - - -############# -# FUNCTIONS # -############# -function syntax_check { - "$VENV"/ansible-playbook -i "$WORKSPACE"/ceph-ansible/tests/functional/all_daemons/hosts site.yml.sample --syntax-check --list-tasks -vv - "$VENV"/ansible-playbook -i "$WORKSPACE"/ceph-ansible/tests/functional/all_daemons/hosts site-container.yml.sample --syntax-check --list-tasks -vv - "$VENV"/ansible-playbook -i "$WORKSPACE"/ceph-ansible/tests/functional/all_daemons/hosts infrastructure-playbooks/*.yml --syntax-check --list-tasks -vv -} - -function ansible_lint { - "$VENV"/ansible-lint -x 204,205 site.yml.sample - "$VENV"/ansible-lint -x 204,205 site-docker.yml.sample -} - -function group_vars_check { - match_file "/defaults/main.yml" - nb=$(match_file "/defaults/main.yml" | wc -l) - if [[ "$nb" -eq 0 ]]; then - echo "group_vars has not been touched." - return 0 - fi - - match_file "group_vars/" - nb_group_vars=$(match_file "group_vars/" | wc -l) - if [[ "$nb" -gt "$nb_group_vars" ]]; then - echo "One or more files containing default variables has/have been modified." - echo "You must run 'generate_group_vars_sample.sh' to generate the group_vars template files." - return 1 - fi -} - -function git_diff_to_head { - # shellcheck disable=SC2154 - # ghprbTargetBranch variable comes from jenkins's injectedEnvVars - git diff --diff-filter=MT --no-color origin/"${ghprbTargetBranch}"..HEAD -} - -function match_file { - git_diff_to_head | sed -n "s|^+++.*\\($1.*\\)|\\1|p" -} - -function test_sign_off { - test "$(git log --oneline --no-merges origin/"${ghprbTargetBranch}"..HEAD | wc -l)" -ne "$(git log --no-merges origin/"${ghprbTargetBranch}"..HEAD | grep -c Signed-off-by)" && echo "One or more commits is/are missing a Signed-off-by. Add it with 'git commit -s'." && return 1 - - # if we arrive here the test command successed and we can return 0 - echo "Sign-off ok!" && return 0 -} - -function test_ceph_release_in_ceph_default { - if match_file "roles/ceph-defaults/" | grep -E '^[<>+].*- ceph_release_num\[ceph_release\]'; then - echo "Do not use statements like '- ceph_release_num[ceph_release]' in ceph-defaults role!" - echo "'ceph_release' is only populated **after** the play of ceph-defaults, typically in ceph-common or ceph-docker-common." - return 1 - fi - echo "No '- ceph_release_num[ceph_release]' statements found in ceph-defaults role!" && return 0 -} - - -######## -# MAIN # -######## -cd "$WORKSPACE"/ceph-ansible -syntax_check -#ansible_lint -git fetch origin -group_vars_check -test_sign_off -test_ceph_release_in_ceph_default diff --git a/ceph-ansible-pr-syntax-check/config/JENKINS_URL b/ceph-ansible-pr-syntax-check/config/JENKINS_URL deleted file mode 100644 index e97cf671..00000000 --- a/ceph-ansible-pr-syntax-check/config/JENKINS_URL +++ /dev/null @@ -1 +0,0 @@ -2.jenkins.ceph.com diff --git a/ceph-ansible-pr-syntax-check/config/definitions/ceph-ansible-pr-syntax-check.yml b/ceph-ansible-pr-syntax-check/config/definitions/ceph-ansible-pr-syntax-check.yml deleted file mode 100644 index 19737b98..00000000 --- a/ceph-ansible-pr-syntax-check/config/definitions/ceph-ansible-pr-syntax-check.yml +++ /dev/null @@ -1,63 +0,0 @@ -- scm: - name: ceph-ansible - scm: - - git: - url: https://github.com/ceph/ceph-ansible.git - branches: - - ${sha1} - refspec: +refs/pull/*:refs/remotes/origin/pr/* - browser: auto - timeout: 20 - skip-tag: true - wipe-workspace: false - basedir: "ceph-ansible" - -- job: - name: ceph-ansible-pr-syntax-check - node: ((centos7 || trusty) && x86_64) || (vagrant && libvirt && smithi) - project-type: freestyle - defaults: global - concurrent: true - display-name: 'ceph-ansible: Pull Requests Syntax Check' - quiet-period: 5 - block-downstream: false - block-upstream: false - retry-count: 3 - 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-ansible - - parameters: - - string: - name: sha1 - description: "A pull request ID, like 'origin/pr/72/head'" - - triggers: - - github-pull-request: - allow-whitelist-orgs-as-admins: true - org-list: - - ceph - trigger-phrase: 'jenkins test playbook syntax' - # This is set so the job can be manually triggered or by the ceph-ansible-pipeline multijob - only-trigger-phrase: false - github-hooks: true - permit-all: true - auto-close-on-fail: false - status-context: "Testing: playbook syntax" - started-status: "Running syntax checks on all playbooks" - success-status: "OK - syntax checks completed" - failure-status: "Syntax check failed with errors" - - scm: - - ceph-ansible - - builders: - - shell: - !include-raw: - - ../../../scripts/build_utils.sh - - ../../build/build -- 2.39.5