gitopscli icon indicating copy to clipboard operation
gitopscli copied to clipboard

Create / Release GitOps CLI as a binary

Open niiku opened this issue 5 years ago • 3 comments

The GitOps CLI should be released as a self contained binary so it could be used without Docker or Python installed locally.

It would be the best if it would be included in the release step.

To create a binary for a Python application I tested PyInstaller which worked great so far:

pip3 install pyinstaller
# Move to the gitopscli repository
pyinstaller gitopscli/__main__.py -n gitopscli --onefile

Afterwards, the executable binary is available under dist/gitopscli

Releasing the GitOps CLI as binary would open the door to add developer. I'm thinking about commands like:

gitopscli login --git-server bitbucket.example.tld --root-config <path-to-root-config>
gitopscli create deployment --name demo-test --image=org/myimage:latest --host=app.example.tld --config-repo example-non-prod ...
gitopscli promote --from demo-test --to demo-int

etc.

niiku avatar Jul 28 '20 12:07 niiku

PyInstaller can't cross-compile windows binaries from linux (pyinstaller/pyinstaller#2613). I guess we could work around that with wine (e.g. https://github.com/cdrx/docker-pyinstaller) ...already feels a bit hacky though :hammer_and_wrench:

christiansiegel avatar Sep 11 '20 15:09 christiansiegel

One option for systems with Python installed (most linuxes) already would be to release an actual installation package for pip (zip, wheel) and use console scripts (I see you already provide one in setup.py) For Windows users (without Python) Pyinstaller is still an option - or just a prepackaged pypy zip / install Script.

janbrohl avatar Dec 15 '20 09:12 janbrohl

if you have problem with pyinstaller and File "", line 1004, in _find_and_load_unlocked ModuleNotFoundError: No module named 'gitlab.v4' [11927] Failed to execute script 'main' due to unhandled exception!

you can use --hidden-import pyinstaller gitopscli/__main__.py --hidden-import gitlab.v4 --hidden-import gitlab.v4.objects -n gitopscli --onefile

epanoff avatar Mar 27 '23 12:03 epanoff