ansible-builder build failed

862 views
Skip to first unread message

Andrea Lenarduzzi

unread,
May 1, 2021, 2:55:28 AM5/1/21
to AWX Project
Hi, I'm tryng to build a custom image, this is my erro:
ansible-builder build --tag quay.io/andreaussi/my_first_ee_image:latest  --context ./context --container-runtime docker
Running command:
  docker build -f ./context/Dockerfile -t quay.io/andreaussi/my_first_ee_image:latest ./context
Running command:
  docker run --rm -v /home/alenarduzzi/ansible-builder02/builder/lib/python3.7/site-packages/ansible_builder:/ansible_builder_mount:Z quay.io/andreaussi/my_first_ee_image:latest python3 /ansible_builder_mount/introspect.py
Running command:
  docker build -f ./context/Dockerfile -t quay.io/andreaussi/my_first_ee_image:latest ./context
...showing last 20 lines of output...
 ---> dd015ca158ce
Step 19/23 : RUN mkdir -p /var/run/receptor
 ---> Using cache
 ---> 9dde3af74a23
Step 20/23 : ADD run.sh /run.sh
 ---> Using cache
 ---> fcdbb401c232
Step 21/23 : CMD /run.sh
 ---> Using cache
 ---> 881da2c2b828
Step 22/23 : USER 1000
 ---> Using cache
 ---> f31f0262eabf
Step 23/23 : RUN git lfs install
 ---> Running in 367e3cf8cd5f
git: 'lfs' is not a git command. See 'git --help'.

How can I fix it?
Thank you
--
Le informazioni, i dati e le notizie contenute nella presente comunicazione e i relativi allegati sono di natura privata e come tali possono essere riservate e sono, comunque, destinate esclusivamente ai destinatari indicati in epigrafe. La diffusione, distribuzione e/o la copiatura del documento trasmesso da parte di qualsiasi soggetto diverso dal destinatario è proibita, sia ai sensi dell'art. 616 c.p., sia ai sensi del D.Lgs. n. 196/2003. Se avete ricevuto questo messaggio per errore, vi preghiamo di distruggerlo e di darcene immediata comunicazione anche inviando un messaggio di ritorno all'indirizzo e-mail del mittente.

This e-mail (including attachments) is intended only for the recipient(s) named above. It may contain confidential or privileged information and should not be read, copied or otherwise used by any other person. If you are not the named recipient, please contact (specificare l'e-mail dell'azienda) and delete the e-mail from your system. Rif. D.L. 196/2003.

Wei-Yen Tan

unread,
May 1, 2021, 4:03:48 AM5/1/21
to Andrea Lenarduzzi, AWX Project
If I am not mistaken it is git-lfs? 


From: awx-p...@googlegroups.com <awx-p...@googlegroups.com> on behalf of Andrea Lenarduzzi <andre...@gmail.com>
Sent: Saturday, May 1, 2021 7:00:27 PM
To: AWX Project <awx-p...@googlegroups.com>
Subject: [awx-project] ansible-builder build failed
 
--
You received this message because you are subscribed to the Google Groups "AWX Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to awx-project...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/awx-project/CABKy_H73B_Q7sMw_ZcOVaMrTYH4OWwnpDtvk2Vq7NcLk82z9ug%40mail.gmail.com.

Andrea Lenarduzzi

unread,
May 1, 2021, 7:16:59 AM5/1/21
to Wei-Yen Tan, AWX Project
Yes, git-lfs is installed

Wei-Yen Tan

unread,
May 1, 2021, 7:19:16 AM5/1/21
to Andrea Lenarduzzi, AWX Project
So why is it referring to hit: lfs instead of git-lfs. I would check your execution environment . yml to check it is set correctly 


From: Andrea Lenarduzzi <andre...@gmail.com>
Sent: Saturday, May 1, 2021 11:16:45 PM
To: Wei-Yen Tan <weiye...@gmail.com>
Cc: AWX Project <awx-p...@googlegroups.com>
Subject: Re: [awx-project] ansible-builder build failed
 

Andrea Lenarduzzi

unread,
May 1, 2021, 7:34:33 AM5/1/21
to Wei-Yen Tan, AWX Project
This is execution-environment.yml
---
version: 1
dependencies:
  galaxy: requirements.yml
  python: requirements.txt
  system: bindep.txt
additional_build_steps:
  append:
    - RUN alternatives --set python /usr/bin/python3
    - COPY --from=quay.io/project-receptor/receptor:0.9.7 /usr/bin/receptor /usr/bin/receptor
    - RUN mkdir -p /var/run/receptor
    - ADD run.sh /run.sh
    - CMD /run.sh
    - USER 1000
    - RUN git lfs install

bindep.txt
python3.8-dev [platform:dpkg compile]
subversion [platform:dpkg]
subversion [platform:dpkg]
git-core [platform:dpkg]
git-lfs [platform:dpkg]

Andrea Lenarduzzi

unread,
May 2, 2021, 4:49:36 AM5/2/21
to Wei-Yen Tan, AWX Project
Are these config files wrong?

Wei-Yen Tan

unread,
May 2, 2021, 4:56:39 AM5/2/21
to Andrea Lenarduzzi, AWX Project
I wrote a blog post yesterday about my journey with this and the issues that I found. 


In my post I notice I have this :

git-lfs [platform:rpm]


You have dpkg. 


From: Andrea Lenarduzzi <andre...@gmail.com>
Sent: Sunday, May 2, 2021 8:49:19 PM

Andrea Lenarduzzi

unread,
May 2, 2021, 5:03:27 AM5/2/21
to Wei-Yen Tan, AWX Project
Good blog, thank you

I've dpkg because all my vm os are debian based.
If this parameter are os indipendent, i can try to chango to rpm

Wei-Yen Tan

unread,
May 2, 2021, 5:08:07 AM5/2/21
to Andrea Lenarduzzi, AWX Project
It has no bearing. The image of awx is going to rhel regardless. Once it is in the docker image it is irrelevant whether your host vm's are debian or ubuntu or opensuse .  ansible runner  is in a image. For Ansible runner it looks like they are running redhat. Keep the bindep.txt to the include that for now and see what happens. 


From: Andrea Lenarduzzi <andre...@gmail.com>
Sent: Sunday, May 2, 2021 9:03:16 PM

Andrea Lenarduzzi

unread,
May 3, 2021, 2:17:41 AM5/3/21
to Wei-Yen Tan, AWX Project
Hi I've used this bindep.txt
python38-devel [platform:rpm compile]
subversion [platform:rpm]
subversion [platform:dpkg]
git-lfs [platform:rpm]

Than I've edited context/Dockerfile and added RUN pip3 uninstall --yes ansible-runner && pip3 install ansible-runner==2.0.0a1

building image OK but running I've error:
Traceback (most recent call last): File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 1397, in run res = receptor_job.run() File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 2957, in run return self._run_internal(receptor_ctl) File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 3008, in _run_internal raise RuntimeError(detail) RuntimeError: Pod Running

Wei-Yen Tan

unread,
May 3, 2021, 2:25:35 AM5/3/21
to Andrea Lenarduzzi, AWX Project
Can you please give the entire container file? This is the exact error I had and by following the example given it solved it


From: Andrea Lenarduzzi <andre...@gmail.com>
Sent: Monday, May 3, 2021 6:22:41 PM

Andrea Lenarduzzi

unread,
May 3, 2021, 4:05:26 AM5/3/21
to Wei-Yen Tan, AWX Project
These are my files:
cat execution-environment.yml
---
version: 1
dependencies:
  galaxy: requirements.yml
  python: requirements.txt
  system: bindep.txt
additional_build_steps:
  append:
    - RUN alternatives --set python /usr/bin/python3
    - COPY --from=quay.io/project-receptor/receptor:0.9.7 /usr/bin/receptor /usr/bin/receptor
    - RUN mkdir -p /var/run/receptor
    - ADD run.sh /run.sh
    - CMD /run.sh
    - USER 1000
    - RUN git lfs install


cat requirements.yml
---
collections:
  - name: awx.awx
  - name: azure.azcollection
  - name: theforeman.foreman
  - name: community.kubernetes  # required for isolated management playbooks
  - name: ansible.posix  # required for isolated management playbooks
  - name: community.routeros
  - name: fortinet.fortimanager
  - name: fortinet.fortios
  - name: cisco.ios
  - name: cisco.iosxr
  - name: cisco.ucs
  - name: ansible.netcommon
  - name: community.docker
  - name: community.fortios
  - name: community.mysql
  - name: community.network
  - name: community.postgresql
  - name: community.routeros
  - name: community.windows
  - name: community.zabbix
  - name: netbox.netbox

cat bindep.txt

python38-devel [platform:rpm compile]
subversion [platform:rpm]
subversion [platform:dpkg]
git-lfs [platform:rpm]

cat context/Dockerfile
ARG ANSIBLE_RUNNER_IMAGE=quay.io/ansible/ansible-runner:devel
ARG PYTHON_BUILDER_IMAGE=quay.io/ansible/python-builder:latest

FROM $ANSIBLE_RUNNER_IMAGE as galaxy

RUN pip3 uninstall --yes ansible-runner && pip3 install ansible-runner==2.0.0a1
ARG ANSIBLE_GALAXY_CLI_COLLECTION_OPTS=
ADD _build /build

WORKDIR /build
RUN ansible-galaxy role install -r requirements.yml --roles-path /usr/share/ansible/roles
RUN ansible-galaxy collection install $ANSIBLE_GALAXY_CLI_COLLECTION_OPTS -r requirements.yml --collections-path /usr/share/ansible/collections

FROM $PYTHON_BUILDER_IMAGE as builder
ADD _build/requirements_combined.txt /tmp/src/requirements.txt
ADD _build/bindep_combined.txt /tmp/src/bindep.txt
RUN assemble

FROM $ANSIBLE_RUNNER_IMAGE

COPY --from=galaxy /usr/share/ansible /usr/share/ansible

COPY --from=builder /output/ /output/
RUN /output/install-from-bindep && rm -rf /output/wheels

RUN alternatives --set python /usr/bin/python3
COPY --from=quay.io/project-receptor/receptor:0.9.7 /usr/bin/receptor /usr/bin/receptor
RUN mkdir -p /var/run/receptor
ADD run.sh /run.sh
CMD /run.sh
USER 1000
RUN git lfs install

Wei-Yen Tan

unread,
May 3, 2021, 11:24:42 AM5/3/21
to Andrea Lenarduzzi, AWX Project
OK which file did you use? 


From: Andrea Lenarduzzi <andre...@gmail.com>
Sent: Monday, May 3, 2021 8:10:25 PM

Andrea Lenarduzzi

unread,
May 3, 2021, 11:54:45 AM5/3/21
to Wei-Yen Tan, AWX Project
I'm tryng to run this:
---
- name: Windows 10 OS Verison
  hosts: "{{ target }}"
  tasks:
   - name: Ask Windows version
     win_shell: Get-ComputerInfo -Property "WindowsVersion"
     register: windows_version

   - name: Print Windows host information
     debug:
       msg: "{{ windows_version }}"

Wei-Yen Tan

unread,
May 3, 2021, 11:56:29 AM5/3/21
to Andrea Lenarduzzi, AWX Project
No I mean did you run ansible builder or did you run dockerfile. And if was the latter which directory did you run it from? 


From: Andrea Lenarduzzi <andre...@gmail.com>
Sent: Tuesday, May 4, 2021 3:59:46 AM

Wei-Yen Tan

unread,
May 3, 2021, 11:57:08 AM5/3/21
to Andrea Lenarduzzi, AWX Project
What were the steps you ran to get your image 


From: Wei-Yen Tan <weiye...@gmail.com>
Sent: Tuesday, May 4, 2021 3:56:22 AM
To: Andrea Lenarduzzi <andre...@gmail.com>

Andrea Lenarduzzi

unread,
May 3, 2021, 12:05:51 PM5/3/21
to Wei-Yen Tan, AWX Project
I've added this(see attached image)
Schermata da 2021-05-03 18-09-00.png

Wei-Yen Tan

unread,
May 3, 2021, 12:07:34 PM5/3/21
to Andrea Lenarduzzi, AWX Project
Understood. So which file did you use to push your image. The one in context or the one ansible builder did? 


From: Andrea Lenarduzzi <andre...@gmail.com>
Sent: Tuesday, May 4, 2021 4:10:50 AM

Andrea Lenarduzzi

unread,
May 3, 2021, 12:20:17 PM5/3/21
to Wei-Yen Tan, AWX Project
I've execute this:

Wei-Yen Tan

unread,
May 3, 2021, 12:21:29 PM5/3/21
to Andrea Lenarduzzi, AWX Project
In which directory? 


From: Andrea Lenarduzzi <andre...@gmail.com>
Sent: Tuesday, May 4, 2021 4:25:17 AM

Wei-Yen Tan

unread,
May 3, 2021, 12:21:54 PM5/3/21
to Andrea Lenarduzzi, AWX Project
The one where you amended the file? 


From: Wei-Yen Tan <weiye...@gmail.com>
Sent: Tuesday, May 4, 2021 4:21:20 AM

Andrea Lenarduzzi

unread,
May 3, 2021, 12:24:15 PM5/3/21
to Wei-Yen Tan, AWX Project
yes

Next step is build a clear env in ~/ansible-builder03

remove old images ecc ecc

Andrea Lenarduzzi

unread,
May 4, 2021, 6:54:37 AM5/4/21
to Wei-Yen Tan, AWX Project
Same error on clean env :(

Andrea Lenarduzzi

unread,
May 5, 2021, 2:32:38 AM5/5/21
to Wei-Yen Tan, AWX Project
Can you use my same quay.io EE(it's public) to test in you AWX?

Thank you

Wei-Yen Tan

unread,
May 5, 2021, 2:33:54 AM5/5/21
to Andrea Lenarduzzi, AWX Project
Sure. I'll take a look. 


From: Andrea Lenarduzzi <andre...@gmail.com>
Sent: Wednesday, May 5, 2021 6:37:38 PM

Wei-Yen Tan

unread,
May 6, 2021, 11:09:08 AM5/6/21
to Andrea Lenarduzzi, AWX Project
Tested. Same issue that I had.


When you built the image .... from ansible-builder....did you go into context directory and run the docker build from that?

Andrea Lenarduzzi

unread,
May 6, 2021, 11:18:57 AM5/6/21
to Wei-Yen Tan, AWX Project
Then:
mkdir ~/ansible-builderXX && cd ~/ansible-builderXX
python3 -m venv builder
source builder/bin/activate

Edit execution-environment.yml - requirements.yml - requirements.txt - bindep.txt - context/run.sh

ansible-builder build --tag quay.io/xxxxxxxxx/my_first_ee_image  --context ./context --container-runtime docker FROM ~/ansible-builderXX

Edit context/Dockerfile
ADD RUN pip3 uninstall --yes ansible-runner && pip3 install ansible-runner==2.0.0a1

docker build -f ./context/Dockerfile -t quay.io/xxxxx/my_first_ee_image ./context


All right?

Wei-Yen Tan

unread,
May 6, 2021, 11:24:24 AM5/6/21
to Andrea Lenarduzzi, AWX Project
I also made run.sh execute chmod +x run.sh 
Thats essentially it

Wei-Yen Tan

unread,
May 6, 2021, 11:28:35 AM5/6/21
to Andrea Lenarduzzi, AWX Project
also there is ansible-runner:2.0.0.1b? Along those lines. Update to that. 

Andrea Lenarduzzi

unread,
May 7, 2021, 5:14:07 AM5/7/21
to Wei-Yen Tan, AWX Project
There isn't ansible-runner:2.0.0.1b

Wei-Yen Tan

unread,
May 7, 2021, 9:47:17 AM5/7/21
to Andrea Lenarduzzi, AWX Project

From: Andrea Lenarduzzi <andre...@gmail.com>
Sent: Friday, May 7, 2021 9:13:51 PM

Andrea Lenarduzzi

unread,
May 7, 2021, 10:33:23 AM5/7/21
to Wei-Yen Tan, AWX Project
Yes, I've used 2.0.0a2
Same error

I'm desperate

Andrea Lenarduzzi

unread,
May 7, 2021, 12:23:17 PM5/7/21
to Wei-Yen Tan, AWX Project
Ooooook 
Now after 19.1.0 upgrade works fine!!!!!
A suggestion please:
Is it better 1 EE with all collections or 4/5 EE with specific, then less, collections?

Thank you
Regards

Wei-Yen Tan

unread,
May 7, 2021, 12:24:39 PM5/7/21
to Andrea Lenarduzzi, AWX Project
Great. Is the size much smaller 


From: Andrea Lenarduzzi <andre...@gmail.com>
Sent: Saturday, May 8, 2021 4:23:01 AM
Reply all
Reply to author
Forward
0 new messages