Comments (10)
@sivel Hola, I believe this issue was intended to be created in the core repo. I don't have permission to transfer the issue to https://github.com/ansible/ansible though. Could you please take a look and do the transfer or advise on where else it should go? Cheers!
from ansible.
Files identified in the description:
None
If these files are incorrect, please update the component name
section of the description or use the component bot command.
from ansible.
@svartoyg: Greetings! Thanks for taking the time to open this Issue. In order for the community to handle your Issue effectively, we need a bit more information.
Here are the items we could not find in your description:
- Summary
- Component Name
- Issue Type
Please set the description of this Issue with an appropriate template from:
https://github.com/ansible/ansible/tree/devel/.github/ISSUE_TEMPLATE
or
https://raw.githubusercontent.com/ansible/ansible/devel/.github/PULL_REQUEST_TEMPLATE.md
from ansible.
@sivel Hola, I believe this issue was intended to be created in the core repo. I don't have permission to transfer the issue to https://github.com/ansible/ansible though. Could you please take a look and do the transfer or advise on where else it should go? Cheers!
Sorry for posting the issue at the wrong spot. I don't know how to move it, but i could create a copy in the proper spot.
from ansible.
We've already moved the issue, but it is lacking information that we generally request. See the comment at #83288 (comment) for providing more info
from ansible.
You can fix immediately for all versions by changing the format to this:
collections:
- type: git
name: https://gitlab.some.doamain/foo/bar.git
version: test
This is a duplicate of #81687 and #78067. During the dep resolver rewrite the original implementation #69154 grew legs, such as being more lenient with requirement.yml formatting. Before #72591, a collection source
is a Galaxy server, not the collection itself (it would be ignored for type: git, and you'd get an error that the name foo.bar couldn't be cloned, unless the path foo.bar exists as a git repo). It's not in the changelog and I think it was unintended, so the behavior should be restored if possible (ideally, give a warning/error for unintended option combinations).
These combinations should be pointless
source
,version
with a collection in a tarfile or directory (there is no Galaxy server involved, and version is determined by the artifact)source
with a collection in a git repo (same reasoning) - version is allowed, but as a committish (for example, a semver version is wrong unless there's a tag or branch by that name) and has no bearing on the version which is installed which needs to be semver and is determined by the repo content at the committish.
Other than the committish caveat, version
and source
are only useful for type: galaxy
, to determine from which server and which release to install for a name
following the foo.bar
pattern.
I think this is a documentation issue also, see #75872 (welp, I helped propagate that pattern...). Much better would have been to use name
instead of source
. I think I glossed over it at the time because I figured if it 'worked', okay then (I was personally against the feature and not opinionated in how people would use it), and didn't consider that people would swap type: dir
for type: git
and expect that to also work, which was never intended.
from ansible.
That does the trick, indeed.
I guess adjusting the documentation for now would be a good thing. On the long run, i guess it would be better to revise the whole syntax for the requirements file, since some keys seem quite unintuitive (e.g. name
for the repository url).
Thank you, s-hertel!
from ansible.
I agree that as a whole it's not intuitive. It evolved over time and all new formats have been additive (I think just having one format would help with this problem). You can write it without using name
too:
collections:
# same syntax as used to install roles from a git repo, also the syntax to install without a requirements file
- git+https://gitlab.some.doamain/foo/bar.git,test
# could still use this for collections on a server
- name: amazon.aws
source: http://localhost:5000/api
from ansible.
These combinations should be pointless
source
,version
with a collection in a tarfile or directory (there is no Galaxy server involved, and version is determined by the artifact)source
with a collection in a git repo (same reasoning) - version is allowed, but as a committish (for example, a semver version is wrong unless there's a tag or branch by that name) and has no bearing on the version which is installed which needs to be semver and is determined by the repo content at the committish.Other than the committish caveat,
version
andsource
are only useful fortype: galaxy
, to determine from which server and which release to install for aname
following thefoo.bar
pattern.
Might misunderstand, but what do you mean with version
and source
is only useful for type: galaxy
?
The following works great:
---
collections:
- name: ansible.posix
version: 1.5.4
source: https://github.com/ansible-collections/ansible.posix.git
type: git
- name: community.crypto
version: 2.20.0
source: https://github.com/ansible-collections/community.crypto.git
type: git
- name: community.general
version: 9.0.0
source: https://github.com/ansible-collections/community.general.git
type: git
https://github.com/konstruktoid/ansible-role-hardening/blob/master/requirements.yml
from ansible.
Might misunderstand, but what do you mean with version and source is only useful for type: galaxy?
@konstruktoid That's the 'committish' behavior I described in the section quoted. See, they're tags https://github.com/ansible-collections/ansible.posix/releases/tag/1.5.4.
version
in the requirements file is not necessarily the installed version of the collection for the type
s: file
, url
, dir
, or subdirs
. The version is determined by the galaxy.yml
/MANIFEST.json
file in the collection itself. type: git
is a wrapper around type: dir
(or optionally type: subdirs
, which is a wrapper around type: dir
(s)).
The version: HEAD
could refer to all the versions at some point, or the same version even though the plugins are not the same, etc, how branches/tags and the galaxy.yml/MANIFEST.json are managed is completely up to the git repo.
The awesome thing about type: galaxy
is that version
can be a range, making useful dependency resolution happen for you when there are dependencies by the same name, and compatible upgrades can be installed without knowing which upgrades are available.
I would somewhat caution against type: git
(and type: subdirs
and type: dir
as these are all basically the same thing under the hood) for the non-developer scenario because it's less obfuscation to install a tarfile or git clone
/cp -r
directly when possible (if trying to avoid using a galaxy server, which is really missing out on the best ansible-galaxy
features imo). I pushed for the feature to install from git repos because I thought testing a PR against ansible, which was once a couple steps (checkout, test) might become a few for collections in some scenarios (checkout, build, install, test) and while it was initially rejected, it ended up getting accepted as a tool for collection development (same number of steps: build + install shortcut in one, test). It isn't a great replacement for installing from a server or tarfile, which is the well-trodden path, and there are a lot of things I want improved about the feature as it stands now (I often put together POCs, like devel...s-hertel:ansible:compare-type-dir-content), but the general feedback I get related to this feature is trepidation/disinterest so it has gone nowhere for a while. If you are interested, any feedback is helpful so it's not only my opinion. I would be happy to receive any related suggestions or discuss more in IRC or https://forum.ansible.com any time.
(@svartoyg sorry for the repeated tangents I've gone on to try to give context about how the feature got to this point, that are not super relevant to your very valid points about the UX)
from ansible.
Related Issues (20)
- Fallback to "editor" instead of "vi" when EDITOR environment variable is not set HOT 3
- Json key is not returned when using builtin uri module HOT 3
- ansible-test sanity fails when deprecating modules without version in galaxy.yml HOT 5
- ansible-test sanity: Ignore deprecating modules without version in galaxy.yml HOT 5
- If `ANSIBLE_VAULT_PASSWORD_FILE=""` it treats the current directory as the vault password file and tries to execute it HOT 8
- Add a possibility to control minimum TLS version in ansible.builtin.uri HOT 2
- add numa_nodes count to ansible facts HOT 8
- Ansible connection (ping) is stuck / hanging on debian 12 turnkey core 18.1-1 LXC (Proxmox) HOT 2
- ansible-vault integration test incorrectly testing non-writeable dir HOT 1
- apply/delegate_facts does not work with include_role nor include_tasks HOT 7
- yum disablerepo failed if repo not exist HOT 3
- openssl error : unable to get local issuer certificate HOT 2
- ansible-test validate-modules: argument spec from one module can bleed into the next one HOT 7
- variable templates are not substituted when using 'extract' filter HOT 5
- Using `import_tasks` within `include_tasks` within an `include_role` results in TypeError: NoneType HOT 3
- `rescue` handling of code `block` always called for ALL hosts if one or more fail in 2.17 (worked in 2.16) HOT 7
- fact_path deprecation warning leaves much unsaid HOT 9
- Silent mantissa truncation on FieldAttribute `int` coercion HOT 1
- Integration test suite revamp HOT 2
- to_nice_yaml corrupts multiline text with linebreaks HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible.