Skip to content

podman entrypoint for working container #258

@neldridge

Description

@neldridge

Hi, I've been doing some testing with bender to replace our AMIs with Docker containers.

One of the things I'm trying to accomplish is setting up our Ubuntu-based Jenkins agents in Docker through ECS+Fargate.

My pipeline is:
base -> jenkins-base
jenkins-base -> infrastructure
jenkins-base -> java
jenkins-base -> etc.

During my jenkins-base creation, I set the target_image entrypoint to /usr/local/bin/jenkins-agent - which is required behavior for ECS as it passes a command expecting it to be an argument to that shell script.

Unfortunately, this means in my infrastructure/java/etc. images- the ansible-bender build fails, "can't find python".

The only way I can figure out how to get around this is to not set the entrypoint in my jenkins-base and set it in the downstream containers- which isn't ideal.

Am I missing another way?

Logs here:

root@ip:/home/ubuntu/ansible# time ansible-bender -vvv build test-infrastructure-linux.yml
19:58:00.085 utils.py          INFO   running command: "['ansible-playbook', '--version']"
19:58:00.431 utils.py          INFO   running command: "['ansible-playbook', '-c', 'local', '-i', '/tmp/abauyyxs3i/i', '-e', 'ansible_python_interpreter=/usr/bin/python3', '.test-infrastructure-linux-20210720195800085112-odiwaowrjg.yaml']"
19:58:01.490 utils.py          INFO   running command: "['podman', 'version']"
19:58:01.615 utils.py          INFO   running command: "['buildah', 'version']"
19:58:01.677 utils.py          INFO   running command: "['buildah', 'from', '--name', ' artifactory-devops-infrastructure-linux-0-0-1-20210720-195801462893-cont-20210720195801677290', 'artifactory.internal/company/jenkins-base:18.04']"
19:58:01.871 utils.py          INFO   running command: "['buildah', 'run', ' artifactory-devops-infrastructure-linux-0-0-1-20210720-195801462893-cont-20210720195801677290', 'true']"
19:58:02.425 utils.py          INFO   running command: "['buildah', 'rm', ' artifactory-devops-infrastructure-linux-0-0-1-20210720-195801462893-cont-20210720195801677290']"
19:58:02.522 utils.py          INFO   running command: "['buildah', 'inspect', '-t', 'image', 'artifactory.internal/company/jenkins-base:18.04']"
19:58:02.607 utils.py          INFO   running command: "['podman', 'run', '--rm', 'artifactory.internal/company/jenkins-base:18.04', 'true']"
19:58:03.179 utils.py          INFO   running command: "['buildah', 'inspect', '-t', 'image', 'artifactory.internal/company/jenkins-base:18.04']"
19:58:03.307 utils.py          INFO   running command: "['podman', 'run', '--rm', 'artifactory.internal/company/jenkins-base:18.04', 'ls', '/usr/bin/python3']"
19:58:03.891 buildah_builder.py INFO   python interpreter /usr/bin/python3 does not exist
19:58:03.892 utils.py          INFO   running command: "['podman', 'run', '--rm', 'artifactory.internal/company/jenkins-base:18.04', 'ls', '/usr/local/bin/python3']"
19:58:04.543 buildah_builder.py INFO   python interpreter /usr/local/bin/python3 does not exist
19:58:04.544 utils.py          INFO   running command: "['podman', 'run', '--rm', 'artifactory.internal/company/jenkins-base:18.04', 'ls', '/usr/bin/python3.7']"
19:58:05.131 buildah_builder.py INFO   python interpreter /usr/bin/python3.7 does not exist
19:58:05.132 utils.py          INFO   running command: "['podman', 'run', '--rm', 'artifactory.internal/company/jenkins-base:18.04', 'ls', '/usr/bin/python37']"
19:58:05.767 buildah_builder.py INFO   python interpreter /usr/bin/python37 does not exist
19:58:05.768 utils.py          INFO   running command: "['podman', 'run', '--rm', 'artifactory.internal/company/jenkins-base:18.04', 'ls', '/usr/bin/python3.6']"
19:58:06.383 buildah_builder.py INFO   python interpreter /usr/bin/python3.6 does not exist
19:58:06.383 utils.py          INFO   running command: "['podman', 'run', '--rm', 'artifactory.internal/company/jenkins-base:18.04', 'ls', '/usr/bin/python36']"
19:58:06.967 buildah_builder.py INFO   python interpreter /usr/bin/python36 does not exist
19:58:06.968 utils.py          INFO   running command: "['podman', 'run', '--rm', 'artifactory.internal/company/jenkins-base:18.04', 'ls', '/usr/bin/python2']"
19:58:07.555 buildah_builder.py INFO   python interpreter /usr/bin/python2 does not exist
19:58:07.556 utils.py          INFO   running command: "['podman', 'run', '--rm', 'artifactory.internal/company/jenkins-base:18.04', 'ls', '/usr/local/bin/python2']"
19:58:08.139 buildah_builder.py INFO   python interpreter /usr/local/bin/python2 does not exist
19:58:08.140 utils.py          INFO   running command: "['podman', 'run', '--rm', 'artifactory.internal/company/jenkins-base:18.04', 'ls', '/usr/bin/python']"
19:58:08.767 buildah_builder.py INFO   python interpreter /usr/bin/python does not exist
19:58:08.768 utils.py          INFO   running command: "['podman', 'run', '--rm', 'artifactory.internal/company/jenkins-base:18.04', 'ls', '/usr/local/bin/python']"
19:58:09.335 buildah_builder.py INFO   python interpreter /usr/local/bin/python does not exist
19:58:09.335 utils.py          INFO   running command: "['podman', 'run', '--rm', 'artifactory.internal/company/jenkins-base:18.04', 'ls', '/usr/libexec/platform-python']"
19:58:09.939 buildah_builder.py INFO   python interpreter /usr/libexec/platform-python does not exist
19:58:09.940 buildah_builder.py ERROR  couldn't locate python interpreter, tried these paths: ('/usr/bin/python3', '/usr/local/bin/python3', '/usr/bin/python3.7', '/usr/bin/python37', '/usr/bin/python3.6', '/usr/bin/python36', '/usr/bin/python2', '/usr/local/bin/python2', '/usr/bin/python', '/usr/local/bin/python', '/usr/libexec/platform-python')
There was an error during execution: no python interpreter was found in the base image "artifactory.internal/company/jenkins-base:18.04", you can specify the path via CLI option --python-interpreter

real    0m10.093s
user    0m5.945s
sys     0m1.736s
root@ip:/home/ubuntu/ansible# podman run -it --rm --entrypoint python3 artifactory.internal/company/jenkins-base:18.04 --version
Python 3.6.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    UXImprove user experiencebugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions