From 76d2d97c62ff10bfed180db0df203e2eb34022d7 Mon Sep 17 00:00:00 2001 From: Joshua Arulsamy Date: Sun, 9 Aug 2020 00:44:32 -0600 Subject: [PATCH] :rocket: Automatic deployment through jenkins --- Jenkinsfile | 3 ++- PlexBot/__version__.py | 1 + deploy/build.py | 8 ++++++++ deploy/push.py | 8 ++++++++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 PlexBot/__version__.py create mode 100644 deploy/build.py create mode 100755 deploy/push.py diff --git a/Jenkinsfile b/Jenkinsfile index 7f28ee8..b08e77a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -49,7 +49,7 @@ pipeline { steps { sh ''' source /var/lib/jenkins/miniconda3/etc/profile.d/conda.sh conda activate ${BUILD_TAG} - docker build . + python deploy/build.py ''' } post { @@ -58,6 +58,7 @@ pipeline { archiveArtifacts (allowEmptyArchive: true, artifacts: 'dist/*whl', fingerprint: true) + sh 'python deploy/push.py' } } } diff --git a/PlexBot/__version__.py b/PlexBot/__version__.py new file mode 100644 index 0000000..fe96268 --- /dev/null +++ b/PlexBot/__version__.py @@ -0,0 +1 @@ +VERSION = "0.0.4" diff --git a/deploy/build.py b/deploy/build.py new file mode 100644 index 0000000..78c9326 --- /dev/null +++ b/deploy/build.py @@ -0,0 +1,8 @@ +import os +import sys + +sys.path.append("PlexBot") + +from __version__ import VERSION + +sys.exit(os.system(f"docker build -t jarulsamy/plex-bot:{VERSION} .")) diff --git a/deploy/push.py b/deploy/push.py new file mode 100755 index 0000000..98fc956 --- /dev/null +++ b/deploy/push.py @@ -0,0 +1,8 @@ +import os +import sys + +sys.path.append("PlexBot") + +from __version__ import VERSION + +sys.exit(os.system(f"docker push jarulsamy/plex-bot:{VERSION}"))