From 0b9fdccb8b3232fbc65f84c3aae25780f21f13b4 Mon Sep 17 00:00:00 2001 From: Sagi Shnaidman Date: Tue, 10 Aug 2021 14:49:14 +0300 Subject: [PATCH] Remove config of container_build_tool Because there is no docker supported anymore, remove all custom config of "container_build_tool", only "buildah" is supported. Change-Id: I57720cc1d7da96f9277b62298cabce9ff7765f47 --- README.rst | 14 -------------- defaults/main.yml | 1 - tasks/modify_image.yml | 11 ++++++----- tasks/precheck.yml | 5 ----- tasks/yum_install.yml | 1 - tasks/yum_update.yml | 1 - vars/main.yml | 3 --- 7 files changed, 6 insertions(+), 30 deletions(-) delete mode 100644 vars/main.yml diff --git a/README.rst b/README.rst index 3c212c0..84c6ab8 100644 --- a/README.rst +++ b/README.rst @@ -25,9 +25,6 @@ Role Variables * - `target_image` - `[undefined]` - If set, the modified image will be tagged with `target_image + modified_append_tag`. If `target_image` is not set, the modified image will be tagged with `source_image + modified_append_tag`. If the purpose of the image is not changing, it may be enough to rely on the `source_image + modified_append_tag` tag to identify that this is a modified version of the source image. - * - `container_build_tool` - - `buildah` - - Tool used to build containers, can be only 'buildah' .. list-table:: Variables used for yum update :widths: auto @@ -55,13 +52,10 @@ Role Variables * - `yum_repos_dir_path` - `None` - Optional path of directory to be used as `/etc/yum.repos.d` during the update - * - `container_build_tool` - - See modify image variables * - `yum_cache` - `None` - Optional path to the host directory for yum cache during the update. Requires an overlay-enabled FS that also supports SE context relabling. - Works only with container_build_tool=buildah. * - `force_purge_yum_cache` - `False` - Optional argument that tells buildah to forcefully re-populate the yum @@ -89,8 +83,6 @@ Role Variables * - `yum_repos_dir_path` - `None` - Optional path of directory to be used as `/etc/yum.repos.d` during the update - * - `container_build_tool` - - See modify image variables .. list-table:: Variables used for dev install @@ -109,8 +101,6 @@ Role Variables * - `target_image` - `''` - See modify image variables - * - `container_build_tool` - - See modify image variables * - `refspecs` - `[]` - An array of project/refspec pairs that will be installed into the generated container. Currently only supports python source projects. @@ -151,7 +141,6 @@ The following playbook will produce a modified image with the tag vars: source_image: docker.io/tripleomaster/centos-binary-nova-api:latest modify_dir_path: /path/to/example_modify_dir - container_build_tool: buildah The directory `example_modify_dir` contains the `Dockerfile` which will perform the modification, for example: @@ -192,7 +181,6 @@ In this playbook the tasks\_from is set as a variable instead of an source_image: docker.io/tripleomaster/centos-binary-nova-api:latest yum_repos_dir_path: /etc/yum.repos.d modified_append_tag: updated - container_build_tool: buildah yum_cache: /tmp/containers-updater/yum_cache rpms_path: /home/stack/rpms @@ -207,7 +195,6 @@ In this playbook the tasks\_from is set as a variable instead of an tasks_from: yum_update.yml source_image: docker.io/tripleomaster/centos-binary-nova-api:latest modified_append_tag: updated - container_build_tool: buildah rpms_path: /home/stack/rpms/ Note, if you have a locally installed gating repo, you can add @@ -235,7 +222,6 @@ a variable instead of an `import_role` parameter. source_image: docker.io/tripleomaster/centos-binary-nova-api:latest yum_repos_dir_path: /etc/yum.repos.d yum_packages: ['foobar-nova-plugin', 'fizzbuzz-nova-plugin'] - container_build_tool: buildah RPM install ~~~~~~~~~~~ diff --git a/defaults/main.yml b/defaults/main.yml index b587eea..a69b6a1 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,5 @@ --- update_repo: '' -container_build_tool: 'buildah' python_dir: [] refspecs: [] yum_packages: [] diff --git a/tasks/modify_image.yml b/tasks/modify_image.yml index 234cec9..4e5651b 100644 --- a/tasks/modify_image.yml +++ b/tasks/modify_image.yml @@ -34,11 +34,12 @@ line: "LABEL modified_append_tag={{ modified_append_tag }}" - name: Modify image from {{ modify_dir_path }} - command: | - {{ build_commands[container_build_tool] }} \ - --tag {{ target_image | default(source_image) }}{{ modified_append_tag }} \ - --file {{ dockerfile.path }} --network host ./ + command: >- + buildah bud + --format docker + --tag {{ target_image | default(source_image) }}{{ modified_append_tag }} + --file {{ dockerfile.path }} --network host ./ # FIXME: buildah should not required root commands to build an image - become: "{{ container_build_tool == 'buildah' }}" + become: true args: chdir: "{{ modify_dir_path }}" diff --git a/tasks/precheck.yml b/tasks/precheck.yml index 75a2eaf..7cea43d 100644 --- a/tasks/precheck.yml +++ b/tasks/precheck.yml @@ -5,11 +5,6 @@ - source_image is defined - source_image | length > 0 -- name: Ensure that container_build_tool is correctly set - fail: msg="{{ container_build_tool }} is not a valid value for - container_build_tool. Use 'buildah'." - when: container_build_tool != 'buildah' - - name: Set default modified_append_tag set_fact: modified_append_tag: "{{ lookup('pipe','date +-modified-%Y%m%d%H%M%S') }}" diff --git a/tasks/yum_install.yml b/tasks/yum_install.yml index 547e507..bc054b6 100644 --- a/tasks/yum_install.yml +++ b/tasks/yum_install.yml @@ -4,4 +4,3 @@ - always - import_tasks: yum_install_buildah.yml - when: container_build_tool == 'buildah' diff --git a/tasks/yum_update.yml b/tasks/yum_update.yml index 6fdfc36..ed92a6a 100644 --- a/tasks/yum_update.yml +++ b/tasks/yum_update.yml @@ -4,4 +4,3 @@ - always - import_tasks: yum_update_buildah.yml - when: container_build_tool == 'buildah' diff --git a/vars/main.yml b/vars/main.yml deleted file mode 100644 index 043446f..0000000 --- a/vars/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -build_commands: - buildah: buildah bud --format docker