Jenkins auto deploying flask in test env with last build process kill and pipenv

#!/bin/sh cd $WORKSPACE export PY=/usr/local/bin/python3 export FLASK_RUN_PORT=4005 $PY -m pip install pipenv $PY -m pipenv install --dev export VENV_HOME_DIR=$($PY -m pipenv --venv) source $VENV_HOME_DIR/bin/activate flask db upgrade flask populate-initial-data export BUILD_ID=XYZapi $WORKSPACE/killlastbuild.sh flask run & deactivate killlastbuild.sh can have anything inside it depending upon your project requirements. I put 2 process killers to kill background-ed daemon processes from previous build command ps -Af | grep "xyzapi" | grep -v grep | awk '{print$2}' | head -1 | xargs kill -9 ps -Af | grep "xyzapi" | grep -v grep | awk '{print$2}' | head -1 | xargs kill -9

June 22, 2020 · 1 min · Harshvardhan Malpani

How to edit default python version for a linux user?

Edit the bash profile and add an alias using the following code $ nano ~/.bashrc Put the following line of code in .bashrc file and alter the python3.6 path as per your new installation alias python='/usr/local/bin/python3.6' Use CTRL x to exit and save After that you need to reload the source, so use the following command and you are good to go. $ source ~/.bashrc

December 31, 2018 · 1 min · Harshvardhan Malpani