Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(i): Add YAML linter #2241

Merged
merged 7 commits into from
Jan 23, 2024
Merged

Conversation

shahzadlone
Copy link
Member

@shahzadlone shahzadlone commented Jan 22, 2024

Relevant issue(s)

Description

  • Basic YAML linter Action
  • Fix all YAML linter errors
  • PR title change when using the manual action to combine dependabot PRs
  • Update default options of the combine action according to our common usage

How has this been tested?

  • CI checks for this now

Specify the platform(s) on which this was tested:

  • WSL (Manjaro)

@shahzadlone shahzadlone added ci/build This is issue is about the build or CI system, and the administration of it. code quality Related to improving code quality labels Jan 22, 2024
@shahzadlone shahzadlone added this to the DefraDB v0.10 milestone Jan 22, 2024
@shahzadlone shahzadlone self-assigned this Jan 22, 2024
@@ -66,7 +66,11 @@ jobs:
if (branch.startsWith('${{ github.event.inputs.branchPrefix }}')) {
console.log('Branch matched prefix: ' + branch);
let statusOK = true;
if(${{ github.event.inputs.mustBeGreen }}) {
if ($ {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of this code was auto formatted through prettier.

@shahzadlone
Copy link
Member Author

The [Optional] action that fails is because of the check that enforces to use branch-flow if ever touched files in:

    paths:
      - '.github/workflows/preview-ami-with-terraform-plan.yml'
      - '.github/workflows/build-then-deploy-ami.yml'
      - 'tools/cloud/aws/**'

Should be fine to dismiss as the only changes in that file are trimming ending white spaces.

@shahzadlone shahzadlone requested a review from a team January 22, 2024 12:58
Copy link
Contributor

@AndrewSisley AndrewSisley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly positive, however I think it has damaged readability in at least one location and needs a bit of tweaking IMO.

const [{ commit }] = result.repository.pullRequest.commits.nodes;
const [{
commit
}] = result.repository.pullRequest.commits.nodes;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: This looked nicer before

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should pass either way now. Can revert this one to look like before.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

branch,
prString
}
of branchesAndPRStrings) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: This looked much nicer before. What was responsible for this change? Can we please tweak whatever did this so that it does not?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fault of the prettier formatter i was using for Javascript code. Should pass still with how it looked before, will fix.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Makefile Outdated
else
$(info YAML linter 'yamllint' and `pip` both not found.)
endif
ifeq (, $(shell which yamllint)) # If yamllint still not installed then try this:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Sorry I missed this on first review. Are you sure this is really worth it? I am somewhat sceptical - did you hit problems in the CI?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first method failed to install on one of the machines (not ci, locally) so provided the alternative. This just ensure like previously when we did make deps:lint it can install the linter regardless of which machine we are on. Not as easy to do this since its not a go tool haha like the go linter which would install easily.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only needs to work in the CI though really no? I'd rather not have us maintain a list of every possible installation pathway for every non-go dependency we end up having. Not to mention that it will 'break' every time a new pathway becomes available/common.

Can just add a line in the readme noting this linter is a dependency, and then the machine owner can install it in whatever way they prefer. Having that choice if probably preferred by a bunch of people who may have multiple package managers installed (e.g. if they have one main, and then at some point in the distant past had to install another for a very specific nuisance package, and that one-off gets auto-picked up by us first).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also not sure people would appreciate random sudo calls in our make file either.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I guess that's one way so we don't have to worry about the nastiness of building and maintaining every possible way to download a dependency. We could perhaps adopt the strategy that if it is not-a-go tool we just document it and not provide utility methods to install it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • will remove, unless someone else has a stronger opinion

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also in favour or removing it 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed, please re-review

Copy link

codecov bot commented Jan 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (958e471) 74.03% compared to head (eab81f7) 74.07%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2241      +/-   ##
===========================================
+ Coverage    74.03%   74.07%   +0.03%     
===========================================
  Files          256      256              
  Lines        25739    25739              
===========================================
+ Hits         19055    19064       +9     
+ Misses        5364     5357       -7     
+ Partials      1320     1318       -2     
Flag Coverage Δ
all-tests 74.07% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 958e471...eab81f7. Read the comment docs.

Copy link
Contributor

@AndrewSisley AndrewSisley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :) Thanks Shahzad

Copy link
Collaborator

@fredcarle fredcarle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@shahzadlone shahzadlone merged commit ed2285c into sourcenetwork:develop Jan 23, 2024
32 of 33 checks passed
@shahzadlone shahzadlone deleted the lone/yaml-lint branch January 23, 2024 20:43
shahzadlone added a commit that referenced this pull request Jan 23, 2024
## Relevant issue(s)
- Resolves #2245

## Description
- Basic YAML linter Action
- Fix all YAML linter errors
- PR title change when using the manual action to combine dependabot PRs
- Update default options of the combine action according to our common
usage

## How has this been tested?
- CI checks for this now

Specify the platform(s) on which this was tested:
- WSL (Manjaro)
nasdf pushed a commit to nasdf/defradb that referenced this pull request Jan 23, 2024
## Relevant issue(s)
- Resolves sourcenetwork#2245

## Description
- Basic YAML linter Action
- Fix all YAML linter errors
- PR title change when using the manual action to combine dependabot PRs
- Update default options of the combine action according to our common
usage

## How has this been tested?
- CI checks for this now

Specify the platform(s) on which this was tested:
- WSL (Manjaro)
nasdf pushed a commit to nasdf/defradb that referenced this pull request Jan 23, 2024
## Relevant issue(s)
- Resolves sourcenetwork#2245

## Description
- Basic YAML linter Action
- Fix all YAML linter errors
- PR title change when using the manual action to combine dependabot PRs
- Update default options of the combine action according to our common
usage

## How has this been tested?
- CI checks for this now

Specify the platform(s) on which this was tested:
- WSL (Manjaro)
shahzadlone added a commit to shahzadlone/defradb that referenced this pull request Feb 23, 2024
## Relevant issue(s)
- Resolves sourcenetwork#2245

## Description
- Basic YAML linter Action
- Fix all YAML linter errors
- PR title change when using the manual action to combine dependabot PRs
- Update default options of the combine action according to our common
usage

## How has this been tested?
- CI checks for this now

Specify the platform(s) on which this was tested:
- WSL (Manjaro)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/build This is issue is about the build or CI system, and the administration of it. code quality Related to improving code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a YAML linter
3 participants