-
Notifications
You must be signed in to change notification settings - Fork 660
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
pre-commit 'ansible-lint' version set to '0.1.dev1' instead of specified version #2713
Comments
While I can confirm the bug I am not sure which project is the cause, linter, pre-commit or setuptools-scm. Doing a simple test with a shallow clone did get the desired result locally.
Still, I can confirm that when running from inside pre-commit, the result is different. |
I did look at the cloning logic of pre-commit tool which attempts to perform a shallow cloning first and only if this fails tries to make a full one. I manually repeating the steps and discovered that its operation does not pull any tags, so not surprise that any project using setuptools-scm would have wrong versioning: Test using pre-commit internal cloning strategygit init --template= ansible-lint
cd ansible-lint
git remote add origin https://github.com/ansible/ansible-lint
git -c protocol.version=2 fetch origin v6.8.7 --depth=1
git checkout FETCH_HEAD
git -c protocol.version=2 submodule update --init --recursive --depth=1
# done, now testing if we have any tags:
git tag --points-at HEAD
# ... ooops, no tag. Test using official git shallow cloning:git clone --depth=1 --branch v6.8.7 https://github.com/ansible/ansible-lint
cd ansible-lint
git tag --points-at HEAD
v6.8.7
# So it worked fine as tag is present! |
Fixes: ansible#2713 Fixes: ansible#2658 Related: pre-commit/pre-commit#2610
Fixes: #2713 Fixes: #2658 Related: pre-commit/pre-commit#2610
Summary
After attempting to use
ansible-lint
with pre-commit using the latest release ofv6.8.7
the resolvedansible-lint version via pre-commit is set to
0.1.dev1
. Attempted on several different environments(WSL, MacOS) that all result in the same issue.
Issue Type
Ansible and Ansible Lint details
OS / ENVIRONMENT
STEPS TO REPRODUCE
ansible-lint
repository.v6.8.7
pre-commit install
pre-commit run --all-files
Desired Behavior
I expect the
ansible-lint
version to be upgraded to the target specified versionindicated by the 'rev' field within the '.pre-commit-config.yaml' file. In the specific
case outlined for this ticket, the
ansible-lint
version should be set to6.8.7
instead of0.1.dev1
.Possible security bugs should be reported via email to
[email protected]
Actual Behavior
Please give some details of what is actually happening:
The expected version number for
ansible-lint
is not correctly set to6.8.7
, it is instead set to0.1.dev1
.Additional note:
v6.8.3
release and later.The text was updated successfully, but these errors were encountered: