Skip to content

Commit 73ca27d

Browse files
committed
chore: validate release
1 parent cbfab66 commit 73ca27d

File tree

3 files changed

+184
-0
lines changed

3 files changed

+184
-0
lines changed

.github/workflows/ci_codebuild_batch.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,45 @@ jobs:
12971297
project-name: python-esdk
12981298
buildspec-override: codebuild/py312/decrypt_golden_manifest_with_masterkey.yml
12991299
image-override: aws/codebuild/standard:7.0
1300+
1301+
# Python Release Validation with test vectors
1302+
python_release_validation:
1303+
name: Python Release Validation with Test Vectors
1304+
runs-on: ubuntu-latest
1305+
steps:
1306+
- name: Configure AWS Credentials
1307+
uses: aws-actions/configure-aws-credentials@v2
1308+
with:
1309+
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
1310+
aws-region: us-west-2
1311+
role-duration-seconds: 7200
1312+
- name: Run CodeBuild
1313+
uses: aws-actions/aws-codebuild-run-build@v1
1314+
timeout-minutes: 120
1315+
with:
1316+
project-name: python-esdk
1317+
buildspec-override: codebuild/release/validate_test_vectors.yml
1318+
image-override: aws/codebuild/standard:7.0
1319+
1320+
1321+
# Python Release Validation with examples as alternate
1322+
python_release_examples_validation:
1323+
name: Python Release Validation with Examples
1324+
runs-on: ubuntu-latest
1325+
steps:
1326+
- name: Configure AWS Credentials
1327+
uses: aws-actions/configure-aws-credentials@v2
1328+
with:
1329+
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
1330+
aws-region: us-west-2
1331+
role-duration-seconds: 7200
1332+
- name: Run CodeBuild
1333+
uses: aws-actions/aws-codebuild-run-build@v1
1334+
timeout-minutes: 120
1335+
with:
1336+
project-name: python-esdk
1337+
buildspec-override: codebuild/release/validate_released_with_examples.yml
1338+
image-override: aws/codebuild/standard:7.0
13001339

13011340
# Code Coverage and Compliance jobs
13021341
code_coverage:
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
version: 0.2
2+
3+
env:
4+
variables:
5+
# Default VERSION if not provided externally
6+
VERSION: 4.0.2
7+
REGION: "us-west-2"
8+
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID: >-
9+
arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
10+
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID_2: >-
11+
arn:aws:kms:eu-central-1:658956600833:key/75414c93-5285-4b57-99c9-30c1cf0a22c2
12+
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_1: >-
13+
arn:aws:kms:us-west-2:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
14+
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_2: >-
15+
arn:aws:kms:us-east-1:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
16+
17+
phases:
18+
install:
19+
runtime-versions:
20+
python: 3.11
21+
commands:
22+
- pip install "tox < 4.0"
23+
- pip install --upgrade pip
24+
- echo "Installing aws-encryption-sdk version $VERSION"
25+
- pip install "aws-encryption-sdk[MPL]==$VERSION"
26+
build:
27+
commands:
28+
# Verify installation
29+
- python -c "import aws_encryption_sdk; print(f'Using aws-encryption-sdk version: {aws_encryption_sdk.__version__}')"
30+
31+
# Set initial retry count
32+
- NUM_RETRIES=3
33+
34+
# Run non-MPL-specific tests with the MPL installed
35+
- |
36+
echo "Running standard examples"
37+
while [ $NUM_RETRIES -gt 0 ]
38+
do
39+
tox -e validate-pypi-release -- $VERSION
40+
if [ $? -eq 0 ]; then
41+
echo "Standard examples successful"
42+
break
43+
fi
44+
NUM_RETRIES=$((NUM_RETRIES-1))
45+
if [ $NUM_RETRIES -eq 0 ]; then
46+
echo "All standard example attempts failed, stopping"
47+
exit 1
48+
else
49+
echo "Standard examples failed, retrying in 60 seconds; will retry $NUM_RETRIES more times" && sleep 60
50+
fi
51+
done
52+
53+
# Assume special role for MPL-specific tests
54+
- echo "Running tests with special role for MPL features"
55+
- TMP_ROLE=$(aws sts assume-role --role-arn "arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Python-Role-us-west-2" --role-session-name "CB-ValidateReleased")
56+
- export TMP_ROLE
57+
- export AWS_ACCESS_KEY_ID=$(echo "${TMP_ROLE}" | jq -r '.Credentials.AccessKeyId')
58+
- export AWS_SECRET_ACCESS_KEY=$(echo "${TMP_ROLE}" | jq -r '.Credentials.SecretAccessKey')
59+
- export AWS_SESSION_TOKEN=$(echo "${TMP_ROLE}" | jq -r '.Credentials.SessionToken')
60+
- aws sts get-caller-identity
61+
62+
# Run MPL examples with a fresh retry count
63+
- NUM_RETRIES=3
64+
- |
65+
echo "Running MPL examples"
66+
while [ $NUM_RETRIES -gt 0 ]
67+
do
68+
tox -e validate-pypi-release-mpl -- $VERSION
69+
if [ $? -eq 0 ]; then
70+
echo "MPL examples successful"
71+
break
72+
fi
73+
NUM_RETRIES=$((NUM_RETRIES-1))
74+
if [ $NUM_RETRIES -eq 0 ]; then
75+
echo "All MPL example attempts failed, stopping"
76+
exit 1
77+
else
78+
echo "MPL examples failed, retrying in 60 seconds; will retry $NUM_RETRIES more times" && sleep 60
79+
fi
80+
done
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
version: 0.2
2+
3+
env:
4+
variables:
5+
# Default VERSION if not provided externally
6+
VERSION: 4.0.2
7+
8+
phases:
9+
install:
10+
commands:
11+
- cd ..
12+
- pip install "tox < 4.0" poetry
13+
- pip install --upgrade pip
14+
# Get Dafny
15+
- curl https://github.com/dafny-lang/dafny/releases/download/v4.9.0/dafny-4.9.0-x64-ubuntu-20.04.zip -L -o dafny.zip
16+
- unzip -qq dafny.zip && rm dafny.zip
17+
- export PATH="$PWD/dafny:$PATH"
18+
- cd aws-encryption-sdk-python/
19+
runtime-versions:
20+
python: latest
21+
dotnet: 6.0
22+
pre_build:
23+
commands:
24+
# Setup environment
25+
- aws configure set region us-west-2
26+
- git clone https://github.com/aws/aws-encryption-sdk.git
27+
- cd aws-encryption-sdk && git submodule update --init --recursive && cd ..
28+
# Install packages and setup environments
29+
- pip install "aws-encryption-sdk[MPL]==$VERSION"
30+
- pyenv install --skip-existing 3.11.0 && pyenv local 3.11.0
31+
- make -C aws-encryption-sdk/mpl/StandardLibrary setup_net
32+
- pip install pytest boto3 attrs cryptography
33+
build:
34+
commands:
35+
- NUM_RETRIES=3
36+
- |
37+
run_command() {
38+
eval "$1"
39+
return $?
40+
}
41+
42+
# Navigate to TestVectors directory
43+
cd aws-encryption-sdk/TestVectors || exit 1
44+
45+
while [ $NUM_RETRIES -gt 0 ]
46+
do
47+
48+
# Build TestVectors implementation in Python
49+
CORES=$(nproc || echo 4)
50+
if ! run_command "make transpile_python CORES=$CORES"; then
51+
NUM_RETRIES=$((NUM_RETRIES-1))
52+
[ $NUM_RETRIES -gt 0 ] && sleep 60 && continue
53+
exit 1
54+
fi
55+
56+
# Run all the test vector commands together
57+
if ! run_command "make test_generate_vectors_python && make test_encrypt_vectors_python && make test_decrypt_encrypt_vectors_python"; then
58+
NUM_RETRIES=$((NUM_RETRIES-1))
59+
[ $NUM_RETRIES -gt 0 ] && sleep 60 && continue
60+
exit 1
61+
fi
62+
63+
# Success
64+
break
65+
done

0 commit comments

Comments
 (0)