Skip to content

Commit

Permalink
chore: Release using codebuild (#206)
Browse files Browse the repository at this point in the history
Applying the same structure as we already have in the https://github.com/aws/aws-encrytion-sdk-python repo.
  • Loading branch information
robin-aws authored May 26, 2021
1 parent f546e7d commit 11d4c9d
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 3 deletions.
1 change: 1 addition & 0 deletions api_compatibility_tests/compatibility-requirements/1.9.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aws-encryption-sdk-cli==1.9.0
1 change: 1 addition & 0 deletions api_compatibility_tests/compatibility-requirements/2.2.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aws-encryption-sdk-cli==2.2.0
16 changes: 13 additions & 3 deletions api_compatibility_tests/tox.ini
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
[tox]
envlist =
# Only include released versions by default
py38-awses_cli_{1.7.0,2.0.0}
py38-awses_cli_{1.7.0,1.8.0,1.9.0,2.0.0,2.1.0,2.2.0}

[testenv:base-command]
commands = pytest --basetemp={envtmpdir} -l test/ {posargs}

[testenv]
passenv =
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID
# Identifies AWS KMS key id to use in integration tests
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID \
# Pass through AWS credentials
AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN \
# AWS Role access in CodeBuild is via the contaner URI
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI \
# Pass through AWS profile name (useful for local testing)
AWS_PROFILE \
# Pass through custom pip config file settings
PIP_CONFIG_FILE
sitepackages = False
deps =
-rtest/requirements.txt
awses_cli_1.7.0: -rcompatibility-requirements/1.7.0
awses_cli_1.8.0: -rcompatibility-requirements/1.8.0
awses_cli_1.9.0: -rcompatibility-requirements/1.9.0
awses_cli_2.0.0: -rcompatibility-requirements/2.0.0
awses_cli_2.1.0: -rcompatibility-requirements/2.1.0
awses_cli_2.2.0: -rcompatibility-requirements/2.2.0
awses_cli_local: -e {env:AWSES_CLI_LOCAL_PATH}
commands =
{[testenv:base-command]commands}
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/aws_encryption_sdk_cli/internal/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/aws_encryption_sdk_cli/internal/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/
19 changes: 19 additions & 0 deletions codebuild/release/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 0.2

env:
variables:
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID: >-
arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
phases:
install:
commands:
- pip install tox
runtime-versions:
python: latest
pre_build:
commands:
- cd api_compatibility_tests
build:
commands:
- tox -e py38-awses_cli_${VERSION}

0 comments on commit 11d4c9d

Please sign in to comment.