Skip to content

Commit

Permalink
ci: update Jenkins config to use shared pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
edaniszewski committed Aug 17, 2020
1 parent abfce8a commit f3992e0
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 258 deletions.
3 changes: 0 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ Dockerfile
**/*.rst
NOTICE

# Scripts
bin/ci

# Other
**/*.png
**/*.svg
Expand Down
121 changes: 17 additions & 104 deletions .jenkins
Original file line number Diff line number Diff line change
@@ -1,104 +1,17 @@
pipeline {

agent any

environment {
IMAGE_NAME = 'vaporio/synse-server'
}

stages {
stage('Checkout') {
steps {
checkout scm
}
}

stage('Lint') {
agent {
label 'python-3.8'
}
steps {
container('python') {
sh 'tox -e lint'
}
}
}

stage('Test') {
agent {
label 'python-3.8'
}
environment {
CODECOV_TOKEN = credentials('codecov-token')
}
steps {
container('python') {
sh 'tox tests/unit'
}
}
}

stage('Verify Image Build') {
steps {
sh '''
docker build \
--label build_date=$(date -u +%Y-%m-%dT%T 2> /dev/null) \
--label version=$(python setup.py --version) \
--label commit=$(git rev-parse --short HEAD 2> /dev/null || true) \
-t ${IMAGE_NAME}:canary .
'''
}
}

stage('Publish "latest" Image (master)') {
when {
branch 'master'
}
steps {
withDockerRegistry(registry: [credentialsId: 'vio-docker-hub']) {
sh '''
docker build \
--label build_date=$(date -u +%Y-%m-%dT%T 2> /dev/null) \
--label version=$(python setup.py --version) \
--label commit=$(git rev-parse --short HEAD 2> /dev/null || true) \
-t ${IMAGE_NAME}:latest .
'''
}
}
}

stage('Draft GitHub Release') {
when {
buildingTag()
}
environment {
GITHUB_USER = 'vapor-ware'
GITHUB_TOKEN = credentials('vio-bot-gh-token')
GITHUB_REPONAME = 'synse-server'
}
steps {
// Build package distribution
sh 'python setup.py sdist --formats=gztar,zip'

// Auto-generate a changelog for the release
sh './bin/ci/generate_changelog.sh'

// Create the release
sh 'docker pull edaniszewski/ghr'
sh 'docker run --rm -v $PWD:/repo edaniszewski/ghr -u ${GITHUB_USER} -r ${GITHUB_REPONAME} -t ${GITHUB_TOKEN} -b "$(cat ./CHANGELOG.md)" -replace -draft ${TAG_NAME} dist'
}
}

stage('Publish Release Images') {
when {
buildingTag()
}
steps {
withDockerRegistry(registry: [credentialsId: 'vio-docker-hub']) {
sh './bin/ci/build_and_publish.sh latest'
}
}
}

}
}
#!/usr/bin/env groovy

// Include this shared CI repository to load script helpers and libraries.
library identifier: 'vapor@1.0.0-RC3', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/vapor-ware/ci-shared.git',
credentialsId: 'vio-bot-gh',
])

pythonPipeline([
'image': 'vaporio/synse-server',
'pythonVersion': '3.8',
'mainBranch': 'develop',
'skipIntegrationTest': true,
'releaseToPypi': false,
'publishToGitHub': true,
])
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,10 @@ version: ## Print the version of Synse Server

help: ## Print Make usage information
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {printf "\033[36m%-16s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort


# Jenkins CI Targets

.PHONY: unit-test

unit-test: test
123 changes: 0 additions & 123 deletions bin/ci/build_and_publish.sh

This file was deleted.

28 changes: 0 additions & 28 deletions bin/ci/generate_changelog.sh

This file was deleted.

0 comments on commit f3992e0

Please sign in to comment.