Skip to content

Commit

Permalink
chore: Add validation to test release codebuild spec (#326)
Browse files Browse the repository at this point in the history
Now the test release validation does the same checks as the prod release
(running the sample application against the new version). To support this
I've also refactored out the validation steps into a dedicated spec so both
the prod and test specs can depend on it.
  • Loading branch information
farleyb-amazon committed Mar 26, 2021
1 parent 7bbfb76 commit adb6c72
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 15 deletions.
32 changes: 22 additions & 10 deletions codebuild/release/prod-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,33 @@ env:

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/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:
- pip install tox
- git checkout $BRANCH
- tox -e park
- tox -e release
- git clone https://github.com/aws-samples/busy-engineers-document-bucket.git
- cd busy-engineers-document-bucket/exercises/python/encryption-context-complete
- sed -i "s/aws_encryption_sdk/aws_encryption_sdk==$VERSION/" requirements-dev.txt
- tox -e test


batch:
fast-fail: false
build-list:
- identifier: prod_release
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/
28 changes: 23 additions & 5 deletions codebuild/release/test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,35 @@ env:

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/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:
- pip install tox
- git checkout $BRANCH
- tox -e park
- tox -e test-release


batch:
fast-fail: false
build-list:
- identifier: test_release
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/
16 changes: 16 additions & 0 deletions codebuild/release/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 0.2

phases:
install:
commands:
- pip install tox
runtime-versions:
python: latest
pre_build:
commands:
- git clone https://github.com/aws-samples/busy-engineers-document-bucket.git
- cd busy-engineers-document-bucket/exercises/python/encryption-context-complete
- sed -i "s/aws_encryption_sdk/aws_encryption_sdk==$VERSION/" requirements-dev.txt
build:
commands:
- tox -e test

0 comments on commit adb6c72

Please sign in to comment.