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

Don't tag nightly pre-releases #1601

Open
varac opened this issue Dec 25, 2024 · 6 comments
Open

Don't tag nightly pre-releases #1601

varac opened this issue Dec 25, 2024 · 6 comments
Labels
question Further information is requested

Comments

@varac
Copy link

varac commented Dec 25, 2024

I'm using the lychee pre-commit hook.
pre-commit has a nifty autoupdate subcommand which updates all configured hooks to their latest git tags (which is considered by pre-commit as the latest stable release).
In the case of lychee, it will always update to the nightly git tag, which is not what I want. Could be maybe not use a nightly tag please ? If it always points to the main branch HEAD it's kind of useless anyway. It it's only needed for the GitHub nightly release maybe there's another way of shipping an automated nightly release without a dedicated (moving) git tag.
Thanks !

@mre
Copy link
Member

mre commented Jan 3, 2025

Hey @varac, thanks for bringing this up! While looking at this, I also noticed that our pre-commit-hooks.yml example has an outdated Docker image version (0.14 while we're at 0.18 now).

For pre-commit users, I believe the recommended approach would be to pin to specific versions in their config, like this:

- id: lychee
  name: lychee
  description: "Run 'lychee' for fast, async, stream-based link checking"
  entry: lychee
  language: system
  args: ["--no-progress"]
  types: [text]
  pass_filenames: true
  require_serial: true
  rev: "v0.18.0"  # Pin to a specific version

Or for Docker users:

- id: lychee-docker
  name: lychee
  description: "Run 'lychee' docker image for fast, async, stream-based link checking"
  entry: lycheeverse/lychee:0.18  # Updated to latest version
  language: docker_image
  args: ["--no-progress"]
  types: [text]
  pass_filenames: true
  require_serial: true

That said, I'm not an expert on pre-commit's best practices and might be overlooking important considerations. I'd appreciate any corrections or suggestions on how to better handle this!

For now, we use the nightly tag for our automated builds and Docker images. Would pinning versions in the pre-commit config work for your use case? Let me know what you think!

@mre mre added the question Further information is requested label Jan 3, 2025
@lwbt
Copy link

lwbt commented Jan 13, 2025

Hey @varac, thanks for bringing this up! While looking at this, I also noticed that our pre-commit-hooks.yml example has an outdated Docker image version (0.14 while we're at 0.18 now).

I'm not an expert either, but this might be a good example: https://github.com/koalaman/shellcheck-precommit/tree/master

I see that - id: lychee looks for a binary installed on the system:

lychee...................................................................Failed
- hook id: lychee
- exit code: 1

Executable `lychee` not found

From what I have seen so far, such hooks should end with the suffix -system e.g. - id: lychee-system.

Trying to follow the current instructions I cannot get it to work.

lychee...................................................................Failed
- hook id: lychee-docker
- exit code: 125

Error: short-name "lycheeverse/lychee:0.14" did not resolve to an alias and no unqualified-search registries are defined in "/etc/containers/registries.conf"

I know, the easiest way would be to download the binary myself, but that's against how I was taught by the pre-commit FAQ and other articles to use pre-commit.

As you can see from shellcheck, a popular program, providing one hook is good enough. If it works.

@varac
Copy link
Author

varac commented Jan 19, 2025

For pre-commit users, I believe the recommended approach would be to pin to specific versions in their config

That's the thing, I'd like to stick with pinned versions. But because of the nightly releases, pre-commit always updates the pinned version to rev: nightly. See here:

$ cat .pre-commit-config.yaml 
repos:
  - repo: https://github.com/lycheeverse/lychee.git
    rev: lychee-v0.18.0
    hooks:
      - id: lychee
        args: ["--config", "lychee.toml"]

$ pre-commit autoupdate
[https://github.com/lycheeverse/lychee.git] updating lychee-v0.18.0 -> nightly

$ cat .pre-commit-config.yaml 
repos:
  - repo: https://github.com/lycheeverse/lychee.git
    rev: nightly
    hooks:
      - id: lychee
        args: ["--config", "lychee.toml"]

Please note that all other pre-commit hooks I use are properly tagged, and upgrade fine to a pinned new version once there's a release.

@kemingy
Copy link
Contributor

kemingy commented Feb 12, 2025

The nightly release has to bind to a tag, so the action has to delete the old one and create a new one when there are updates in the repo.

I agree that pre-commit autoupdate updates to a pre-release is usually not what users want. Sadly, I suppose the pre-commit won't fix this according to the comments in:

Also, git command won't be able to get the "pre-release" info, unless checking the semver (if the repo follows).

So I guess the possible solution is finding another compatible 3rd tool to update the .pre-commit-config.yaml file. The one I know is preflight but it hasn't implemented the autoupdate feature. I have created a feature-request issue there.

@varac
Copy link
Author

varac commented Feb 15, 2025

@kemingy One idea how to fix this I also had: Could you please use semantic versioning ? Meaning, could you please remove the lychee- prefix in the release version ? This way pre-commit could determine the last version properly. I'll try once lychee has a proper versioned release. Thanks !

@mre
Copy link
Member

mre commented Feb 18, 2025

I could, but I'm not sure if it will be easy to do or fun. 😅 The problem is, that prefixes were added automatically once we switched to release-plz for releases. We had to fix the versioning in

  • Releases
  • Dockerfiles
  • Package managers

It wasn't pretty.
So, I'm not exactly motivated to undo that change at the moment. 😕

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants