Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

meta: require either src, name or role for each dependency entry #241

Merged
merged 1 commit into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions f/ansible-meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,23 @@
},
"DependencyModel": {
"additionalProperties": false,
"anyOf": [
{
"required": ["role"]
},
{
"required": ["src"]
},
{
"required": ["name"]
}
],
"markdownDescription": "See https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html#role-dependencies and https://github.com/ansible/ansible/blob/devel/lib/ansible/playbook/role/metadata.py#L79",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"role": {
"title": "Role",
"type": "string"
Expand Down Expand Up @@ -269,8 +285,7 @@
"type": "string"
}
},
"required": ["role"],
"title": "DependencyModel",
"title": "Dependency entry",
"type": "object"
},
"DevuanPlatformModel": {
Expand Down
12 changes: 12 additions & 0 deletions negative_test/roles/role_with_bad_deps_in_meta/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
galaxy_info:
description: bar
min_ansible_version: "2.9"
company: foo
license: MIT
platforms:
- name: Alpine
versions:
- all

dependencies:
- version: foo # invalid, should have at least name, role or src properties
33 changes: 33 additions & 0 deletions test/roles/foo/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
dependencies:
- name: ansible-role-foo
version: "1.0"
- name: ansible-role-bar
version: "1.0"
# from Bitbucket
- src: git+http://bitbucket.org/willthames/git-ansible-galaxy
version: v1.4

# from Bitbucket, alternative syntax and caveats
- src: http://bitbucket.org/willthames/hg-ansible-galaxy
scm: hg

# from galaxy
- src: community.molecule

# from GitHub
- src: https://github.com/bennojoy/nginx

# from GitHub, overriding the name and specifying a specific tag
- src: https://github.com/bennojoy/nginx
version: master
name: nginx_role

# from GitLab or other git-based scm
- src: [email protected]:my-group/my-repo.git
scm: git
version: "0.1" # quoted, so YAML doesn't parse this as a floating-point value

# from a web server, where the role is packaged in a tar.gz
- src: https://some.webserver.example.com/files/master.tar.gz
name: http-role

galaxy_info:
description: foo
min_ansible_version: "2.9"
Expand Down