I created a python package looking like the following. The package is primarily used to run stages in a jenkins pipeline inside a docker container. So I created a repository in github and created a dockerfile with a step where the repository is cloned and performed pip install on that package. Then I built the docker image.
jenkins_pipeline_pkg/
| - jenkins_pipeline_pkg/
| - __init__.py
| - config/
| - config.yaml
| - scripts/
| - pre_build.py
| - build.py
| - setup.py
I performed pip install on the package inside the docker container I created using the dockerfile. The setup.py looks like the following.
#!/usr/bin/env python
from setuptools import setup
setup(name='jenkins_pipeline_pkg',
version='0.1',
description='Scripts for jenkins pipeline',
url='<private repo url>',
author='<name>',
author_email='<email>',
packages=['jenkins_pipeline_pkg'],
zip_safe=False,
entry_points={
'console_scripts': [
'pre-build = jenkins_pipeline_pkg.pre_build:main',
'build = jenkins_pipeline_pkg.build:main',],
}
)
I ran pip install on the package. It installed the executable mentioned in the entry_points in ~/.local/bin. Then I tried to execute the executable from anywhere else by not changing into the directory ~/.local/bin (just say I executed from /home/user). And also bash auto complete doesnt show the pre-build command. I dont know what I'm missing here.