Skip to content

Commit 8b5e98a

Browse files
authored
Merge pull request #56 from stackhpc/docker-rally-build
Support building docker-rally image in tempest playbook
2 parents 088ecd6 + 98e92aa commit 8b5e98a

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

ansible/kayobe-automation-run-tempest.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
rally_docker_registry: ghcr.io
1515
rally_docker_registry_username:
1616
rally_docker_registry_password:
17+
# Set to true to build the docker-rally image locally.
18+
docker_rally_build: false
19+
docker_rally_src_repo: https://github.com/stackhpc/docker-rally
20+
docker_rally_src_version: HEAD
1721
load_list_path_remote: "{{ results_path_remote.path }}/tempest-load-list"
1822
skip_list_path_remote: "{{ results_path_remote.path }}/tempest-skip-list"
1923
accounts_path_remote: "{{ results_path_remote.path }}/tempest-accounts"
@@ -52,13 +56,40 @@
5256
- rally_docker_registry_password is not none
5357
become: true
5458

55-
- name: Ensure rally image exists on runner
59+
- when: docker_rally_build | bool
60+
block:
61+
- name: Create temporary source directory
62+
ansible.builtin.tempfile:
63+
state: directory
64+
suffix: docker-rally
65+
register: src_path_remote
66+
67+
- name: Clone docker-rally repository
68+
git:
69+
depth: 1
70+
dest: "{{ src_path_remote.path }}"
71+
repo: "{{ docker_rally_src_repo }}"
72+
single_branch: true
73+
version: "{{ docker_rally_src_version }}"
74+
75+
- name: Ensure rally image exists on runner (build)
76+
docker_image:
77+
build:
78+
network: host
79+
path: "{{ src_path_remote.path }}"
80+
name: "{{ rally_image_full }}"
81+
state: present
82+
source: build
83+
become: true
84+
85+
- name: Ensure rally image exists on runner (pull)
5686
docker_image:
5787
name: "{{ rally_image_full }}"
5888
state: present
5989
force_source: "{{ rally_force_pull | bool }}"
6090
source: pull
6191
become: true
92+
when: not docker_rally_build | bool
6293

6394
- name: Copy tempest load list to remote host
6495
copy:
@@ -173,3 +204,9 @@
173204
path: "{{ cacert_path_remote.path }}"
174205
state: absent
175206
when: cacert_path_remote.path is defined
207+
208+
- name: cleanup source
209+
file:
210+
path: "{{ src_path_remote.path }}"
211+
state: absent
212+
when: src_path_remote.path is defined

0 commit comments

Comments
 (0)