diff --git a/.ansible-lint b/.ansible-lint index 5ebeb24f6..7ef152f7c 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -3,8 +3,11 @@ exclude_paths: parseable: true quiet: false skip_list: - - ANSIBLE0010 # Package installs should not use latest. - - 602 # Due to https://github.com/ansible/ansible-lint/issues/457 - - 208 # [E208] - - 106 # [E106] + - empty-string-compare # https://github.com/ansible/ansible-lint/issues/457 + - role-name # Role name run-test does not match ``^[a-z][a-z0-9_]+$`` pattern + - risky-file-permissions # File permissions unset or incorrect + # TODO(ssbarnea): Remove these in follow-ups + - yaml verbosity: 1 +mock_modules: + - zuul_return diff --git a/.gitignore b/.gitignore index 1c703cb84..2f48b5eeb 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ scripts/emit_releases_file/assets/ scripts/emit_releases_file/htmlcov/ scripts/emit_releases_file/pytest-report.html tripleo_ci.egg-info/ +.cache diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0d02725dd..33a41e86a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,19 +1,19 @@ --- repos: - repo: https://github.com/python/black.git - rev: 19.10b0 + rev: 20.8b1 hooks: - id: black language_version: python3 - repo: https://gitlab.com/pycqa/flake8.git - rev: 3.7.9 + rev: 3.8.4 hooks: - id: flake8 additional_dependencies: - flake8-black>=0.1.1 language_version: python3 - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.4.0 + rev: v3.4.0 hooks: - id: end-of-file-fixer - id: trailing-whitespace @@ -25,19 +25,11 @@ repos: - id: check-yaml files: .*\.(yaml|yml)$ - repo: https://gitlab.com/pycqa/flake8 - rev: '3.7.9' + rev: '3.8.4' hooks: - id: flake8 - # commented to allow progressive adoption in smaller patches - # - repo: https://github.com/adrienverge/yamllint.git - # rev: v1.18.0 - # hooks: - # - id: yamllint - # files: \.(yaml|yml)$ - # types: [file, yaml] - # entry: yamllint --strict -f parsable - repo: https://github.com/ansible/ansible-lint.git - rev: v4.3.5 + rev: v5.0.0 hooks: - id: ansible-lint always_run: true @@ -46,11 +38,11 @@ repos: # results when called with individual files. # https://github.com/ansible/ansible-lint/issues/611 verbose: true - entry: env ANSIBLE_LIBRARY=./library ansible-lint --force-color -p -v . + entry: ansible-lint --force-color -p -v . additional_dependencies: - 'ansible<2.10' - repo: https://github.com/openstack-dev/bashate.git - rev: 0.6.0 + rev: 2.0.0 hooks: - id: bashate entry: bashate --error . --ignore=E006,E040 diff --git a/playbooks/openstack-zuul-jobs/legacy/pre.yaml b/playbooks/openstack-zuul-jobs/legacy/pre.yaml index ee38390cd..172fb894f 100644 --- a/playbooks/openstack-zuul-jobs/legacy/pre.yaml +++ b/playbooks/openstack-zuul-jobs/legacy/pre.yaml @@ -74,8 +74,7 @@ changed_when: false - name: Show the environment passed in to job shell scripts - # noqa 305 - shell: env + command: env args: executable: /bin/bash warn: false diff --git a/playbooks/tripleo-buildimages/tmpfiles.yaml b/playbooks/tripleo-buildimages/tmpfiles.yaml index f3b34e740..d26f1e7ba 100644 --- a/playbooks/tripleo-buildimages/tmpfiles.yaml +++ b/playbooks/tripleo-buildimages/tmpfiles.yaml @@ -2,10 +2,8 @@ - hosts: all tasks: - name: remove removal of tmp files - # noqa 303 become: true - shell: - cmd: | - sed -i '/30d/d' /usr/lib/tmpfiles.d/tmp.conf; - sed -i '/10d/d' /usr/lib/tmpfiles.d/tmp.conf - changed_when: true + lineinfile: + path: /usr/lib/tmpfiles.d/tmp.conf + regex: "(10|30)d" + state: absent diff --git a/playbooks/tripleo-ci/run-provider.yml b/playbooks/tripleo-ci/run-provider.yml index d2a4cba09..1797b4a0c 100644 --- a/playbooks/tripleo-ci/run-provider.yml +++ b/playbooks/tripleo-ci/run-provider.yml @@ -41,7 +41,7 @@ - name: Set fact for DLRN tag set_fact: provider_dlrn_hash_branch: "{'{{ ci_branch }}': '{{ dlrn_file['content'] | b64decode | trim }}'}" - provider_dlrn_hash_tag_branch: "{'{{ ci_branch }}': '{{ dlrn_file['content'] | b64decode | trim}}'}" + provider_dlrn_hash_tag_branch: "{'{{ ci_branch }}': '{{ dlrn_file['content'] | b64decode | trim }}'}" - name: Return Zuul data debug: diff --git a/roles/build-containers/tasks/main.yaml b/roles/build-containers/tasks/main.yaml index 4b41ac2c0..7a3870bed 100644 --- a/roles/build-containers/tasks/main.yaml +++ b/roles/build-containers/tasks/main.yaml @@ -238,10 +238,11 @@ - ansible_distribution|lower == "redhat" become: true -- name: Retrieve built images +- name: Retrieve built images # noqa risky-shell-pipe shell: "{{ container_cli }} images | grep {{ container_name_prefix }} | awk '{ print $1 }'" register: built_images become: true + changed_when: false - name: Retag and push x86_64 images when: diff --git a/roles/ceph-loop-device/tasks/main.yml b/roles/ceph-loop-device/tasks/main.yml index 4064780e5..0b3053f07 100644 --- a/roles/ceph-loop-device/tasks/main.yml +++ b/roles/ceph-loop-device/tasks/main.yml @@ -9,7 +9,7 @@ msg: "boostrap-subnodes - warning {{ ceph_loop_device }} already exists" when: dev_loop3_res.stat.exists -- name: Make sure we have losetup installed/latest +- name: Make sure we have losetup installed/latest # noqa: package-latest become: true package: name: diff --git a/roles/tripleo-repos/molecule/default/converge.yml b/roles/tripleo-repos/molecule/default/converge.yml index c930f6da0..c3d606a00 100644 --- a/roles/tripleo-repos/molecule/default/converge.yml +++ b/roles/tripleo-repos/molecule/default/converge.yml @@ -8,7 +8,7 @@ include_role: name: tripleo-repos - - name: validate that we can install openstack-tripleo-common + - name: validate that we can install openstack-tripleo-common # noqa package-latest package: name: openstack-tripleo-common state: latest diff --git a/roles/tripleo-repos/molecule/default/playbook.yml b/roles/tripleo-repos/molecule/default/playbook.yml index c930f6da0..c3d606a00 100644 --- a/roles/tripleo-repos/molecule/default/playbook.yml +++ b/roles/tripleo-repos/molecule/default/playbook.yml @@ -8,7 +8,7 @@ include_role: name: tripleo-repos - - name: validate that we can install openstack-tripleo-common + - name: validate that we can install openstack-tripleo-common # noqa package-latest package: name: openstack-tripleo-common state: latest diff --git a/roles/tripleo-repos/tasks/main.yml b/roles/tripleo-repos/tasks/main.yml index 9beac8f8a..189c3b216 100644 --- a/roles/tripleo-repos/tasks/main.yml +++ b/roles/tripleo-repos/tasks/main.yml @@ -108,7 +108,7 @@ mv /etc/yum.repos.d/fedora-stable.repo /etc/yum.repos.d/delorean-{{ ci_branch | default('master') }}-testing.repo when: ansible_distribution|lower == "fedora" -- name: Update all installed packages after new repos are setup +- name: Update all installed packages after new repos are setup # noqa package-latest become: true package: name: '*'