Skip to content

Commit

Permalink
Merge branch 'main' into bug/update_docker_collection
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Jun 18, 2024
2 parents 6ebc825 + 9943538 commit ce977d7
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ docker = [
"requests" # also required by docker
]
ec2 = []
gce = []
gce = [
"requests >= 2.31.0",
"google-auth >= 2.28.2",
]
podman = [
]
selinux = [
Expand Down
2 changes: 2 additions & 0 deletions src/molecule_plugins/docker/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ class Docker(Driver):
restart_retries: 1
buildargs:
http_proxy: http://proxy.example.com:8080/
cache_from:
- registry.example.com/example/example:main
If specifying the `CMD`_ directive in your ``Dockerfile.j2`` or consuming a
built image which declares a ``CMD`` directive, then you must set
Expand Down
13 changes: 13 additions & 0 deletions src/molecule_plugins/docker/playbooks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
key_path: "{{ item.key_path | default((lookup('env', 'DOCKER_CERT_PATH') + '/key.pem') if lookup('env', 'DOCKER_CERT_PATH') else omit) }}"
tls_verify: "{{ item.tls_verify | default(lookup('env', 'DOCKER_TLS_VERIFY')) or false }}"
with_items: "{{ molecule_yml.platforms }}"
loop_control:
label: "{{ item.registry.url | default(item.name) }}"
when:
- item.registry is defined
- item.registry.url is defined and item.registry.url
Expand All @@ -38,6 +40,8 @@
ansible.builtin.stat:
path: "{{ molecule_scenario_directory + '/' + (item.dockerfile | default('Dockerfile.j2')) }}"
loop: "{{ molecule_yml.platforms }}"
loop_control:
label: "{{ item.name }}"
register: dockerfile_stats

- name: Create Dockerfiles from image names
Expand All @@ -52,6 +56,7 @@
mode: "0600"
loop: "{{ molecule_yml.platforms }}"
loop_control:
label: "{{ item.name }}"
index_var: i
when: not item.pre_build_image | default(false)
register: platforms
Expand All @@ -68,6 +73,7 @@
- "--exclude=molecule.yml"
loop: "{{ molecule_yml.platforms }}"
loop_control:
label: "{{ item.name }}"
index_var: i
when: not item.pre_build_image | default(false)
delegate_to: localhost
Expand All @@ -81,6 +87,8 @@
key_path: "{{ item.key_path | default((lookup('env', 'DOCKER_CERT_PATH') + '/key.pem') if lookup('env', 'DOCKER_CERT_PATH') else omit) }}"
tls_verify: "{{ item.tls_verify | default(lookup('env', 'DOCKER_TLS_VERIFY')) or false }}"
with_items: "{{ platforms.results }}"
loop_control:
label: "{{ item.item.docker_host | default(lookup('env', 'DOCKER_HOST') or 'unix://var/run/docker.sock') }}"
when:
- not item.pre_build_image | default(false)
register: docker_images
Expand All @@ -104,6 +112,7 @@
network: "{{ item.item.network_mode | default(omit) }}"
args: "{{ item.item.buildargs | default(omit) }}"
platform: "{{ item.item.platform | default(omit) }}"
cache_from: "{{ item.item.cache_from | default(omit) }}"
name: "molecule_local/{{ item.item.image }}"
docker_host: "{{ item.item.docker_host | default(lookup('env', 'DOCKER_HOST') or 'unix://var/run/docker.sock') }}"
cacert_path: "{{ item.cacert_path | default((lookup('env', 'DOCKER_CERT_PATH') + '/ca.pem') if lookup('env', 'DOCKER_CERT_PATH') else omit) }}"
Expand All @@ -128,6 +137,8 @@
combine({item.name: item.command | default('bash -c "while true; do sleep 10000; done"')})
}}
with_items: "{{ molecule_yml.platforms }}"
loop_control:
label: "{{ item.name }}"
when: item.override_command | default(true)

- name: Create molecule instance(s)
Expand Down Expand Up @@ -199,3 +210,5 @@
until: docker_jobs.finished
retries: 300
with_items: "{{ server.results }}"
loop_control:
label: "{{ item.item.name }}"
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@
type: rsa
size: 2048
regenerate: never
backend: cryptography
private_key_format: pkcs1
loop: "{{ platforms }}"
loop_control:
label: "{{ item.name }}"
Expand Down
1 change: 1 addition & 0 deletions src/molecule_plugins/podman/playbooks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
{% if item.item.pull is defined %}--pull={{ item.item.pull }}{% endif %}
file: "{{ item.dest }}"
name: "molecule_local/{{ item.item.image }}"
executable: "{{ podman_exec }}"
path: "{{ molecule_scenario_directory }}"
pull: "{{ item.item.pull | default(omit) }}"
loop: "{{ platforms.results }}"
Expand Down

0 comments on commit ce977d7

Please sign in to comment.