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

feat: support running vale locally #22130

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mdelapenya
Copy link
Member

@mdelapenya mdelapenya commented Feb 28, 2025

  • chore: add a make goal to run the validations
  • feat: add a make goal to run vale locally

Description

This PR adds two Make goals:

  • make vale, which runs vale as a container using the official Vale Docker image.
  • make validate, which runs docker buildx bake validate

The first one allows contributors to detect grammar errors while working on their changes, and the second is an alias for the build command.

The intention here is to enhance the local development experience when contributing to the docs, not having to wait for the CI to understand the vale errors, but instead making it possible to run it locally.

Reviews

  • Technical review
  • Editorial review
  • Product review

@github-actions github-actions bot added area/contrib Relates to the Docker style guide and contribution guidelines area/config labels Feb 28, 2025
Copy link

netlify bot commented Feb 28, 2025

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit bce89cf
🔍 Latest deploy log https://app.netlify.com/sites/docsdocker/deploys/67d01792d314e10008ea5a6f
😎 Deploy Preview https://deploy-preview-22130--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@aevesdocker aevesdocker requested review from a team, thaJeztah and crazy-max February 28, 2025 11:38
@craig-osterhout
Copy link
Contributor

Would it make sense to implement this just as bake, or reimplement everything else as make? I mean, why even have bake if make is better, or vice versa?

Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

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

Can we move to another PR the change related to new validate make goal? Doesn't relate to "feat: support running vale locally" and we should not enumerate unrelated change requests in the same PR tbh.

* main: (42 commits)
  Update image source for kafbat
  Add missing release note to Docker Desktop release notes (docker#22218)
  Update build-summary.md
  feedback link fix: (docker#22212)
  some clarification on additional_contexts (docker#22204)
  Update windows-install.md (docker#22184)
  sso: add callout to certificate instructions (docker#22193)
  chore: cleanup includes w/ embedded shortcodes (docker#22191)
  fix: rendering issue w/ experimental labs include (docker#22190)
  billing: improve docs for manual payment retries (docker#22181)
  build: fix intro of distributed build section (docker#22189)
  dd-cli-cicd-fix (docker#22187)
  Update release note for 4.39 (docker#22188)
  Change directory after pulling a sample Docker application (docker#22179)
  Merge pull request docker#22117 from aevesdocker/ENGDOCS-2451
  fix: troubleshooting toc fix (docker#22166)
  Add security section to 4.39.0 release notes (docker#22178)
  Merge pull request docker#22175 from aevesdocker/ENGDOCS-2470
  Merge pull request docker#22160 from sarahsanders-docker/tcc-minutes
  hub: add troubleshooting (docker#22157)
  ...
@mdelapenya mdelapenya requested a review from crazy-max March 11, 2025 10:59
Comment on lines +6 to +14
# Docker image to use for vale.
VALE_IMAGE := jdkato/vale:latest

.PHONY: vale
vale: ## run vale
docker run --rm -v $(PWD):/docs \
-w /docs \
-e PIP_BREAK_SYSTEM_PACKAGES=1 \
$(VALE_IMAGE) $(CONTENT_DIR)
Copy link
Member

Choose a reason for hiding this comment

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

I was wondering if we could have it running within our Dockerfile so it could be used with bake like lint:

  • docs/docker-bake.hcl

    Lines 48 to 52 in 9623874

    target "lint" {
    target = "lint"
    output = ["type=cacheonly"]
    provenance = false
    }
  • docs/Dockerfile

    Lines 53 to 60 in 9623874

    # lint lints markdown files
    FROM davidanson/markdownlint-cli2:v0.14.0 AS lint
    USER root
    RUN --mount=type=bind,target=. \
    /usr/local/bin/markdownlint-cli2 \
    "content/**/*.md" \
    "#content/manuals/engine/release-notes/*.md" \
    "#content/manuals/desktop/previous-versions/*.md"

Then we could just add a vale bake target to validate group?

docs/docker-bake.hcl

Lines 38 to 40 in 9623874

group "validate" {
targets = ["lint", "test", "unused-media", "test-go-redirects", "dockerfile-lint", "path-warnings"]
}

And would probably be able to remove this ci job

vale:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: errata-ai/vale-action@reviewdog
env:
PIP_BREAK_SYSTEM_PACKAGES: 1
with:
files: content

And just add vale to this matrix

target:
- lint
- test
- unused-media
- test-go-redirects
- dockerfile-lint
- path-warnings
so we have a good sandbox that work both on ci and locally?

Copy link
Member Author

@mdelapenya mdelapenya Mar 11, 2025

Choose a reason for hiding this comment

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

I still need to create a foundational knowledge on bake, but it seems reasonable to include the target as part of the current build system. I'd go with what you suggest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config area/contrib Relates to the Docker style guide and contribution guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants