-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- openstack_python_bsn_neutronclient*.build are the jenkins tasks of the same name - *.build files contain the shell script executed by the jenkins tasks
- Loading branch information
1 parent
17254fb
commit 9c7192c
Showing
7 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
python setup.py bdist_rpm --spec-only \ | ||
--release=2 \ | ||
--distribution-name=el7.centos \ | ||
--requires=python-neutronclient \ | ||
--build-requires=python-pbr \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/python | ||
|
||
import sys | ||
|
||
from distutils.version import StrictVersion | ||
|
||
# read the two git diff lines about version | ||
two_lines = sys.stdin.read() | ||
if 'version' not in two_lines: | ||
sys.exit("version not found in args. Build FAILED") | ||
lines = str(two_lines).split('\n') | ||
version1 = StrictVersion(lines[0].split('=')[1].strip()) | ||
version2 = StrictVersion(lines[1].split('=')[1].strip()) | ||
print 'version1: ', version1 | ||
print 'version2: ', version2 | ||
if version2 > version1: | ||
print 'Version update correct.' | ||
else: | ||
sys.exit("new version string is < old version string. Build FAILED") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
git clean -fxd | ||
GIT_REPO=`pwd` | ||
|
||
# get gpg creds in place | ||
GNUPG_DIR=$(mktemp -d) | ||
tar -zxvf $GNUPG_TAR -C $GNUPG_DIR | ||
|
||
DOCKER_IMAGE=$DOCKER_REGISTRY'/bosi-builder:latest' | ||
|
||
echo "Tagging and uploading to PYPI" | ||
docker pull $DOCKER_IMAGE | ||
docker run -e GIT_BRANCH=$GIT_BRANCH -v $GIT_REPO:/python-bsn-neutronclient -v $PYPIRC_FILE:/root/.pypirc -v $GNUPG_DIR/.gnupg:/root/.gnupg $DOCKER_IMAGE /python-bsn-neutronclient/build_scripts/upload_to_pypi.sh | ||
|
||
# remove pypi and gpg creds | ||
sudo rm -rf $GNUPG_DIR | ||
|
||
echo "Building RPM packages" | ||
docker run -v $GIT_REPO:/python-bsn-neutronclient $DOCKER_IMAGE /python-bsn-neutronclient/build_scripts/build-rhel-packages.sh |
1 change: 1 addition & 0 deletions
1
build_scripts/openstack_python_bsn_neutronclient_pull_req.build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
./build_scripts/precheckin.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash -eux | ||
pwd | ||
echo 'git commit is' ${GIT_COMMIT} | ||
git clean -fxd | ||
tox -e pep8 | ||
setup_cfg_modified=`git log -m -1 --name-only --pretty="format:" | grep setup.cfg | wc -l` | ||
if [ ${setup_cfg_modified} -ne 1 ]; | ||
then echo "Update setup.cfg with new version number. Build FAILED"; | ||
exit 1; | ||
else | ||
echo "setup.cfg updated"; fi | ||
# check the new_version > old_version | ||
echo 'checking if version bump is correct' | ||
git log -m -1 ${GIT_COMMIT} --pretty="format:" -p setup.cfg | grep version | python build_scripts/is_version_bumped.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash -eux | ||
|
||
# RPM runs as root and doesn't like source files owned by a random UID | ||
OUTER_UID=$(stat -c '%u' /python-bsn-neutronclient) | ||
OUTER_GID=$(stat -c '%g' /python-bsn-neutronclient) | ||
trap "chown -R $OUTER_UID:$OUTER_GID /python-bsn-neutronclient" EXIT | ||
chown -R root:root /python-bsn-neutronclient | ||
|
||
cd /python-bsn-neutronclient | ||
git config --global user.name "Big Switch Networks" | ||
git config --global user.email "support@bigswitch.com" | ||
|
||
CURR_VERSION=$(awk '/^version/{print $3}' setup.cfg) | ||
|
||
echo 'CURR_VERSION=' $CURR_VERSION | ||
git tag -f -s $CURR_VERSION -m $CURR_VERSION -u "Big Switch Networks" | ||
|
||
python setup.py sdist | ||
|
||
# force success. but always check if pip install fails | ||
twine upload dist/* -r pypi -s -i "Big Switch Networks" || true | ||
# delay of 5 seconds | ||
sleep 5 | ||
sudo -H pip install --upgrade python-bsn-neutronclient==$CURR_VERSION | ||
if [ "$?" -eq "0" ] | ||
then | ||
echo "PYPI upload successful." | ||
else | ||
echo "PYPI upload FAILED. Check the logs." | ||
fi | ||
# remove the package | ||
sudo -H pip uninstall -y python-bsn-neutronclient | ||
|
||
# revert the permissions | ||
chown -R $OUTER_UID:$OUTER_GID /python-bsn-neutronclient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters