Closed erichyde closed 5 months ago
@sean-m-sullivan any thoughts?
I just tested this to make sure it worked like I wrote it.
build_files:
- src: /home/user/controller_configuration/changelogs/fragments/checkmode.yml
dest: configs
build_steps:
prepend_final:
- ADD _build/configs/checkmode.yml /etc/ansible/checkmode.yml
If you give the absolute address it copies it, the problem I am seeing is when you have relative paths, the source will change and even the destination will change.
I tried this
- name: Install, configure, and start Apache
block:
- name: Create a context directory if it does not exist
ansible.builtin.file:
path: '{{ ee_builder_dir | default(build_dir.path) }}/context/'
state: directory
mode: '0755'
- name: copy additional_build_files
ansible.builtin.copy:
src: '{{ item.src }}'
dest: '{{ ee_builder_dir | default(build_dir.path) }}/context/{{ item.dest }}'
mode: '0655'
loop: '{{ __execution_environment_definition.build_files }}'
when:
- __execution_environment_definition.build_files is defined
- __execution_environment_definition.build_files|length
and it led me into a special level of frustration as the src/dest of ansible-builder doesn't work 1:1 with the ansible.builtin.copy.
I do think that documentation needs to be added on the using the absolute path, and if we could figure it out add this in. But right now taking a break from trying to figure it out.
adding an option in the PR above that should fix this.
Summary
Attempting to use the Execution Environment definition build_files to copy additional_build_files to the build context directory, doesn't work. After searching this collection, I can see the build_files variable is templated out to execution_environment.yml file, but the actual files are never copied into the build context. It's like this step was missed.
Issue Type
Ansible, Collection, Docker/Podman details
OS / ENVIRONMENT
Ubuntu 22.04.3 LTS, Running in WSL 2 on Windows 10
Desired Behavior
build_files should be copied into ee_builder_dir/context folder
Actual Behavior
There is no code to copy build_files to ee_builder_dir/context folder
Please give some details of what is actually happening. Include a [minimum complete verifiable example] with:
Something like this could be added to ee_builder/tasks/00_build_ee.yml:
`- name: copy additional_build_files ansible.builtin.copy: src: '{{ item.src }}' dest: '{{ ee_builder_dir | default(build_dir.path) }}/context/{{ item.dest }}' mode: '0655' loop: '{{ __execution_environment_definition.build_files }}' when: