-
Notifications
You must be signed in to change notification settings - Fork 4
PyPi Intergration #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
fbd7635
34f58b7
1915ed4
89a2035
14619d9
262ae5b
e07b9f0
c414515
d5d783b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ pipeline { | |
GITHUB_URL = '[email protected]:RightBrain-Networks/auto-semver.git' | ||
GITHUB_KEY = 'rbn-ops github' | ||
DOCKER_CREDENTIALS = 'rbnopsDockerHubToken' | ||
PYPI_CREDENTIALS = 'rbn_pypi_token' | ||
|
||
SERVICE = 'auto-semver' | ||
SELF_SEMVER_TAG = "master" //Image tag to use for self-versioning | ||
|
@@ -38,12 +39,10 @@ pipeline { | |
echo "Building ${env.SERVICE} docker image" | ||
|
||
// Docker build flags are set via the getDockerBuildFlags() shared library. | ||
sh "docker build ${getDockerBuildFlags()} -t rightbrainnetworks/auto-semver:${env.VERSION} ." | ||
|
||
|
||
sh "python setup.py sdist" | ||
|
||
stash includes: "dist/semver-${env.SEMVER_NEW_VERSION}.tar.gz", name: 'PACKAGE' | ||
dejonghe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
script | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you dont need script here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Required for |
||
{ | ||
dockerImage = docker.build("rightbrainnetworks/auto-semver:${env.VERSION}") | ||
} | ||
} | ||
post{ | ||
// Update Git with status of build stage. | ||
|
@@ -84,14 +83,13 @@ pipeline { | |
|
||
// Authenticate & push to DockerHub | ||
withCredentials([usernamePassword(credentialsId: env.DOCKER_CREDENTIALS, usernameVariable: 'DOCKER_USERNAME', passwordVariable: 'DOCKER_PASSWORD')]) { | ||
sh(""" | ||
docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD} | ||
docker push rightbrainnetworks/auto-semver:${env.VERSION} | ||
""") | ||
sh("docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}") | ||
script | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you dont need script here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Required for |
||
{ | ||
dockerImage.push("${env.VERSION}") | ||
} | ||
} | ||
|
||
// Copy artifact to S3 | ||
sh "aws s3 cp `ls -t ./dist/semver-* | head -1` s3://rbn-ops-pkg-us-east-1/${env.SERVICE}/${env.SERVICE}-${env.VERSION}.tar.gz" | ||
|
||
} | ||
post | ||
{ | ||
|
@@ -104,7 +102,7 @@ pipeline { | |
} | ||
} | ||
} | ||
stage('Publish Release') | ||
stage('Release') | ||
{ | ||
when { | ||
expression { | ||
|
@@ -113,25 +111,35 @@ pipeline { | |
} | ||
steps | ||
{ | ||
unstash 'PACKAGE' | ||
script | ||
{ | ||
dockerImage.push('latest') | ||
} | ||
|
||
// Create GitHub Release & Upload Artifacts | ||
createGitHubRelease('rbn-opsGitHubToken', 'RightBrain-Networks/auto-semver', "${env.SEMVER_RESOLVED_VERSION}", | ||
"${env.SEMVER_RESOLVED_VERSION}", ["auto-semver.tar.gz" : "dist/semver-${env.SEMVER_NEW_VERSION}.tar.gz"]) | ||
|
||
// Update DockerHub latest tag | ||
sh(""" | ||
docker tag rightbrainnetworks/auto-semver:${env.VERSION} rightbrainnetworks/auto-semver:latest | ||
docker push rightbrainnetworks/auto-semver:latest | ||
""") | ||
|
||
// Upload package to PyPi | ||
script | ||
{ | ||
docker.image("rightbrainnetworks/auto-semver:${env.VERSION}").inside() | ||
{ | ||
withCredentials([string(credentialsId: env.PYPI_CREDENTIALS, variable: 'PYPI_PASSWORD')]) { | ||
sh("twine upload dist/* --verbose -u __token__ -p ${PYPI_PASSWORD}") | ||
} | ||
} | ||
} | ||
} | ||
post | ||
{ | ||
// Update Git with status of release stage. | ||
success { | ||
updateGithubCommitStatus(GITHUB_URL, 'Passed release stage', 'SUCCESS', 'Release') | ||
updateGithubCommitStatus(GITHUB_URL, 'Passed release package stage', 'SUCCESS', 'Release') | ||
} | ||
failure { | ||
updateGithubCommitStatus(GITHUB_URL, 'Failed release stage', 'FAILURE', 'Release') | ||
updateGithubCommitStatus(GITHUB_URL, 'Failed release package stage', 'FAILURE', 'Release') | ||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,12 @@ | |
|
||
|
||
import re | ||
from os import path | ||
|
||
# Always prefer setuptools over distutils | ||
from setuptools import setup, find_packages | ||
# To use a consistent encoding | ||
from codecs import open | ||
from os import path | ||
|
||
|
||
|
||
here = path.abspath(path.dirname(__file__)) | ||
|
@@ -34,16 +34,11 @@ def find_version(*file_paths): | |
raise RuntimeError("Unable to find version string.") | ||
|
||
setup( | ||
name='semver', | ||
|
||
# Versions should comply with PEP440. For a discussion on single-sourcing | ||
# the version across setup.py and the project code, see | ||
# https://packaging.python.org/en/latest/single_source_version.html | ||
name='semver-by-branch', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we need to change the package name, that only has to be updated here. |
||
version=find_version('semver','__init__.py'), | ||
#version='0.0.1', | ||
|
||
description='Automatic Semantic Versioner', | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
|
||
# The project's main homepage. | ||
url='https://github.com/RightBrain-Networks/auto-semver', | ||
|
@@ -55,76 +50,30 @@ def find_version(*file_paths): | |
# Choose your license | ||
license='Apache2.0', | ||
|
||
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers | ||
# See https://pypi.org/classifiers/ | ||
classifiers=[ | ||
# How mature is this project? Common values are | ||
# 3 - Alpha | ||
# 4 - Beta | ||
# 5 - Production/Stable | ||
'Development Status :: 3 - Alpha', | ||
|
||
# Indicate who your project is intended for | ||
'Development Status :: 5 - Production/Stable', | ||
'Intended Audience :: Developers', | ||
'Intended Audience :: System Administrators', | ||
'Topic :: Software Development :: Build Tools', | ||
|
||
# Pick your license as you wish (should match "license" above) | ||
'License :: OSI Approved :: Apache Software License', | ||
|
||
# Specify the Python versions you support here. In particular, ensure | ||
# that you indicate whether you support Python 2, Python 3 or both. | ||
'Programming Language :: Python :: 2', | ||
'Programming Language :: Python :: 2.7', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.3', | ||
'Programming Language :: Python :: 3.4', | ||
'Programming Language :: Python :: 3.5', | ||
'Programming Language :: Python :: 3.6' | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
'Topic :: Software Development :: Build Tools' | ||
], | ||
|
||
# What does your project relate to? | ||
keywords='Semantic Version', | ||
|
||
# You can just specify the packages manually here if your project is | ||
# simple. Or you can use find_packages(). | ||
keywords='Semantic,Version,CICD,Pipeline,Versioning', | ||
packages=find_packages(exclude=['contrib', 'docs', 'tests']), | ||
|
||
# Alternatively, if you want to distribute just a my_module.py, uncomment | ||
# this: | ||
# py_modules=["my_module"], | ||
|
||
# List run-time dependencies here. These will be installed by pip when | ||
# your project is installed. For an analysis of "install_requires" vs pip's | ||
# requirements files see: | ||
# https://packaging.python.org/en/latest/requirements.html | ||
install_requires=[ | ||
'argparse>=1.2.1' | ||
], | ||
|
||
# List additional groups of dependencies here (e.g. development | ||
# dependencies). You can install these using the following syntax, | ||
# for example: | ||
# $ pip install -e .[dev,test] | ||
#extras_require={ | ||
# 'dev': ['check-manifest'], | ||
# 'test': ['coverage'], | ||
#}, | ||
|
||
# If there are data files included in your packages that need to be | ||
# installed, specify them here. If using Python 2.6 or less, then these | ||
# have to be included in MANIFEST.in as well. | ||
package_data={ | ||
}, | ||
|
||
# Although 'package_data' is the preferred approach, in some case you may | ||
# need to place data files outside of your packages. See: | ||
# http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files # noqa | ||
# In this case, 'data_file' will be installed into '<sys.prefix>/my_data' | ||
#data_files=[('my_data', ['data/data_file'])], | ||
|
||
# To provide executable scripts, use entry points in preference to the | ||
# "scripts" keyword. Entry points provide cross-platform support and allow | ||
# pip to create the appropriate form of executable for the target platform. | ||
package_data={}, | ||
entry_points={ | ||
'console_scripts': [ | ||
'semver = semver:main', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
#!/usr/bin/env groovy | ||
|
||
/** | ||
|
Uh oh!
There was an error while loading. Please reload this page.