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 18, 2020
1 parent f82dcc6 commit 28c700e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 70 deletions.
85 changes: 15 additions & 70 deletions .jenkins
@@ -1,72 +1,17 @@
#!/usr/bin/env groovy

pipeline {

agent any

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

// Clean up the workspace
stage('Clean') {
steps {
sh 'make clean'
}
}

// Lint the source code.
stage('Lint') {
steps {
sh 'make lint'
}
}

// Run project unit tests.
stage('Test') {
steps {
sh 'make test'
}
}

// Build and distribute a new package version to PyPi.
stage('Publish to PyPi') {
when {
buildingTag()
}
environment {
TWINE_USERNAME = 'vaporio'
TWINE_PASSWORD = credentials('twine-password')
}
steps {
// publish to pypi
sh 'tox -e publish'
}
}

// Generate a new release draft on GitHub for a tag matching a version string
// pattern. The release will include an auto-generated changelog and build
// artifacts.
stage('Draft GitHub Release') {
when {
buildingTag()
}
environment {
GITHUB_USER = 'vapor-ware'
GITHUB_TOKEN = credentials('vio-bot-gh-token')
GITHUB_REPONAME = 'kubetest'
}
steps {
// 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 ${WORKSPACE}:/repo edaniszewski/ghr -u ${GITHUB_USER} -r ${GITHUB_REPONAME} -t ${GITHUB_TOKEN} -b "$(cat ./CHANGELOG.md)" -replace ${TAG_NAME} dist/'
}
}
}
}
// Include this shared CI repository to load script helpers and libraries.
library identifier: 'vapor@1.0.0-RC4', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/vapor-ware/ci-shared.git',
credentialsId: 'vio-bot-gh',
])

pythonPipeline([
'pythonVersion': '3.8',
'twineCredential': 'pypi-token-kubetest-upload',
'skipIntegrationTest': true,
'skipDocker': true,
'releaseToPypi': true,
'publishToGitHub': true,
])
10 changes: 10 additions & 0 deletions Makefile
Expand Up @@ -49,3 +49,13 @@ 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

.DEFAULT_GOAL := help

# Targets for Jenkins CI

.PHONY: unit-test pypi-release

unit-test:
tox -e py38

pypi-release:
tox -e publish
1 change: 1 addition & 0 deletions tox.ini
Expand Up @@ -98,6 +98,7 @@ commands=
[testenv:publish]
description=
publish to pypi
basepython=python3
deps=
-r{toxinidir}/requirements.txt
twine>=1.5.0
Expand Down

0 comments on commit 28c700e

Please sign in to comment.