Comments (5)
In most cases it should be comparable or faster than 1.x, so I'm curious as well... I'd guess something's going on with your build cache or package management, because we actually reduced several redundant package installation steps from 1.x. Can you share your EE definition?
from ansible-builder.
Keep in mind that processing of ARG
and RUN
commands is performed by the container system (docker or podman), and not builder itself. Builder is mostly a front end to building the instruction file that will be fed to either the podman build
or docker build
command.
from ansible-builder.
Yeah, if even basic no-op things like ARG
have a noticeable delay, I'd suspect there's a problem with your container runtime's storage driver (common issues: antivirus, building to a network FS, using a storage driver that assumes cheap snapshots with a FS that doesn't, busted build cache). Obviously building from scratch can take a little longer than 1.x did if you're installing Python/core/runner, since those were previously baked into our base images. You can make your own base image for your EEs so you don't have to do that on every build if that's a problem, but the build cache usually makes that moot anyway, unless you're doing things that drastically change the early stages as you iterate.
from ansible-builder.
... as a data point, the following EE def builds for me via ansible-builder build
in:
- 55s with no layers/images cached
- 4.2s on repeated cached builds with no changes
- 33s when adding a new collection to a cached build
(ansible-builder 3.0.0, Fedora 38, podman 4.7.0):
version: 3
images:
base_image:
# completely vanilla image, works with most anything RHELish (Fedora, CentOS Stream)
name: registry.access.redhat.com/ubi9/ubi:latest
dependencies:
# install and use a bleeding-edge Python!
python_interpreter:
# (optional) provide the name of an OS package to install
package_system: python3.11
# (optional) provide the path of the Python interpreter to use for everything else.
# defaults to /usr/bin/python3; we'll do some sanity checking with this later...
python_path: /usr/bin/python3.11
ansible_core:
# anything valid to `pip install` - a git ref, whatever
package_pip: ansible-core<2.16
ansible_runner:
package_pip: ansible-runner
galaxy:
collections:
- ansible.utils
from ansible-builder.
thanks for your answers.
Here the exec env I use:
---
version: 3
build_arg_defaults:
ANSIBLE_GALAXY_CLI_COLLECTION_OPTS: '--pre -c'
dependencies:
ansible_core:
package_pip: ansible-core==2.15.4
ansible_runner:
package_pip: ansible-runner==2.3.4
galaxy: requirements.yml
python: requirements.txt
system: bindep.txt
python_interpreter:
package_system: "python311"
python_path: "/usr/bin/python3.11"
images:
base_image:
name: automationhub.tld/ansible-automation-platform-24/ee-minimal-rhel9:latest
# Custom package manager path for the RHEL based images
options:
package_manager_path: /usr/bin/microdnf
additional_build_files:
- src: ansible.cfg
dest: configs
- src: ubi9.repo
dest: configs
- src: pip.conf
dest: configs
- src: rootCA.crt
dest: configs
additional_build_steps:
prepend_base:
- RUN rm -rf /etc/yum.repos.d/*
- COPY _build/configs/ubi9.repo /etc/yum.repos.d/ubi9.repo
- COPY _build/configs/pip.conf /etc/pip.conf
- COPY _build/configs/rootCA.crt /etc/pki/ca-trust/source/anchors/rootCA.crt
- RUN update-ca-trust
# enable SHA1 in rhel9 & gcc & python3-devel
- RUN $PKGMGR install -y crypto-policies-scripts gcc python3.11-devel
#- RUN update-crypto-policies --set DEFAULT:SHA1
prepend_galaxy:
- COPY _build/configs/ansible.cfg /etc/ansible/ansible.cfg
- ENV ANSIBLE_GALAXY_SERVER_AUTOMATION_HUB_URL=https://s01vl9989234.fr.net.intra
append_base:
- RUN alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 0
- RUN $PKGMGR install -y crypto-policies-scripts gcc python3.11-devel
- RUN update-crypto-policies --set DEFAULT:SHA1
prepend_final: |
RUN whoami
RUN cat /etc/os-release
append_final:
- RUN echo This is a post-install command!
We use this for different EE creations.
the requirements.* files never have more than a couple of deps and collections. This is not what makes the difference.
To illustrate the change, which occurred 3 weeks ago, we were building in 4 to 13mns with ansible-builder v1 (but the Container file was pre-generated and a podman build cmd was used.)
Now with v3, using the same CI, but using a single cmd ansible-builder build -t name:tag -v3
13mns is the fastest build we have, and that's when we rebuild a successfully built image, i.e. only using cache.
A new or partly new image build takes from 30 to 50 mns.
BTW
- we have to use ANSIBLE_GALAXY_CLI_COLLECTION_OPTS: '--pre -c' because or rootCA.crt doesn't seem to be taken into account
- we have issues using
update-crypto-policies --set DEFAULT:SHA1
to deactivate the ban on SHA1 on RHEL9
I think both issues must stem from the fact that prepend_base
actions are run "in a builder image", I suppose, that is not the finally delivered image.
If I'm guessing alright, I should put those directives somewhere else, but I'm unsure where since the ContainerFile is hidden when using the ansible-builder build cmd. Maybe the doc could make clearer what is happening.
from ansible-builder.
Related Issues (20)
- find/use git, it is required to continue with installing HOT 3
- rockylinux 9 base image: no dnf? 🤔 HOT 3
- unable to build awx-ee image fails on galaxy requirements HOT 5
- Update link to EE getting started guide HOT 3
- EE fails when using debian or ubuntu base image HOT 1
- Pluggable abstraction of base image interactions and support scripts HOT 1
- unexpected error when getting available versions of collection... community.general HOT 6
- Support recent versions of setuptools HOT 1
- Error when building an EE without requirements.yml HOT 2
- requirements-parser breaks on 3.12+ default venvs HOT 3
- ansible-builder version 3 has broken compatibility with schema version 1 HOT 1
- Modifying ssh config of EE HOT 1
- Adding Galaxy requirements from private Git instance HOT 1
- Container Policy Fails on Schema Version 3
- Concerning mutil arch builds HOT 1
- v3 prepend_builder adds command after "pip install" HOT 1
- ERROR! Unexpected Exception, this is probably a bug: '/api/v3/plugin/ansible/content/published/collections/index/community/general/versions/' HOT 9
- Equivalent to podman build --pull? HOT 2
- Add support for pip specifier syntax like `pywinrm[credssp]==0.4.3` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-builder.