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

Use renovate with dart #4533

Merged
merged 9 commits into from
Jan 21, 2025
Merged

Use renovate with dart #4533

merged 9 commits into from
Jan 21, 2025

Conversation

bdovaz
Copy link
Collaborator

@bdovaz bdovaz commented Jan 19, 2025

In this case, it had a really old fixed version

@bdovaz
Copy link
Collaborator Author

bdovaz commented Jan 19, 2025

/build

@@ -68,7 +68,8 @@ linters:
## stable dart sdk: https://dart.dev/get-dart#release-channels
## install alpine-pkg-glibc (glibc compatibility layer package for Alpine Linux)
dockerfile:
- ARG DART_VERSION='2.8.4'
# renovate: datasource=dart
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's two required fields in that regex.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So what do I have to put depName=dart?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I took this https://docs.renovatebot.com/presets-customManagers/#custommanagersdockerfileversions, and adapted it to allow changing our descriptor files too. Plus adapted our build scripts to keep the comment together with the arg when writing dockerfiles

More understandable docs:
https://docs.renovatebot.com/modules/manager/regex/

Copy link
Collaborator

Choose a reason for hiding this comment

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

Renovate handles a lot of things, formats, sources, etc. But at some point, it needs to know where to look, and what to look for. In a custom manager, it can't know where to look, unlike if it was a npm package.json, it would look in the npm registry.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@echoix as far as I understand the correct datasource is: https://docs.renovatebot.com/modules/datasource/dart-version/

And looking at this example we can use depName=dart as I said: renovatebot/renovate#26761 (reply in thread)

Copy link
Contributor

github-actions bot commented Jan 19, 2025

🦙 MegaLinter status: ⚠️ WARNING

Descriptor Linter Files Fixed Errors Elapsed time
✅ API spectral 1 0 1.49s
⚠️ BASH bash-exec 6 1 0.03s
✅ BASH shellcheck 6 0 0.23s
✅ BASH shfmt 6 0 0 0.9s
✅ COPYPASTE jscpd yes no 3.73s
✅ DOCKERFILE hadolint 129 0 25.3s
✅ JSON jsonlint 20 0 0.22s
✅ JSON v8r 22 0 13.99s
⚠️ MARKDOWN markdownlint 267 0 303 22.81s
✅ MARKDOWN markdown-table-formatter 267 0 0 158.27s
⚠️ PYTHON bandit 215 66 3.04s
✅ PYTHON black 215 0 0 5.09s
✅ PYTHON flake8 215 0 1.92s
✅ PYTHON isort 215 0 0 1.36s
✅ PYTHON mypy 215 0 16.52s
✅ PYTHON pylint 215 0 33.95s
✅ PYTHON ruff 215 0 0 0.69s
✅ REPOSITORY checkov yes no 35.25s
✅ REPOSITORY git_diff yes no 0.81s
⚠️ REPOSITORY grype yes 26 14.04s
✅ REPOSITORY secretlint yes no 12.36s
✅ REPOSITORY trivy yes no 15.55s
✅ REPOSITORY trivy-sbom yes no 0.29s
⚠️ REPOSITORY trufflehog yes 1 53.54s
✅ SPELL cspell 718 0 12.46s
⚠️ SPELL lychee 349 23 6.45s
✅ XML xmllint 3 0 0 1.17s
✅ YAML prettier 160 0 0 3.91s
✅ YAML v8r 102 0 29.53s
✅ YAML yamllint 161 0 3.17s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

Comment on lines 71 to 72
# renovate: datasource=dart-version depName=dart
- ARG DART_VERSION='3.6.1'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems only like a comment in the descriptor, not copied over to the Dockerfiles

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

@echoix
Copy link
Collaborator

echoix commented Jan 19, 2025

/build

Command run output
Build command workflow started.
Installing dependencies
Running script ./build.sh
Build command workflow completed updating files.

@echoix
Copy link
Collaborator

echoix commented Jan 20, 2025

Version of dartanalyzer doesn't seem properly captured.

Also:

Fatal error while calling dartanalyzer: [Errno 2] No such file or directory: 'dartanalyzer'

Did the binary name change since the last very old version?

@bdovaz
Copy link
Collaborator Author

bdovaz commented Jan 20, 2025

Version of dartanalyzer doesn't seem properly captured.

Also:

Fatal error while calling dartanalyzer: [Errno 2] No such file or directory: 'dartanalyzer'

Did the binary name change since the last very old version?

It seems that, in fact, it no longer exists:

image

EDIT: It seems to be done this way now: https://dart.dev/tools/dart-analyze

@nvuillam to be able to run it as “dart analyze” is there any parameter of the descriptor that allows it? It's to avoid creating a class in python just for that.

@bdovaz
Copy link
Collaborator Author

bdovaz commented Jan 21, 2025

Ready @nvuillam!

In the end it took me more work because of the jump from 2.x to 3.x.

@bdovaz
Copy link
Collaborator Author

bdovaz commented Jan 21, 2025

I have taken the opportunity to change urls and make it work to get the version of the linter

@nvuillam nvuillam merged commit a2c9646 into main Jan 21, 2025
130 checks passed
@nvuillam nvuillam deleted the dart-renovate branch January 21, 2025 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants