From b89fb7bd2bcf371ff4c3dd80bf2e9f81764406a3 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Wed, 31 Jul 2024 16:39:54 +0100 Subject: [PATCH] chore: yaml reformatting (#207) --- .ansible-lint | 3 ++ .github/dependabot.yml | 6 +-- .github/release-drafter.yml | 69 +++++++++++++------------- .github/workflows/ack.yml | 3 +- .github/workflows/push.yml | 7 +-- .github/workflows/push_network.yml | 9 ++-- .github/workflows/release.yml | 4 +- .github/workflows/release_ah.yml | 4 +- .github/workflows/release_galaxy.yml | 4 +- .github/workflows/test.yml | 8 +-- .github/workflows/tox.yml | 13 +++-- .pre-commit-config.yaml | 6 +++ .readthedocs.yml | 4 +- .yamllint | 6 +++ config/devtools.yml | 1 + cspell.config.yaml | 1 + mkdocs.yml | 5 +- playbooks/deploy-bot-pat.yml | 4 +- playbooks/host_vars/localhost.yml | 1 + playbooks/sync.yml | 1 + playbooks/tasks/gh-set-env-secrets.yml | 2 + playbooks/tasks/gh-set-secret.yml | 2 + readthedocs.yml | 5 +- tox.ini | 1 + 24 files changed, 100 insertions(+), 69 deletions(-) create mode 100644 .ansible-lint diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..c0c3429 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,3 @@ +--- +exclude_paths: + - mkdocs.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5b32d4c..f50de49 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,9 +1,9 @@ --- version: 2 updates: - - package-ecosystem: "github-actions" - directory: "/" + - package-ecosystem: github-actions + directory: / schedule: interval: daily labels: - - "skip-changelog" + - skip-changelog diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 6253a1b..10ef3bf 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,69 +1,68 @@ +--- # Format and labels used by Ansible DevTools projects -name-template: "v$RESOLVED_VERSION" -tag-template: "v$RESOLVED_VERSION" +name-template: v$RESOLVED_VERSION +tag-template: v$RESOLVED_VERSION # Use '-' instead of '*' for unordered list to match prettier behavior change-template: "- $TITLE (#$NUMBER) @$AUTHOR" categories: - - title: "Enhancements" + - title: Enhancements labels: - - "major" # c6476b - - "minor" - - "feature" # 006b75 - - "enhancement" # ededed - - "refactoring" - - title: "Bugfixes" + - major # c6476b + - minor + - feature # 006b75 + - enhancement # ededed + - refactoring + - title: Bugfixes labels: - - "bug" # fbca04 - - title: Other - - "patch" - - "deprecated" # fef2c0 + - bug # fbca04 + - title: Other - "patch" - "deprecated" # fef2c0 exclude-labels: - - "bot:chronographer:skip" - - "skip-changelog" + - bot:chronographer:skip + - skip-changelog replacers: # https://github.com/release-drafter/release-drafter/issues/569#issuecomment-645942909 - - search: '/(?:and )?@(pre-commit-ci|dependabot)(?:\[bot\])?,?/g' + - search: /(?:and )?@(pre-commit-ci|dependabot)(?:\[bot\])?,?/g replace: "" version-resolver: # major: # labels: minor: labels: - - "major" - - "minor" - - "feature" - - "enhancement" - - "refactoring" + - major + - minor + - feature + - enhancement + - refactoring patch: labels: - - "patch" - - "bug" - - "deprecated" + - patch + - bug + - deprecated default: patch exclude-contributors: - - "dependabot" - - "pre-commit-ci" + - dependabot + - pre-commit-ci autolabeler: - - label: "skip-changelog" + - label: skip-changelog title: - - "/pre-commit autoupdate/" + - /pre-commit autoupdate/ body: - "/type: chore/i" branch: - - "/^chore/i" - - label: "bug" + - /^chore/i + - label: bug branch: - - "/^fix/i" + - /^fix/i body: - "/type: fix/i" - - label: "feature" + - label: feature title: - - "/^(feat|feature)/i" + - /^(feat|feature)/i body: - "/type: feature/i" - - label: "deprecated" + - label: deprecated title: - - "/^deprecat(ed|ion)/i" + - /^deprecat(ed|ion)/i body: - "/type: deprecat(ed|ion)/i" template: | diff --git a/.github/workflows/ack.yml b/.github/workflows/ack.yml index 0479b6f..b866ca8 100644 --- a/.github/workflows/ack.yml +++ b/.github/workflows/ack.yml @@ -1,3 +1,4 @@ +--- # ack workflow runs on any change made to a pull-request and aims to verify # that is following our practices. Initial version is checking correct label # presence. @@ -13,7 +14,7 @@ on: required: false jobs: ack: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 environment: ack env: BOT_PAT: ${{ secrets.BOT_PAT }} diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 1408be3..24f0213 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,3 +1,4 @@ +--- # push workflow is shared and expected to perform actions after a merge happens # on a maintenance branch (default or release). For example updating the # draft release-notes. @@ -8,13 +9,13 @@ on: # branches to consider in the event; optional, defaults to all branches: - main - - "releases/**" - - "stable/**" + - releases/** + - stable/** workflow_call: # allows reuse of this workflow from other devtools repos jobs: update_release_draft: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: release-drafter/release-drafter@v6 env: diff --git a/.github/workflows/push_network.yml b/.github/workflows/push_network.yml index 47b1f0b..a43772d 100644 --- a/.github/workflows/push_network.yml +++ b/.github/workflows/push_network.yml @@ -1,3 +1,4 @@ +--- # push workflow is shared and expected to perform actions after a merge happens # on a maintenance branch (default or release). For example updating the # draft release-notes. @@ -20,7 +21,7 @@ on: jobs: update_release_draft: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 environment: push steps: - uses: actions/checkout@v4 @@ -32,7 +33,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.12" - name: Install antsibull-changelog, antsichaut run: > @@ -58,9 +59,9 @@ jobs: - name: Get previous tag id: previoustag - uses: "WyriHaximus/github-action-get-previous-tag@master" + uses: WyriHaximus/github-action-get-previous-tag@master env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ## this part is commented out to check push workflow ## ref - https://github.com/ansible-collections/cisco.nxos/pull/765 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7637fa1..bb3d181 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,3 +1,4 @@ +--- # It is not currently possible to use trusted publishing with a shared workflow # https://github.com/pypi/warehouse/blob/main/docs/user/trusted-publishers/troubleshooting.md#reusable-workflows-on-github # this file is for reference only now @@ -6,12 +7,11 @@ name: release on: workflow_call: - jobs: release: name: release ${{ github.event.ref }} environment: release - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 permissions: id-token: write diff --git a/.github/workflows/release_ah.yml b/.github/workflows/release_ah.yml index 0077f20..d27d5b2 100644 --- a/.github/workflows/release_ah.yml +++ b/.github/workflows/release_ah.yml @@ -22,11 +22,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: "Build the collection" + - name: Build the collection run: | ansible-galaxy collection build -v --force - - name: "Publish the collection on Automation Hub" + - name: Publish the collection on Automation Hub if: ${{ inputs.ah_publish }} run: | [[ "${{ secrets.ah_token != '' }}" ]] || { echo "ah_token is required to publish on automation hub" ; exit 1; } diff --git a/.github/workflows/release_galaxy.yml b/.github/workflows/release_galaxy.yml index 7e83322..f62159f 100644 --- a/.github/workflows/release_galaxy.yml +++ b/.github/workflows/release_galaxy.yml @@ -22,11 +22,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: "Build the collection" + - name: Build the collection run: | ansible-galaxy collection build -v --force - - name: "Publish the collection on Galaxy" + - name: Publish the collection on Galaxy if: ${{ inputs.galaxy_publish }} run: | [[ "${{ secrets.ansible_galaxy_api_key != '' }}" ]] || { echo "ansible_galaxy_api_key is required to publish on galaxy" ; exit 1; } diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c157181..a1dc7bf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,10 +1,11 @@ +--- name: test on: pull_request: jobs: pre: name: pre - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 outputs: matrix: ${{ steps.generate_matrix.outputs.matrix }} steps: @@ -12,8 +13,9 @@ jobs: id: generate_matrix uses: coactions/dynamic-matrix@v1 with: - min_python: "3.11" - max_python: "3.11" + min_python: "3.12" + max_python: "3.12" + default_python: "3.12" other_names: | lint docs diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 8e633ac..5617267 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -37,7 +37,7 @@ env: jobs: prepare: name: prepare - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 outputs: matrix: ${{ steps.generate_matrix.outputs.matrix }} steps: @@ -58,7 +58,7 @@ jobs: test: name: ${{ matrix.name }} - runs-on: ${{ matrix.os || 'ubuntu-22.04' }} + runs-on: ${{ matrix.os || 'ubuntu-24.04' }} needs: - prepare defaults: @@ -82,12 +82,12 @@ jobs: ~/.cache/pre-commit key: pre-commit-${{ matrix.name || matrix.passed_name }}-${{ hashFiles('.pre-commit-config.yaml') }} - - name: Set up Python ${{ matrix.python_version || '3.10' }} + - name: Set up Python ${{ matrix.python_version || '3.12' }} if: "!contains(matrix.shell, 'wsl')" uses: actions/setup-python@v5 with: cache: pip - python-version: ${{ matrix.python_version || '3.10' }} + python-version: ${{ matrix.python_version || '3.12' }} - name: Install tox run: | @@ -121,8 +121,7 @@ jobs: printf '### Failed as git reported modified and/or untracked files\n```\n%s\n```\n' "$(git status -s)" | tee -a "$GITHUB_STEP_SUMMARY" exit 99 fi - # https://github.com/actions/toolkit/issues/193 - + # https://github.com/actions/toolkit/issues/193 check: if: always() permissions: @@ -132,7 +131,7 @@ jobs: needs: - test - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8edaf63..58ff83b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,3 +30,9 @@ repos: files: \.(yaml|yml)$ types: [file, yaml] entry: yamllint --strict + - repo: https://github.com/ansible/ansible-lint + rev: v24.7.0 + hooks: + - id: ansible-lint + language_version: "3.12" + args: [--fix] diff --git a/.readthedocs.yml b/.readthedocs.yml index 28fa8d8..2e3eca1 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -6,9 +6,9 @@ mkdocs: configuration: mkdocs.yml build: - os: ubuntu-22.04 + os: ubuntu-24.04 tools: - python: "3.11" + python: "3.12" commands: - pip install --user tox - python3 -m tox -e docs diff --git a/.yamllint b/.yamllint index 7ad879c..e0bfb4e 100644 --- a/.yamllint +++ b/.yamllint @@ -1,5 +1,8 @@ +--- extends: default rules: + braces: + max-spaces-inside: 1 comments: # prettier compatibility min-spaces-from-content: 1 @@ -10,6 +13,9 @@ rules: document-start: disable # we need to decide if we want to impose one or not line-length: disable + octal-values: + forbid-implicit-octal: true + forbid-explicit-octal: true truthy: # "on:" is perfectly valid key on github actions: check-keys: false diff --git a/config/devtools.yml b/config/devtools.yml index 5d86109..77f9f40 100644 --- a/config/devtools.yml +++ b/config/devtools.yml @@ -1,3 +1,4 @@ +--- # This file documents repositories that are nurtured by Ansible DevTools team. # Not all these repos are fully managed or maintained by the team. # We aim to use this file when performing maintenance and audit. diff --git a/cspell.config.yaml b/cspell.config.yaml index ab9045f..99967a4 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -1,3 +1,4 @@ +--- dictionaryDefinitions: - name: words path: .config/dictionary.txt diff --git a/mkdocs.yml b/mkdocs.yml index 377d753..933847a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,3 +1,4 @@ +--- site_name: Ansible DevTools site_url: https://ansible.readthedocs.io/projects/team-devtools/ repo_url: https://github.com/ansible/team-devtools @@ -34,8 +35,8 @@ nav: - Release: guides/vscode/release.md - stats: - Molecule Plugins: stats/molecule-plugins.md - # - ansible-language-server: '!import https://github.com/ansible/ansible-language-server?branch=main&multi_docs=False' - # - projects: "*include .cache/*/mkdocs.yml" +# - ansible-language-server: '!import https://github.com/ansible/ansible-language-server?branch=main&multi_docs=False' +# - projects: "*include .cache/*/mkdocs.yml" plugins: - autorefs - material/search diff --git a/playbooks/deploy-bot-pat.yml b/playbooks/deploy-bot-pat.yml index 747187d..d46a36b 100644 --- a/playbooks/deploy-bot-pat.yml +++ b/playbooks/deploy-bot-pat.yml @@ -1,3 +1,4 @@ +--- - name: Deploy BOT_PAT secret hosts: localhost gather_facts: false @@ -7,7 +8,8 @@ file: ../config/devtools.yml name: devtools - - debug: + - name: Display info + ansible.builtin.debug: msg: "{{ item }}" loop: "{{ env_secrets | dict2items(key_name='env_name', value_name='env_secrets') }}" diff --git a/playbooks/host_vars/localhost.yml b/playbooks/host_vars/localhost.yml index e133bdc..0bbaa37 100644 --- a/playbooks/host_vars/localhost.yml +++ b/playbooks/host_vars/localhost.yml @@ -1,3 +1,4 @@ +--- env_secrets: ack: # github environment name BOT_PAT: !vault | diff --git a/playbooks/sync.yml b/playbooks/sync.yml index 964b3fe..14044c1 100644 --- a/playbooks/sync.yml +++ b/playbooks/sync.yml @@ -1,3 +1,4 @@ +--- - name: Checkout and Update DevTools project source code hosts: localhost connection: local diff --git a/playbooks/tasks/gh-set-env-secrets.yml b/playbooks/tasks/gh-set-env-secrets.yml index b220587..0432ea3 100644 --- a/playbooks/tasks/gh-set-env-secrets.yml +++ b/playbooks/tasks/gh-set-env-secrets.yml @@ -1,6 +1,8 @@ +--- - name: Create github environment ansible.builtin.shell: > gh api --method PUT -H "Accept: application/vnd.github+json" repos/{{ repo }}/environments/{{ env.env_name }} + changed_when: true loop: "{{ env_secrets | dict2items(key_name='env_name', value_name='env_secrets') }}" loop_control: loop_var: env diff --git a/playbooks/tasks/gh-set-secret.yml b/playbooks/tasks/gh-set-secret.yml index b8eb879..2c1f95f 100644 --- a/playbooks/tasks/gh-set-secret.yml +++ b/playbooks/tasks/gh-set-secret.yml @@ -1,5 +1,7 @@ +--- - name: Configure secret ansible.builtin.shell: > gh secret --repo {{ repo }} set --env {{ env.env_name }} {{ item.gh_secret_name }} --body {{ item.gh_secret_value }} + changed_when: true no_log: false loop: "{{ env.env_secrets | dict2items('gh_secret_name', 'gh_secret_value') }}" diff --git a/readthedocs.yml b/readthedocs.yml index 3abedf1..a7d55f2 100644 --- a/readthedocs.yml +++ b/readthedocs.yml @@ -1,3 +1,4 @@ +--- version: 2 submodules: @@ -8,9 +9,9 @@ mkdocs: fail_on_warning: true build: - os: ubuntu-22.04 + os: ubuntu-24.04 tools: - python: "3.11" + python: "3.12" python: install: diff --git a/tox.ini b/tox.ini index 26fd77c..a83d445 100644 --- a/tox.ini +++ b/tox.ini @@ -30,6 +30,7 @@ usedevelop = false [testenv:lint] description = Runs all linting tasks +basepython = python3.12 commands = # to run a single linter you can do "pre-commit run flake8" python3 -m pre_commit run {posargs:--all}