From 31209d905a7c96d7a35b2719f92a84fcfa038012 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Sep 21 2017 14:47:53 +0000 Subject: Build the container locally, speeds things up quite a bit --- diff --git a/gc/tests.yml b/gc/tests.yml index 7e8d3f7..b85a0a3 100644 --- a/gc/tests.yml +++ b/gc/tests.yml @@ -7,7 +7,7 @@ artifacts: "{{ lookup('env', 'TEST_ARTIFACTS')|default('./artifacts', true) }}" tasks: - - name: Make directories we use + - name: Create /tmp/artifacts file: path={{ item }} state=directory owner=root mode=755 recurse=yes with_items: @@ -15,6 +15,17 @@ tags: - always + - name: Create the {{ artifacts }} directory locally + local_action: + module: file + args: path="{{ artifacts }}" + state=directory + owner=root + mode=755 + recurse=yes + tags: + - always + # Classic and container block, install and compile the test program - block: @@ -39,32 +50,60 @@ - classic - container - # Atomic specific block, build the test program in a container + # Atomic specific block, build the test program in a container (hosted locally) - block: - name: Get the OS version running - shell: grep VERSION_ID /etc/os-release | sed -e 's/VERSION_ID=//' + shell: grep VERSION_ID /etc/os-release | sed -e 's/VERSION_ID=//' register: os_rel + - name: Create /tmp/gc_test/ locally + local_action: + module: file + args: + path: /tmp/gc_test/ + state: directory + - name: Copy the Dockerfile and the test-gc.c file - copy: src={{ item }} dest="/tmp/artifacts" mode=0644 + local_action: copy src={{ item }} dest="/tmp/gc_test/" mode=0644 with_items: - Dockerfile - tst-gc.c - name: Update the Dockerfile to pull from fedora:{{ os_rel.stdout }} - shell: sed -i -e 's/FEDORA_VERSION/{{ os_rel.stdout}}/' Dockerfile + local_action: shell sed -i -e 's/FEDORA_VERSION/{{ os_rel.stdout}}/' Dockerfile args: - chdir: /tmp/artifacts + chdir: /tmp/gc_test + + - name: Make sure docker is started locally + local_action: + module: service + args: + name: docker + state: started - name: Build the container - shell: docker build -f /tmp/artifacts/Dockerfile . -t dockahbuild + local_action: shell docker build -f /tmp/gc_test/Dockerfile . -t dockahbuild args: - chdir: /tmp/artifacts + chdir: /tmp/gc_test - name: Run the container so we can get the binary - shell: docker run -v /tmp/artifacts:/code:Z dockahbuild + local_action: shell docker run -v /tmp/gc_test:/code:Z dockahbuild args: - chdir: /tmp/artifacts + chdir: /tmp/gc_test + + - name: Move the test files from the local host into the atomic host + synchronize: + src: /tmp/gc_test/ + dest: /tmp/artifacts/ + mode: push + ssh_args: "-o UserKnownHostsFile=/dev/null" + + - name: Move the files into the artifacts directory for safe keeping + local_action: + module: copy + args: + src="/tmp/gc_test/" + dest="{{ artifacts }}" tags: - atomic @@ -87,8 +126,8 @@ always: - name: Pull out the logs synchronize: - dest: "{{ artifacts }}" src: "/tmp/artifacts/./" + dest: "{{ artifacts }}" mode: pull