1- # Runs the same tests as examples in an environment with the MPL installed
2- # to assert existing tests continue to pass with the MPL installed.
3- # Then, run MPL-specific tests.
41version : 0.2
52
63env :
74 variables :
8- # No TOXENV. This runs multiple environments.
5+ VERSION : 4.0.2
96 REGION : " us-west-2"
107 AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID : >-
118 arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
@@ -19,23 +16,101 @@ env:
1916phases :
2017 install :
2118 runtime-versions :
22- python : 3.12
23- build :
19+ python : 3.11
2420 commands :
25- - cd /root/.pyenv/plugins/python-build/../.. && git pull && cd -
26- - pyenv install --skip-existing 3.12.0
27- - pyenv local 3.12.0
28- - pip install --upgrade pip
29- - pip install setuptools
21+ # Check VERSION is available from either environment or env.variables
22+ - |
23+ if [ -z "$VERSION" ]; then
24+ echo "Using default VERSION=$VERSION"
25+ else
26+ echo "Using provided VERSION=$VERSION"
27+ fi
28+ # Install the released package instead of the source
29+ - echo "Installing aws-encryption-sdk version $VERSION"
30+ - pip install "aws-encryption-sdk==$VERSION"
3031 - pip install "tox < 4.0"
31- # Run non-MPL-specific tests with the MPL installed
32- - tox -e py312-examples-mpl
33- # Assume special role to access keystore
34- - 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-Py312ExamplesMpl")
32+ build :
33+ commands :
34+ # Create a simple tox.ini file for running examples with the installed package
35+ - |
36+ cat > release_validation_tox.ini << 'EOF'
37+ [tox]
38+ envlist = py311
39+ skipsdist = True
40+
41+ [testenv]
42+ passenv =
43+ AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID
44+ AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID_2
45+ AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_1
46+ AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_2
47+ AWS_ACCESS_KEY_ID
48+ AWS_SECRET_ACCESS_KEY
49+ AWS_SESSION_TOKEN
50+ AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
51+ AWS_PROFILE
52+ deps =
53+ pytest
54+ pytest-mock
55+ mock
56+ coverage
57+ pyyaml
58+ moto
59+ boto3
60+ cryptography
61+ commands =
62+ # Run non-MPL examples
63+ pytest examples/test/legacy/ -m examples
64+ # Run all other examples
65+ pytest examples/test/ -m examples --ignore examples/test/legacy/
66+ EOF
67+
68+ # Run the examples with NUM_RETRIES to handle transient failures
69+ - NUM_RETRIES=3
70+ - |
71+ while [ $NUM_RETRIES -gt 0 ]
72+ do
73+ tox -c release_validation_tox.ini -e py311
74+ if [ $? -eq 0 ]; then
75+ break
76+ fi
77+ NUM_RETRIES=$((NUM_RETRIES-1))
78+ if [ $NUM_RETRIES -eq 0 ]; then
79+ echo "All validation attempts failed, stopping"
80+ exit 1;
81+ else
82+ echo "Validation failed, retrying in 60 seconds; will retry $NUM_RETRIES more times" && sleep 60
83+ fi
84+ done
85+
86+ # Assume special role for MPL-specific tests
87+ - echo "Running tests with special role for MPL features"
88+ - 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")
3589 - export TMP_ROLE
3690 - export AWS_ACCESS_KEY_ID=$(echo "${TMP_ROLE}" | jq -r '.Credentials.AccessKeyId')
3791 - export AWS_SECRET_ACCESS_KEY=$(echo "${TMP_ROLE}" | jq -r '.Credentials.SecretAccessKey')
3892 - export AWS_SESSION_TOKEN=$(echo "${TMP_ROLE}" | jq -r '.Credentials.SessionToken')
3993 - aws sts get-caller-identity
40- # Run MPL-specific tests with special role
41- - tox -e py312-mplexamples-mpl
94+
95+ # Also install MPL requirements
96+ - pip install -r requirements_mpl.txt
97+
98+ # Run MPL-specific examples
99+ - NUM_RETRIES=3
100+ - |
101+ while [ $NUM_RETRIES -gt 0 ]
102+ do
103+ # Only run the MPL-specific tests that require special permissions
104+ # These would normally be run with py311-mplexamples-mpl
105+ python -m pytest examples/test/ -m examples --ignore examples/test/legacy/
106+ if [ $? -eq 0 ]; then
107+ break
108+ fi
109+ NUM_RETRIES=$((NUM_RETRIES-1))
110+ if [ $NUM_RETRIES -eq 0 ]; then
111+ echo "All MPL validation attempts failed, stopping"
112+ exit 1;
113+ else
114+ echo "MPL validation failed, retrying in 60 seconds; will retry $NUM_RETRIES more times" && sleep 60
115+ fi
116+ done
0 commit comments