mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-13 04:52:19 +00:00
SUMMARY
Fix charts ref on integration tests targets
ISSUE TYPE
Bugfix Pull Request
Reviewed-by: Yuriy Novostavskiy
Reviewed-by: Alina Buzachis
(cherry picked from commit 7559b65946)
Co-authored-by: Bikouo Aubin <79859644+abikouo@users.noreply.github.com>
This commit is contained in:
1
tests/integration/targets/setup_helm_registry/aliases
Normal file
1
tests/integration/targets/setup_helm_registry/aliases
Normal file
@@ -0,0 +1 @@
|
||||
disabled
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
# user: testuser, password: pass123!
|
||||
registry_credentials: testuser:$2y$05$d8tw6L1hojRFW.FjHOAnIOihJWAvFb0/Pu/30hLbQNJIYzCmlyBCi
|
||||
registry_name: helm_registry
|
||||
registry_port: 6035
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- name: Teardown registry
|
||||
include_tasks: teardown_registry.yml
|
||||
32
tests/integration/targets/setup_helm_registry/tasks/main.yml
Normal file
32
tests/integration/targets/setup_helm_registry/tasks/main.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
- name: Ensure we can talk to docker daemon
|
||||
ansible.builtin.shell:
|
||||
cmd: docker ps
|
||||
|
||||
- name: Create temporary directory to store file in
|
||||
tempfile:
|
||||
state: directory
|
||||
suffix: .helm_registry
|
||||
register: _tmpfile
|
||||
# notify:
|
||||
# - Teardown registry
|
||||
|
||||
- name: Create authentication file
|
||||
copy:
|
||||
content: "{{ registry_credentials }}"
|
||||
dest: "{{ _tmpfile.path }}/htpasswd"
|
||||
|
||||
- name: Remove existing registry
|
||||
ansible.builtin.include_tasks: remove_docker_container.yml
|
||||
|
||||
- name: Create registry container
|
||||
command: >-
|
||||
docker run -d
|
||||
-p {{ registry_port }}:5000
|
||||
--restart=always
|
||||
--name "{{ registry_name }}"
|
||||
-v "{{ _tmpfile.path }}:/auth"
|
||||
-e "REGISTRY_AUTH=htpasswd"
|
||||
-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm"
|
||||
-e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd
|
||||
registry:2
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
- name: Inspect docker container
|
||||
command: docker container inspect {{ registry_name }} -f '{{ '{{' }} .State.Running {{ '}}' }}'
|
||||
register: _inspect
|
||||
ignore_errors: true
|
||||
|
||||
- name: Remove container
|
||||
when: _inspect.rc == 0
|
||||
block:
|
||||
- name: Stop running container
|
||||
command: docker container stop {{ registry_name }}
|
||||
when: _inspect.stdout == "true"
|
||||
|
||||
- name: Remove container
|
||||
command: docker container rm {{ registry_name }}
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
- name: Remove Docker container
|
||||
ansible.builtin.include_tasks: remove_docker_container.yml
|
||||
|
||||
- name: Delete temporary directory
|
||||
file:
|
||||
state: absent
|
||||
path: '{{ _tmpfile.path }}'
|
||||
ignore_errors: true
|
||||
Reference in New Issue
Block a user