Skip to content

Release improvements #167

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

Merged
merged 13 commits into from
Jun 14, 2021
Merged
41 changes: 41 additions & 0 deletions codebuild/release/prod-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: 0.2

env:
variables:
BRANCH: "master"
secrets-manager:
TWINE_USERNAME: PyPiAdmin:username
TWINE_PASSWORD: PyPiAdmin:password

phases:
install:
commands:
- pip install tox
- pip install --upgrade pip
runtime-versions:
python: latest
pre_build:
commands:
- git checkout $COMMIT_ID
- FOUND_VERSION=$(sed -n 's/__version__ = "\(.*\)"/\1/p' src/dynamodb_encryption_sdk/identifiers.py)
- |
if expr ${FOUND_VERSION} != ${VERSION}; then
echo "identifiers.py version (${FOUND_VERSION}) does not match expected version (${VERSION}), stopping"
exit 1;
fi
build:
commands:
- tox -e park
- tox -e release

batch:
fast-fail: true
build-graph:
- identifier: release_to_prod
- identifier: validate_prod_release
depend-on:
- release_to_prod
buildspec: codebuild/release/validate.yml
env:
variables:
PIP_INDEX_URL: https://pypi.python.org/simple/
43 changes: 43 additions & 0 deletions codebuild/release/test-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: 0.2

env:
variables:
BRANCH: "master"
secrets-manager:
TWINE_USERNAME: TestPyPiCryptoTools:username
TWINE_PASSWORD: TestPyPiCryptoTools:password

phases:
install:
commands:
- pip install tox
- pip install --upgrade pip
runtime-versions:
python: latest
pre_build:
commands:
- git checkout $COMMIT_ID
- FOUND_VERSION=$(sed -n 's/__version__ = "\(.*\)"/\1/p' src/dynamodb_encryption_sdk/identifiers.py)
- |
if expr ${FOUND_VERSION} != ${VERSION}; then
echo "identifiers.py version (${FOUND_VERSION}) does not match expected version (${VERSION}), stopping"
exit 1;
fi
build:
commands:
- tox -e park
- tox -e test-release


batch:
fast-fail: true
build-graph:
- identifier: release_to_staging
- identifier: validate_staging_release
depend-on:
- release_to_staging
buildspec: codebuild/release/validate.yml
env:
variables:
PIP_INDEX_URL: https://test.pypi.org/simple/
PIP_EXTRA_INDEX_URL: https://pypi.python.org/simple/
39 changes: 39 additions & 0 deletions codebuild/release/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: 0.2

env:
variables:
BRANCH: "master"
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID: >-
arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
DDB_ENCRYPTION_CLIENT_TEST_TABLE_NAME: ddbec-release-validation


phases:
install:
commands:
- pip install tox
runtime-versions:
python: latest
pre_build:
commands:
- cd examples
- sed -i "s/dynamodb-encryption-sdk/dynamodb-encryption-sdk==$VERSION/" test/requirements.txt
build:
commands:
- NUM_RETRIES=3
- |
while [ $NUM_RETRIES -gt 0 ]
do
tox -re py38-examples
if [ $? -eq 0 ]; then
break
fi
NUM_RETRIES=$((NUM_RETRIES-1))
if [ $NUM_RETRIES -eq 0 ]; then
echo "All validation attempts failed, stopping"
exit 1;
else
echo "Validation failed, retrying in 60 seconds; will retry $NUM_RETRIES more times" && sleep 60
fi
done

2 changes: 1 addition & 1 deletion examples/setup.py
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ def get_requirements():
author_email="[email protected]",
maintainer="Amazon Web Services",
description="DynamoDB Encryption Client for Python examples",
long_description=read("README.rst"),
long_description=read("README.md"),
keywords="dynamodb-encryption-sdk aws kms encryption dynamodb",
data_files=["requirements.txt"],
license="Apache License 2.0",
5 changes: 4 additions & 1 deletion examples/tox.ini
Original file line number Diff line number Diff line change
@@ -16,7 +16,10 @@ passenv =
# Pass through AWS credentials
AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN \
# AWS Role access in CodeBuild is via the container URI
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI \
# Pass through the default AWS region
AWS_DEFAULT_REGION

sitepackages = False
deps = -rtest/requirements.txt
# 'download' forces tox to always upgrade pip to the latest