From 892ef4afa822b7e2d378b2d289d94da22b17402f Mon Sep 17 00:00:00 2001 From: Danny Sauer Date: Thu, 3 Nov 2022 15:32:32 -0500 Subject: [PATCH] ci: enable yamllint [INFENG-116] (#5359) * Add yamllint check to precommit * Reformat .github yaml files --- .github/ISSUE_TEMPLATE/bug_report.yml | 19 +++++++++++++------ .github/ISSUE_TEMPLATE/config.yml | 4 +++- .github/ISSUE_TEMPLATE/feature_request.yml | 13 +++++++++---- .github/ISSUE_TEMPLATE/question.yml | 7 +++++-- .github/dependabot.yml | 2 ++ .github/labeler.yml | 3 ++- .github/workflows/labeler.yml | 11 ++++++----- .github/workflows/link-artifacts.yml | 2 +- .github/workflows/lint-bindings.yml | 4 ++-- .github/workflows/lint-docs.yml | 2 +- .github/workflows/lint-go.yml | 4 ++-- .github/workflows/lint-migrations.yml | 3 ++- .github/workflows/lint-python.yml | 2 +- .github/workflows/lint-react.yml | 2 +- .github/workflows/lint-secrets.yml | 2 +- .github/workflows/scan-docker-images.yml | 9 ++++++--- .github/workflows/semantic.yml | 3 ++- .github/workflows/test-cli.yml | 6 +++--- .pre-commit-config.yaml | 5 +++++ .yamllint | 8 ++++++++ 20 files changed, 75 insertions(+), 36 deletions(-) create mode 100644 .yamllint diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 9d5e1ce010a..db3526e80c0 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,3 +1,4 @@ +--- name: 🐛 Bug Report title: '🐛[bug] ' description: Report a bug @@ -6,16 +7,20 @@ labels: ['bug'] body: - type: markdown attributes: - value: | + value: > ## Before you file an issue... - 1. Please search for [existing issues](https://github.com/determined-ai/determined/issues) if there are any relavant issues + + 1. Please search for + [existing issues](https://github.com/determined-ai/determined/issues) + if there are any relavant issues - type: textarea id: description attributes: label: Describe the bug - description: | - A clear description of what the bug is. Please attach screenshot into Screenshot section below. + description: > + A clear description of what the bug is. Please attach screenshot into + Screenshot section below. placeholder: Bug description validations: required: true @@ -40,7 +45,8 @@ body: id: expectation attributes: label: Expected Behavior - description: A clear and concise description of what you expected to happen + description: > + A clear and concise description of what you expected to happen placeholder: It should work like ... validations: required: true @@ -49,7 +55,8 @@ body: id: screenshot attributes: label: Screenshot - description: If applicable, add screenshots to help explain your problem. + description: > + If applicable, add screenshots to help explain your problem. placeholder: It should work like ... validations: required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 90d2a3baca8..b745b3784b9 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,4 +1,6 @@ +--- contact_links: - name: 💬 Slack url: https://determined-community.slack.com/join/shared_invite/zt-cnj7802v-KcVbaUrIzQOwmkmY7gP0Ew#/shared-invite - about: Ask questions and talk to other Determined.ai users and the maintainers + about: > + Ask questions and talk to other Determined.ai users and the maintainers diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index c7c860fe9fe..5f3a1878f61 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,3 +1,4 @@ +--- name: 💡 Feature Request title: '💡[feat] ' description: Request a new feature @@ -8,8 +9,9 @@ body: id: description attributes: label: Describe the problem - description: | - Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. + description: > + Is your feature request related to a problem? Please describe. A + clear and concise description of what the problem is. placeholder: Ex. I'm always frustrated when [...] validations: required: true @@ -26,7 +28,9 @@ body: id: alternative attributes: label: Describe alternatives you've considered - description: A clear and concise description of any alternative solutions or features you've considered. + description: > + A clear and concise description of any alternative solutions or + features you've considered. validations: required: false @@ -34,6 +38,7 @@ body: id: additional_context attributes: label: Additional context - description: Add any other context or screenshots about the feature request here. + description: > + Add any other context or screenshots about the feature request here. validations: required: false diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml index 65bb022659a..b8d100e6d5f 100644 --- a/.github/ISSUE_TEMPLATE/question.yml +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -1,3 +1,4 @@ +--- name: 🤔 Question title: '🤔[question] ' description: Question @@ -8,9 +9,11 @@ body: id: description attributes: label: Describe your question - description: | + description: > We have Slack community too. - Feel free to join the community from [here](https://determined-community.slack.com/join/shared_invite/zt-cnj7802v-KcVbaUrIzQOwmkmY7gP0Ew#/shared-invite) + + Feel free to join the community from + [here](https://determined-community.slack.com/join/shared_invite/zt-cnj7802v-KcVbaUrIzQOwmkmY7gP0Ew#/shared-invite) placeholder: Ex. I have a question about... validations: required: true diff --git a/.github/dependabot.yml b/.github/dependabot.yml index edfdd92310b..c5fb460df96 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -18,6 +18,7 @@ updates: interval: daily # reviewers: # - determined-ai/someteam + open-pull-requests-limit: 10 # Maintain dependencies for agent Docker - package-ecosystem: docker @@ -26,6 +27,7 @@ updates: interval: daily # reviewers: # - determined-ai/someteam + open-pull-requests-limit: 10 # Maintain dependencies for leader Golang - package-ecosystem: gomod diff --git a/.github/labeler.yml b/.github/labeler.yml index 2b7330c07ef..5fbd3d674c1 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,2 +1,3 @@ +--- shared-web: -- webui/react/src/shared/** + - webui/react/src/shared/** diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 0ce54e55cfa..87b33b3a6f6 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,7 +1,8 @@ +--- name: "Pull Request Labeler" -on: -- pull_request_target +on: # yamllint disable-line rule:truthy + - pull_request_target jobs: triage: @@ -10,6 +11,6 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps: - - uses: actions/labeler@v4 - with: - repo-token: ${{ secrets.DETERMINED_TOKEN }} + - uses: actions/labeler@v4 + with: + repo-token: ${{ secrets.DETERMINED_TOKEN }} diff --git a/.github/workflows/link-artifacts.yml b/.github/workflows/link-artifacts.yml index c6d7e3c2f31..c1635741a30 100644 --- a/.github/workflows/link-artifacts.yml +++ b/.github/workflows/link-artifacts.yml @@ -1,7 +1,7 @@ --- name: "Link artifacts" -on: +on: # yamllint disable-line rule:truthy status jobs: diff --git a/.github/workflows/lint-bindings.yml b/.github/workflows/lint-bindings.yml index bc088eb47de..c9c77a177bc 100644 --- a/.github/workflows/lint-bindings.yml +++ b/.github/workflows/lint-bindings.yml @@ -1,7 +1,7 @@ --- name: "Lint bindings" -on: +on: # yamllint disable-line rule:truthy pull_request: paths-ignore: - '*.md' @@ -15,7 +15,7 @@ jobs: build-proto: runs-on: ubuntu-latest env: - GO111MODULE: on + GO111MODULE: "on" steps: - uses: actions/checkout@v3 - name: Setup Go diff --git a/.github/workflows/lint-docs.yml b/.github/workflows/lint-docs.yml index e66037bae4b..5e3706d7949 100644 --- a/.github/workflows/lint-docs.yml +++ b/.github/workflows/lint-docs.yml @@ -1,7 +1,7 @@ --- name: "Lint docs" -on: +on: # yamllint disable-line rule:truthy pull_request: paths: - 'docs/*' diff --git a/.github/workflows/lint-go.yml b/.github/workflows/lint-go.yml index ff3e28d8c3b..78892235800 100644 --- a/.github/workflows/lint-go.yml +++ b/.github/workflows/lint-go.yml @@ -1,7 +1,7 @@ --- name: "Lint go" -on: +on: # yamllint disable-line rule:truthy pull_request: paths-ignore: - '*.md' @@ -20,7 +20,7 @@ jobs: service: [agent, master, proto] runs-on: ubuntu-latest env: - GO111MODULE: on + GO111MODULE: "on" steps: - uses: actions/checkout@v3 - name: Setup Go diff --git a/.github/workflows/lint-migrations.yml b/.github/workflows/lint-migrations.yml index 1602940af87..0648dc5da35 100644 --- a/.github/workflows/lint-migrations.yml +++ b/.github/workflows/lint-migrations.yml @@ -1,6 +1,7 @@ +--- name: "Lint migrations" -on: +on: # yamllint disable-line rule:truthy pull_request: paths: - master/static/migrations/** diff --git a/.github/workflows/lint-python.yml b/.github/workflows/lint-python.yml index 195deb9ba5a..a485fee00ed 100644 --- a/.github/workflows/lint-python.yml +++ b/.github/workflows/lint-python.yml @@ -1,7 +1,7 @@ --- name: "Lint python" -on: +on: # yamllint disable-line rule:truthy pull_request: paths-ignore: - '*.md' diff --git a/.github/workflows/lint-react.yml b/.github/workflows/lint-react.yml index 1097d31f1e1..3c79fd9fa22 100644 --- a/.github/workflows/lint-react.yml +++ b/.github/workflows/lint-react.yml @@ -1,7 +1,7 @@ --- name: "Lint react" -on: +on: # yamllint disable-line rule:truthy pull_request: paths: - 'webui/*' diff --git a/.github/workflows/lint-secrets.yml b/.github/workflows/lint-secrets.yml index 01984a6b01e..a8e0ffeba72 100644 --- a/.github/workflows/lint-secrets.yml +++ b/.github/workflows/lint-secrets.yml @@ -1,7 +1,7 @@ --- name: "Lint secrets" -on: +on: # yamllint disable-line rule:truthy push: branches: - 'main' diff --git a/.github/workflows/scan-docker-images.yml b/.github/workflows/scan-docker-images.yml index 2abf309b201..4d42a86fb02 100644 --- a/.github/workflows/scan-docker-images.yml +++ b/.github/workflows/scan-docker-images.yml @@ -1,7 +1,7 @@ --- name: "Scan Docker images" -on: +on: # yamllint disable-line rule:truthy schedule: - cron: "15 1 * * 0" @@ -16,7 +16,10 @@ jobs: id: get-images uses: mikefarah/yq@master with: - cmd: yq -o=json '[with_entries(select(.key | test("_hashed$"))).[].new]' tools/scripts/bumpenvs.yaml + cmd: | + yq -o=json \ + '[with_entries(select(.key | test("_hashed$"))).[].new]' \ + tools/scripts/bumpenvs.yaml scan-images: needs: list-images runs-on: ubuntu-latest @@ -48,4 +51,4 @@ jobs: sarif_file: ${{ steps.scan.outputs.sarif }} - name: Fail job if scan failed if: steps.scan.outcome == 'failure' - run: exit 1 + run: exit 1 diff --git a/.github/workflows/semantic.yml b/.github/workflows/semantic.yml index a0501406506..d3e4bba87df 100644 --- a/.github/workflows/semantic.yml +++ b/.github/workflows/semantic.yml @@ -1,6 +1,7 @@ +--- name: "Semantic Pull Request v2" -on: +on: # yamllint disable-line rule:truthy pull_request_target: types: - opened diff --git a/.github/workflows/test-cli.yml b/.github/workflows/test-cli.yml index 5ee7a0339e3..c93108abad5 100644 --- a/.github/workflows/test-cli.yml +++ b/.github/workflows/test-cli.yml @@ -1,7 +1,7 @@ --- name: "Test det CLI" -on: +on: # yamllint disable-line rule:truthy pull_request: paths-ignore: - '*.md' @@ -35,13 +35,13 @@ jobs: python -m pip install --upgrade pip pip --version # Windows needs special treatment of cryptography for unknown reasons. - # LMDB also has special requirements that only apply to windows (patch-ng). + # LMDB also has special reqs that only apply to windows (patch-ng). pip install wheel cryptography patch-ng cd harness; python setup.py bdist_wheel -d ../build - name: Install determined run: | pip install --find-links build determined==${{ env.VERSION }} - # Ensure Determined cli can run without installing cli test requirements + # Ensure Determined cli can run without installing cli test reqs det --help pip freeze --all # Allow this to fail, but it is useful for debugging. diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 94ea5a5319e..8f664fa4e5b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,3 +19,8 @@ repos: language: system files: '^webui/react/' types_or: [markdown, json] + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.17.0 + hooks: + - id: yamllint + files: '^.github/' diff --git a/.yamllint b/.yamllint new file mode 100644 index 00000000000..e221bd76488 --- /dev/null +++ b/.yamllint @@ -0,0 +1,8 @@ +--- +extends: default +rules: + line-length: + level: warning + allow-non-breakable-words: true + allow-non-breakable-inline-mappings: true + max: 100