Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ee_bulder: build_files not implemented #132

Open
erichyde opened this issue Sep 20, 2023 · 3 comments
Open

ee_bulder: build_files not implemented #132

erichyde opened this issue Sep 20, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@erichyde
Copy link

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

  • Bug Report

Ansible, Collection, Docker/Podman details

> ansible --version
ansible [core 2.15.0]
  config file = /home/myuser/ee-builder/ansible.cfg
  configured module search path = ['/home/myuser/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/myuser/venv/ee-builder/lib/python3.10/site-packages/ansible
  ansible collection location = /home/myuser/ee-builder/collections
  executable location = /home/myuser/venv/ee-builder/bin/ansible
  python version = 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] (/home/myuser/venv/ee-builder/bin/python3)
  jinja version = 3.1.2
  libyaml = True


> ansible-galaxy collection list

# /home/myuser/ee-builder/collections/ansible_collections
Collection         Version
------------------ -------
containers.podman  1.10.3 
infra.ee_utilities 3.1.2  

> podman --version
podman version 4.6.2
  • ansible installation method: one of source, pip, OS package, EE
    Ansible installed with pip:
    ansible-builder==3.0.0
    ansible-core==2.15.0

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:

  • playbook / task
  • configuration file / list
  • error

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: - __execution_environment_definition.build_files is defined - __execution_environment_definition.build_files|length

@erichyde erichyde added bug Something isn't working new labels Sep 20, 2023
@djdanielsson
Copy link
Contributor

@sean-m-sullivan any thoughts?

@sean-m-sullivan
Copy link
Contributor

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.

@sean-m-sullivan
Copy link
Contributor

adding an option in the PR above that should fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants