ansible-bender | ansible-playbook + buildah = a sweet container image | Continuous Deployment library
kandi X-RAY | ansible-bender Summary
kandi X-RAY | ansible-bender Summary
ansible-playbook + buildah = a sweet container image
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Commit an image
- Run a command
- Get buildah version
- Return the id of an image
- Runs the tool
- Build a new build
- Try to split a string
- Return the build and metadata for the build
- Create a Build from a dictionary
- Create an instance from a dictionary
- Create a layer from a JSON representation
- Configure a logger
- Update the configuration from a dictionary
- Push build to target
- Push build to target
- Check if an image exists
- Wrapper for v2
- Run a pod command
- Get log lines for a build
- Wrapper for buildah
- Checks if the buildah command exists
- Check if podman command exists
- Runs the task start
- Create a dummy container
- Pull buildah image
- Check if git command exists
ansible-bender Key Features
ansible-bender Examples and Code Snippets
Community Discussions
Trending Discussions on ansible-bender
QUESTION
I am working on a CI/CD pipeline which uses a containerised environment.
- On my laptop, everything thing is run within a centos container which contains all of my tools, while the code and configuration reside on a shared volume.
- Most of that shared volume gets pushed up to master when I submit.
- But, for example, I exclude any python binaries from the virtual environment.
- That same container is used as my "base" container in Gitlab to execute some of my runner stages in order to
- execute static lint testing of both the code and the ansible config
- build the final product as a new image with ansible-bender
In order to distinguish the environments, I use a basic shell in the entrypoint.sh
which is executed when the container comes up and in that shell, I used an environment variable which is managed by Gitlab: CI_JOB_STAGE
. But the shell script doesn't seem to perform in the same way when I run the container locally as opposed to on the runner. Which is crazy, because that the whole point of containers isn't it?
- it's unclear at what point Gitlab mounts the share between the runner host and the container
- conditions testing the value
CI_JOB_STAGE
don't seem to work even though the values are shown when it printed out with andecho
- for some reason the entrypoint is executed both before AND after the stage executes
I am attaching gists for
- the entrypoint.sh script
- the output when the container is run locally
- in this case, it see that the virtual env already exist by check for the existence of the activate binary, so that environment is simply activated
- it then checks for the flask binary to see if it needs to install requirements
- i know it's primitive, but this is just POC
- the output for the first stage of the runner
- based on the shell script, it should not install the requirements because that is part of the stage commands anyway
- I don't believe it actually does do so, because it goes by too quickly, but the message indicates that it went through the condition
if [[ $CI_JOB_STAGE -eq "locally" ]] && ! test -f "./env/bin/flask"
- if the stage is local (false: we clearly see that stage is
lint_code
) - AND
- flask is not present (well, it won't be, but it doesn't matter because the first half is already false)
- if the stage is local (false: we clearly see that stage is
The stages still run correctly, but I find this all very confusing. Does anyone have detailed knowledge of how these runners execute?
gists
...ANSWER
Answered 2019-Nov-18 at 08:05Gitlab supports number of executors where each might behave slightly differently (executor might might mount custom volumes, forbid privileged containers)
The general workflow is:
- Prepare: Create and start the services.
- Pre-job: Clone, restore cache and download artifacts from previous stages. This is run on a special Docker image.
- Job: User build. This is run on the user-provided Docker image.
- Post-job: Create cache, upload artifacts to GitLab. This is run on a special Docker Image.
I would discourage from scripting in entrypoint.sh
. try to rewrite it into .gitlab-ci.yml
:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ansible-bender
You can use ansible-bender like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page