Skip to content

Commit

Permalink
Fix ci issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zhan9san committed Mar 14, 2023
1 parent bbaf82e commit fe5cc12
Show file tree
Hide file tree
Showing 26 changed files with 53 additions and 49 deletions.
2 changes: 2 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
exclude_paths:
- .cache/ # implicit unless exclude_paths is defined in config
- .github/
- requirements.yml
- src/**/cookiecutter/{{*
# - src/molecule_gce/cookiecutter/{{cookiecutter.molecule_directory}}

skip_list:
# Temporary skips made during migration
- args[module]
- fqcn-builtins
- yaml[line-length]
- var-spacing
Expand Down
6 changes: 3 additions & 3 deletions molecule/test-podman/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
- name: Verify
hosts: all
tasks:
- name: Example assertion
ansible.builtin.assert:
that: true
- name: Example assertion
ansible.builtin.assert:
that: true
21 changes: 14 additions & 7 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
---
collections:
- name: ansible.posix # docker
version: ">=1.4.0"
- name: google.cloud
- name: community.aws
- name: community.docker
version: ">=3.0.2"
- name: containers.podman

- name: https://github.com/ansible-collections/ansible.posix
type: git
- name: https://github.com/ansible-collections/amazon.aws
type: git
- name: https://github.com/ansible-collections/community.aws
type: git
- name: https://github.com/ansible-collections/community.docker
type: git
- name: https://github.com/ansible-collections/google.cloud
type: git
- name: https://github.com/containers/ansible-podman-collections
type: git
4 changes: 2 additions & 2 deletions src/molecule_plugins/docker/playbooks/validate-dockerfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
ansible.builtin.template:
src: Dockerfile.j2
dest: "{{ temp_dockerfiles.results[index].path }}"
mode: 0600
mode: "0600"
register: result
with_items: "{{ platforms }}"
loop_control:
Expand Down Expand Up @@ -59,7 +59,7 @@
ansible.builtin.file:
path: "{{ item }}"
state: absent
mode: 0600
mode: "0600"
loop: "{{ temp_dockerfiles.results | map(attribute='path') | list }}"

- name: Display results
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
- name: create ssh keypair
- name: Create ssh keypair
community.crypto.openssh_keypair:
comment: "{{ lookup('env','USER') }} user for Molecule"
path: "{{ ssh_identity_file }}"
register: keypair

- name: create molecule Linux instance(s)
- name: Create molecule Linux instance(s)
google.cloud.gcp_compute_instance:
state: present
name: "{{ item.name }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: create molecule Windows instance(s)
- name: Create molecule Windows instance(s)
google.cloud.gcp_compute_instance:
state: present
name: "{{ item.name }}"
Expand Down
1 change: 0 additions & 1 deletion src/molecule_plugins/podman/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ def sanity_checks(self):
# fully adopts ansible-compat
runtime = Runtime()
if runtime.version < Version("2.10.0"):

if runtime.config.ansible_pipelining:
sysexit_with_message(
"Podman connections do not work with Ansible "
Expand Down
2 changes: 2 additions & 0 deletions src/molecule_plugins/podman/playbooks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
- item.registry is defined
- item.registry.credentials is defined
- item.registry.credentials.username is defined
changed_when: false

- name: Check presence of custom Dockerfiles
ansible.builtin.stat:
Expand Down Expand Up @@ -97,6 +98,7 @@
retries: 3
delay: 30
no_log: false
changed_when: false

- name: Determine the CMD directives
ansible.builtin.set_fact:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
hosts: localhost
connection: local
gather_facts: false
collections:
- containers.podman
vars:
platforms:
# platforms supported as being managed by molecule/ansible, this does
Expand All @@ -30,7 +28,7 @@
ansible.builtin.template:
src: Dockerfile.j2
dest: "{{ temp_image_dirs.results[index].path }}/Dockerfile"
mode: 0600
mode: "0600"
register: result
with_items: "{{ platforms }}"
loop_control:
Expand Down
1 change: 0 additions & 1 deletion src/molecule_plugins/vagrant/modules/vagrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,6 @@ def _get_vagrant(self):
return v

def _get_instance_vagrant_config_dict(self, instance):

checksum = instance.get("box_download_checksum")
checksum_type = instance.get("box_download_checksum_type")
if bool(checksum) ^ bool(checksum_type):
Expand Down
2 changes: 1 addition & 1 deletion src/molecule_plugins/vagrant/playbooks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@
ansible.builtin.copy:
content: "{{ instance_conf | to_json | from_json | to_yaml }}"
dest: "{{ molecule_instance_config }}"
mode: 0600
mode: "0600"
2 changes: 1 addition & 1 deletion src/molecule_plugins/vagrant/playbooks/destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
# Molecule managed
{{ instance_conf | to_json | from_json | to_yaml }}
dest: "{{ molecule_instance_config }}"
mode: 0600
mode: "0600"
when: server.changed | bool
1 change: 0 additions & 1 deletion test/docker/test_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def test_command_init_and_test_scenario(tmp_path: pathlib.Path, DRIVER: str) ->
scenario_name = "default"

with change_dir_to(tmp_path):

scenario_directory = tmp_path / "molecule" / scenario_name
cmd = [
"molecule",
Expand Down
6 changes: 3 additions & 3 deletions test/gce/scenarios/linux/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
molecule_yml.driver.instance_os_type | lower == "windows"
fail_msg: "instance_os_type is possible only to specify linux or windows either"

- name: get network info
- name: Get network info
google.cloud.gcp_compute_network_info:
filters:
- name = "{{ molecule_yml.driver.network_name | default('default') }}"
Expand All @@ -26,7 +26,7 @@
auth_kind: "{{ molecule_yml.driver.auth_kind | default(omit, true) }}"
register: my_network

- name: get subnetwork info
- name: Get subnetwork info
google.cloud.gcp_compute_subnetwork_info:
filters:
- name = "{{ molecule_yml.driver.subnetwork_name | default('default') }}"
Expand All @@ -37,7 +37,7 @@
auth_kind: "{{ molecule_yml.driver.auth_kind | default(omit, true) }}"
register: my_subnetwork

- name: set external access config
- name: Set external access config
set_fact:
external_access_config:
- access_configs:
Expand Down
2 changes: 1 addition & 1 deletion test/gce/scenarios/linux/requirements.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
collections:
- name: google.cloud
source: https://galaxy.ansible.com
source: https://github.com/ansible-collections/google.cloud
6 changes: 3 additions & 3 deletions test/gce/scenarios/linux/tasks/create_linux_instance.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
- name: create ssh keypair
openssh_keypair:
- name: Create ssh keypair
community.crypto.openssh_keypair:
comment: "{{ lookup('env','USER') }} user for Molecule"
path: "{{ ssh_identity_file }}"
register: keypair

- name: create molecule Linux instance(s)
- name: Create molecule Linux instance(s)
google.cloud.gcp_compute_instance:
state: present
name: "{{ item.name }}"
Expand Down
2 changes: 1 addition & 1 deletion test/gce/scenarios/linux/tasks/create_windows_instance.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: create molecule Windows instance(s)
- name: Create molecule Windows instance(s)
google.cloud.gcp_compute_instance:
state: present
name: "{{ item.name }}"
Expand Down
6 changes: 3 additions & 3 deletions test/gce/scenarios/linux/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
hosts: all
gather_facts: false
tasks:
- name: Example assertion
assert:
that: true
- name: Example assertion
assert:
that: true
6 changes: 3 additions & 3 deletions test/gce/scenarios/windows/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
molecule_yml.driver.instance_os_type | lower == "windows"
fail_msg: "instance_os_type is possible only to specify linux or windows either"

- name: get network info
- name: Get network info
google.cloud.gcp_compute_network_info:
filters:
- name = "{{ molecule_yml.driver.network_name | default('default') }}"
Expand All @@ -26,7 +26,7 @@
auth_kind: "{{ molecule_yml.driver.auth_kind | default(omit, true) }}"
register: my_network

- name: get subnetwork info
- name: Get subnetwork info
google.cloud.gcp_compute_subnetwork_info:
filters:
- name = "{{ molecule_yml.driver.subnetwork_name | default('default') }}"
Expand All @@ -37,7 +37,7 @@
auth_kind: "{{ molecule_yml.driver.auth_kind | default(omit, true) }}"
register: my_subnetwork

- name: set external access config
- name: Set external access config
set_fact:
external_access_config:
- access_configs:
Expand Down
6 changes: 3 additions & 3 deletions test/gce/scenarios/windows/tasks/create_linux_instance.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
- name: create ssh keypair
openssh_keypair:
- name: Create ssh keypair
community.crypto.openssh_keypair:
comment: "{{ lookup('env','USER') }} user for Molecule"
path: "{{ ssh_identity_file }}"
register: keypair

- name: create molecule Linux instance(s)
- name: Create molecule Linux instance(s)
google.cloud.gcp_compute_instance:
state: present
name: "{{ item.name }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: create molecule Windows instance(s)
- name: Create molecule Windows instance(s)
google.cloud.gcp_compute_instance:
state: present
name: "{{ item.name }}"
Expand Down
6 changes: 3 additions & 3 deletions test/gce/scenarios/windows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
hosts: all
gather_facts: false
tasks:
- name: Example assertion
assert:
that: true
- name: Example assertion
assert:
that: true
3 changes: 0 additions & 3 deletions test/vagrant/functional/test_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def test_command_init_scenario(temp_dir):
not is_vagrant_supported(), reason="vagrant not supported on this machine"
)
def test_invalid_settings(temp_dir):

scenario_directory = os.path.join(
os.path.dirname(util.abs_path(__file__)), os.path.pardir, "scenarios"
)
Expand Down Expand Up @@ -111,7 +110,6 @@ def test_invalid_settings(temp_dir):
],
)
def test_vagrant_root(temp_dir, scenario):

scenario_directory = os.path.join(
os.path.dirname(util.abs_path(__file__)), os.path.pardir, "scenarios"
)
Expand All @@ -126,7 +124,6 @@ def test_vagrant_root(temp_dir, scenario):
not is_vagrant_supported(), reason="vagrant not supported on this machine"
)
def test_multi_node(temp_dir):

scenario_directory = os.path.join(
os.path.dirname(util.abs_path(__file__)), os.path.pardir, "scenarios"
)
Expand Down
2 changes: 1 addition & 1 deletion test/vagrant/scenarios/molecule/default-compat/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@
ansible.builtin.copy:
content: "{{ instance_conf | to_json | from_json | to_yaml }}"
dest: "{{ molecule_instance_config }}"
mode: 0600
mode: "0600"
2 changes: 1 addition & 1 deletion test/vagrant/scenarios/molecule/default-compat/destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@
# Molecule managed
{{ instance_conf | to_json | from_json | to_yaml }}
dest: "{{ molecule_instance_config }}"
mode: 0600
mode: ":0600"
when: server.changed | bool
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ extras =
deps =
py-{devel}: git+https://github.com/ansible-community/molecule.git@main#egg=molecule[test]
commands =
ansible-galaxy install -n -r requirements.yml
pytest --collect-only
pytest --color=yes {tty:-s}
setenv =
Expand Down

0 comments on commit fe5cc12

Please sign in to comment.