Skip to content

Commit 19975b9

Browse files
imabhichowtexastonyseebees
authored
test: Run ESDK .NET v4.0.1 Test Vectors in CI (#1979)
Co-authored-by: Tony Knapp <[email protected]> Co-authored-by: seebees <[email protected]>
1 parent 713ca11 commit 19975b9

File tree

6 files changed

+329
-56
lines changed

6 files changed

+329
-56
lines changed

.github/workflows/ci.yml

+60
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,66 @@ jobs:
5858
env-vars-for-codebuild: JAVA_ENV_VERSION
5959
env:
6060
JAVA_ENV_VERSION: ${{ matrix.platform.distribution }}${{ matrix.version }}
61+
vectorTestsMasterKeyProvider:
62+
name: Vector Tests MasterKeyProvider
63+
runs-on: ubuntu-latest
64+
strategy:
65+
fail-fast: true
66+
matrix:
67+
platform:
68+
- distribution: openjdk
69+
image: "aws/codebuild/standard:3.0"
70+
- distribution: corretto
71+
image: "aws/codebuild/amazonlinux2-x86_64-standard:3.0" # Corretto only runs on AL2
72+
version: [ 8, 11 ]
73+
steps:
74+
- name: Configure AWS Credentials
75+
uses: aws-actions/configure-aws-credentials@v2
76+
with:
77+
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
78+
aws-region: us-west-2
79+
role-duration-seconds: 3600
80+
- name: Vector Tests ${{ matrix.platform.distribution }}${{ matrix.version }}
81+
uses: aws-actions/aws-codebuild-run-build@v1
82+
timeout-minutes: 60
83+
with:
84+
project-name: AWS-ESDK-Java-CI
85+
buildspec-override: codebuild/ci/vectors-ci-mkp.yml
86+
compute-type-override: BUILD_GENERAL1_LARGE
87+
image-override: ${{ matrix.platform.image }}
88+
env-vars-for-codebuild: JAVA_ENV_VERSION
89+
env:
90+
JAVA_ENV_VERSION: ${{ matrix.platform.distribution }}${{ matrix.version }}
91+
netVectorTests:
92+
name: ESDK-NET Vector Tests
93+
runs-on: ubuntu-latest
94+
strategy:
95+
fail-fast: true
96+
matrix:
97+
platform:
98+
- distribution: openjdk
99+
image: "aws/codebuild/standard:3.0"
100+
- distribution: corretto
101+
image: "aws/codebuild/amazonlinux2-x86_64-standard:3.0" # Corretto only runs on AL2
102+
version: [ 8, 11 ]
103+
steps:
104+
- name: Configure AWS Credentials
105+
uses: aws-actions/configure-aws-credentials@v2
106+
with:
107+
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
108+
aws-region: us-west-2
109+
role-duration-seconds: 3600
110+
- name: Vector Tests ${{ matrix.platform.distribution }}${{ matrix.version }}
111+
uses: aws-actions/aws-codebuild-run-build@v1
112+
timeout-minutes: 60
113+
with:
114+
project-name: AWS-ESDK-Java-CI
115+
buildspec-override: codebuild/ci/net-vectors-ci.yml
116+
compute-type-override: BUILD_GENERAL1_LARGE
117+
image-override: ${{ matrix.platform.image }}
118+
env-vars-for-codebuild: JAVA_ENV_VERSION
119+
env:
120+
JAVA_ENV_VERSION: ${{ matrix.platform.distribution }}${{ matrix.version }}
61121
generateTestVectors:
62122
name: Generate Vectors
63123
runs-on: ubuntu-latest

codebuild/ci/net-vectors-ci.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: 0.2
2+
# Runs Only the ESDK-NET v4.0.1 Decryption Vectors, testing Required EC CMM
3+
phases:
4+
install:
5+
runtime-versions:
6+
java: $JAVA_ENV_VERSION
7+
commands:
8+
- git submodule update --init submodules/MaterialProviders
9+
# Get Dafny
10+
- curl https://github.com/dafny-lang/dafny/releases/download/v4.2.0/dafny-4.2.0-x64-ubuntu-20.04.zip -L -o dafny.zip
11+
- unzip -qq dafny.zip && rm dafny.zip
12+
- export PATH="$PWD/dafny:$PATH"
13+
# Get Gradle 7.6
14+
- curl https://services.gradle.org/distributions/gradle-7.6-all.zip -L -o gradle.zip
15+
- unzip -qq gradle.zip && rm gradle.zip
16+
- export PATH="$PWD/gradle-7.6/bin:$PATH"
17+
pre_build:
18+
commands:
19+
# Assume Role to access non-prod resources
20+
- TMP_ROLE=$(aws sts assume-role --role-arn "arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Java-Role-us-west-2" --role-session-name "CB-TestVectorResources")
21+
- export TMP_ROLE
22+
- export AWS_ACCESS_KEY_ID=$(echo "${TMP_ROLE}" | jq -r '.Credentials.AccessKeyId')
23+
- export AWS_SECRET_ACCESS_KEY=$(echo "${TMP_ROLE}" | jq -r '.Credentials.SecretAccessKey')
24+
- export AWS_SESSION_TOKEN=$(echo "${TMP_ROLE}" | jq -r '.Credentials.SessionToken')
25+
- aws sts get-caller-identity
26+
27+
# Build and deploy TestVectors to maven local
28+
- cd submodules/MaterialProviders/TestVectorsAwsCryptographicMaterialProviders/
29+
- make build_java && make mvn_local_deploy
30+
- cd $CODEBUILD_SRC_DIR
31+
32+
# Fetch ESDK .NET v4.0.1 Test Vectors
33+
- VECTOR_ZIP=$CODEBUILD_SRC_DIR/v4-Net-4.0.1.zip
34+
- VECTORS_URL=https://github.com/aws/aws-encryption-sdk-dafny/raw/mainline/AwsEncryptionSDK/runtimes/net/TestVectorsNative/TestVectors/resources/v4-Net-4.0.1.zip
35+
- curl -s --output $VECTOR_ZIP --location $VECTORS_URL
36+
build:
37+
commands:
38+
# NOTE: We need to pass the absolute path of the vectors
39+
- mvn -B -ntp install -Dgpg.skip=true -Djacoco.skip=true "-Dtest=TestVectorRunner" "-DtestVectorZip=file://$VECTOR_ZIP"

codebuild/ci/vectors-ci-mkp.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
version: 0.2
2+
# Runs "Golden Manifest" against legacy Master Key Providers
3+
phases:
4+
install:
5+
runtime-versions:
6+
java: $JAVA_ENV_VERSION
7+
commands:
8+
- git submodule update --init submodules/MaterialProviders
9+
# Get Dafny
10+
- curl https://github.com/dafny-lang/dafny/releases/download/v4.2.0/dafny-4.2.0-x64-ubuntu-20.04.zip -L -o dafny.zip
11+
- unzip -qq dafny.zip && rm dafny.zip
12+
- export PATH="$PWD/dafny:$PATH"
13+
# Get Gradle 7.6
14+
- curl https://services.gradle.org/distributions/gradle-7.6-all.zip -L -o gradle.zip
15+
- unzip -qq gradle.zip && rm gradle.zip
16+
- export PATH="$PWD/gradle-7.6/bin:$PATH"
17+
pre_build:
18+
commands:
19+
# Assume Role to access non-prod resources
20+
- TMP_ROLE=$(aws sts assume-role --role-arn "arn:aws:iam::370957321024:role/GitHub-CI-Public-ESDK-Java-Role-us-west-2" --role-session-name "CB-TestVectorResources")
21+
- export TMP_ROLE
22+
- export AWS_ACCESS_KEY_ID=$(echo "${TMP_ROLE}" | jq -r '.Credentials.AccessKeyId')
23+
- export AWS_SECRET_ACCESS_KEY=$(echo "${TMP_ROLE}" | jq -r '.Credentials.SecretAccessKey')
24+
- export AWS_SESSION_TOKEN=$(echo "${TMP_ROLE}" | jq -r '.Credentials.SessionToken')
25+
- aws sts get-caller-identity
26+
27+
# Build and deploy TestVectors to maven local
28+
- cd submodules/MaterialProviders/TestVectorsAwsCryptographicMaterialProviders/
29+
- make build_java && make mvn_local_deploy
30+
- cd $CODEBUILD_SRC_DIR
31+
build:
32+
commands:
33+
# Enable masterKey to run Test Vectors against MasterKeyProvider
34+
# NOTE: We need to pass the absolute path of the vectors
35+
- mvn -B -ntp install -Dgpg.skip=true -Djacoco.skip=true "-Dtest=TestVectorRunner" "-Dmasterkey=true" "-DtestVectorZip=file://$CODEBUILD_SRC_DIR/src/test/resources/aws-encryption-sdk-test-vectors/vectors/awses-decrypt/python-2.3.0.zip"

codebuild/ci/vectors-ci.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version: 0.2
2-
2+
# Runs "Golden Manifest" against Keyrings
33
phases:
44
install:
55
runtime-versions:
@@ -30,4 +30,5 @@ phases:
3030
- cd $CODEBUILD_SRC_DIR
3131
build:
3232
commands:
33+
# NOTE: We need to pass the absolute path of the vectors
3334
- mvn install -T 8 -Dgpg.skip=true -ntp "-DtestVectorZip=file://$CODEBUILD_SRC_DIR/src/test/resources/aws-encryption-sdk-test-vectors/vectors/awses-decrypt/python-2.3.0.zip"

0 commit comments

Comments
 (0)