From 94e0acf523e91321a582bc9b886cfdcd3385513f Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Tue, 16 Aug 2022 13:47:12 +0200 Subject: [PATCH] Add tests for build.args. (#457) --- .../integration/targets/docker_image/tasks/test.yml | 1 + .../targets/docker_image/tasks/tests/options.yml | 2 ++ .../targets/docker_image/templates/ArgsDockerfile | 12 ++++++++++++ 3 files changed, 15 insertions(+) create mode 100644 tests/integration/targets/docker_image/templates/ArgsDockerfile diff --git a/tests/integration/targets/docker_image/tasks/test.yml b/tests/integration/targets/docker_image/tasks/test.yml index 180f6b3f..2ce1e09d 100644 --- a/tests/integration/targets/docker_image/tasks/test.yml +++ b/tests/integration/targets/docker_image/tasks/test.yml @@ -20,6 +20,7 @@ src: '{{ item }}' dest: '{{ remote_tmp_dir }}/files/{{ item }}' loop: + - ArgsDockerfile - Dockerfile - EtcHostsDockerfile - MyDockerfile diff --git a/tests/integration/targets/docker_image/tasks/tests/options.yml b/tests/integration/targets/docker_image/tasks/tests/options.yml index 263f9524..6acc97bc 100644 --- a/tests/integration/targets/docker_image/tasks/tests/options.yml +++ b/tests/integration/targets/docker_image/tasks/tests/options.yml @@ -23,6 +23,7 @@ name: "{{ iname }}" build: path: "{{ remote_tmp_dir }}/files" + dockerfile: "ArgsDockerfile" args: TEST1: val1 TEST2: val2 @@ -37,6 +38,7 @@ name: "{{ iname }}" build: path: "{{ remote_tmp_dir }}/files" + dockerfile: "ArgsDockerfile" args: TEST1: val1 TEST2: val2 diff --git a/tests/integration/targets/docker_image/templates/ArgsDockerfile b/tests/integration/targets/docker_image/templates/ArgsDockerfile new file mode 100644 index 00000000..4414342c --- /dev/null +++ b/tests/integration/targets/docker_image/templates/ArgsDockerfile @@ -0,0 +1,12 @@ +# Copyright (c) Ansible Project +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + +ARG TEST1 +ARG TEST2 +ARG TEST3 + +FROM {{ docker_test_image_busybox }} +ENV foo /bar +WORKDIR ${foo} +RUN echo "${TEST1} - ${TEST2} - ${TEST3}"