-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-collection.yml
150 lines (125 loc) · 5.97 KB
/
build-collection.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
---
- import_playbook: community.fqcn_migration.fqcn_migration
vars:
project_git_url: https://github.com/kubevirt/kubevirt.core.git
upstream_name: core
upstream_namespace: kubevirt
downstream_name: openshift_virtualization
downstream_namespace: redhat
plugin_replacement_strict: True
galaxy:
documentation: https://docs.openshift.com/container-platform/latest/virt/about_virt/about-virt.html
homepage: https://www.redhat.com/en/technologies/cloud-computing/openshift/virtualization
description: Lean Ansible bindings for OpenShift Virtualization
post_processors_replacements:
- match: 'Lean Ansible bindings for KubeVirt'
replace: 'Lean Ansible bindings for OpenShift Virtualization'
file: 'README.md$'
- match: 'redhat-redhat.openshift_virtualization-\*.tar.gz'
replace: 'kubevirt-core-*.tar.gz'
file: 'README.md$'
- match: '`redhat`'
replace: '`kubevirt`'
file: 'README.md$'
- match: 'redhat_vm'
replace: 'kubevirt_vm'
file: 'README.md$'
- match: 'redhat_vm_info'
replace: 'kubevirt_vm_info'
file: 'CHANGELOG.rst$|README.md$'
- match: 'KubeVirt Collection for Ansible'
replace: 'OpenShift Virtualization Collection for Ansible'
file: 'CHANGELOG.rst$'
- match: 'kubernetes\.openshift_virtualization'
replace: 'kubernetes.core'
file: 'requirements.yml$'
downstream_placeholder_delete:
- build_status
downstream_placeholder_content:
- placeholder: requires_ansible
content: |
## Ansible and Python version compatibility
This collection has been tested against Ansible versions **>=2.14,<=2.17** and Python versions **>=3.9,<=3.12**.
See the [Ansible core support matrix](https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix) for supported combinations.
- placeholder: galaxy_download
content: |
### Installing the Collection from Ansible Galaxy
Before using the collection, you need to setup Ansible Automation Hub as galaxy server; then install it with the Ansible Galaxy command-line tool:
```bash
ansible-galaxy collection install redhat.openshift_virtualization
```
- placeholder: collection_dependencies
content: |
#### Ansible collections
* [kubernetes.core](https://console.redhat.com/ansible/automation-hub/repo/published/kubernetes/core)>=3.1.0,<6.0.0
To install all the dependencies, you need to setup Ansible Automation Hub as galaxy server; then install them with:
```bash
ansible-galaxy collection install -r requirements.yml
```
- placeholder: community_readme
content: |
## Providing feedback and reporting issues
If you encounter any issues with this collection please go to the [Red Hat Customer Portal](https://access.redhat.com/support/cases/#/case/new/get-support?caseCreate=true) and open a support case.
Additionally, to report an issue or to improve this collection, you can also log in to your [Red Hat Jira account](https://issues.redhat.com) and submit a [Jira issue](https://issues.redhat.com/secure/CreateIssueDetails!init.jspa?pid=12323181&issuetype=1&components=12364490&priority=10200&summary=[redhat.openshift_virtualization]&customfield_12316142).
## Testing
The collection includes unit and integration tests. The integration tests require a working cluster.
### Running tests
To run tests the `ansible-test` tool is required. See [Testing Ansible and Collections](https://docs.ansible.com/ansible/latest/dev_guide/testing_running_locally.html#testing-ansible-and-collections)
on how to run the collection's tests.
- connection: local
gather_facts: false
hosts: localhost
tasks:
- name: Fix changelog line
ansible.builtin.lineinfile:
path: "{{ downstream_project}}/docs/CHANGELOG.md"
regexp: '^- Add redhat\\_vm\\_info'
line: '- Add kubevirt\_vm\_info module to describe existing VirtualMachines'
- name: Find test file to migrate to downstream collection
ansible.builtin.find:
path: "downstream/openshift_virtualization/tests"
patterns: '*.py,*.sh,*.yml,*.yaml,*.j2'
recurse: true
register: find_test
- name: Migrate tests to use downstream collection
ansible.builtin.replace:
path: "{{ item.path }}"
regexp: 'kubevirt\.core\.(\w+)'
replace: 'redhat.openshift_virtualization.\1'
loop: "{{ find_test.files }}"
- name: Remove unwanted files from downstream collection
ansible.builtin.file:
path: "{{ downstream_project}}/{{ item }}"
state: absent
loop:
- CONTRIBUTING.md
- docs/CONTRIBUTING.md
- docs/developing.md
- name: Set content of downstream testing.md
ansible.builtin.copy:
dest: "{{ downstream_project }}/docs/testing.md"
content: |
# Testing
## Sanity and unit tests
Sanity and unit tests can be run with `ansible-test`.
### Running tests with ansible-test
Run sanity tests with `ansible-test` like so:
```
ANSIBLE_TEST_PREFER_PODMAN=1 ansible-test sanity --docker
```
Run unit tests with `ansible-test` like so:
```
ANSIBLE_TEST_PREFER_PODMAN=1 ansible-test units --docker
```
## Integration tests
Integration tests require a working cluster and can be run with
`ansible-test`.
### Running integration tests with ansible-test
Run integration tests with `ansible-test` like so:
```
ansible-test integration
```
- name: Rebuild downstream collection
ansible.builtin.command: ansible-galaxy collection build --force .
args:
chdir: "{{ downstream_project }}"