From 825765a52ebf3ef59b99b884ced0e5693d347919 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Thu, 26 Jul 2018 18:28:43 -0500 Subject: [PATCH] ci: Add Jenkins pipeline --- ci/Dockerfile | 7 +++++++ ci/Jenkinsfile | 28 ++++++++++++++++++++++++++++ ci/publish.sh | 8 ++++++++ 3 files changed, 43 insertions(+) create mode 100644 ci/Dockerfile create mode 100644 ci/Jenkinsfile create mode 100644 ci/publish.sh diff --git a/ci/Dockerfile b/ci/Dockerfile new file mode 100644 index 0000000..99af317 --- /dev/null +++ b/ci/Dockerfile @@ -0,0 +1,7 @@ +FROM fedora:28 + +RUN dnf install -y \ + openssh-clients \ + python3-pip \ + python3-wheel \ + rsync diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile new file mode 100644 index 0000000..1c72ee5 --- /dev/null +++ b/ci/Jenkinsfile @@ -0,0 +1,28 @@ +pipeline { + agent { + dockerfile { + dir 'ci' + } + } + + triggers { + pollSCM '' + } + + environment { + PUBLISH_HOST = 'web0.pyrocufflink.blue' + PUBLISH_USER = 'webapp.dchwww' + } + + stages { + stage('Publish') { + steps { + sh 'pip3 wheel -w dist -r requirements.txt' + sshagent(['jenkins-web']) { + sh "ssh -oStrictHostKeyChecking=no ${PUBLISH_USER}@${PUBLISH_HOST} :" + sh '. ci/publish.sh' + } + } + } + } +} diff --git a/ci/publish.sh b/ci/publish.sh new file mode 100644 index 0000000..ea7786d --- /dev/null +++ b/ci/publish.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +rsync -rti . ${PUBLISH_USER}@${PUBLISH_HOST}: \ + --exclude dist/ --exclude .git +rsync -rti dist/ ${PUBLISH_USER}@${PUBLISH_HOST}:wheelhouse \ + --include '*.whl' --exclude '**' +ssh ${PUBLISH_USER}@${PUBLISH_HOST} \ + venv/bin/pip install --no-index -f wheelhouse -r requirements.txt