Skip to content

Commit 152a130

Browse files
authored
Integ/Load tests: Fix buildspec such that it skips when publish=false. (#1032)
1 parent 0d29e39 commit 152a130

File tree

2 files changed

+73
-73
lines changed

2 files changed

+73
-73
lines changed

buildspec_integ.yml

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,32 @@ phases:
2929
3030
if [ "${PUBLISH_ENABLED}" = "false" ]; then
3131
echo "Publishing is disabled for BUILD_VERSION=${BUILD_VERSION}, skipping integration tests"
32-
exit 0
33-
fi
34-
- |
35-
# Enforce STS regional endpoints and set validator images
36-
export AWS_STS_REGIONAL_ENDPOINTS=regional
37-
export CW_INTEG_VALIDATOR_IMAGE_BASE=${AWS_ACCOUNT}.dkr.ecr.us-west-2.amazonaws.com/cw-integ-validator
38-
export S3_INTEG_VALIDATOR_IMAGE_BASE=${AWS_ACCOUNT}.dkr.ecr.us-west-2.amazonaws.com/s3-integ-validator
39-
- |
40-
# Get the default credentials and set as environment variables
41-
CREDS=$(curl 169.254.170.2$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI)
42-
export AWS_ACCESS_KEY_ID=$(echo $CREDS | jq -r .AccessKeyId)
43-
export AWS_SECRET_ACCESS_KEY=$(echo $CREDS | jq -r .SecretAccessKey)
44-
export AWS_SESSION_TOKEN=$(echo $CREDS | jq -r .Token)
45-
- aws ecr get-login-password --region ${AWS_REGION} | docker login --username AWS --password-stdin ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com
46-
- |
47-
# Set image tag based on BUILD_VERSION
48-
if [ "$BUILD_VERSION" = "2" ]; then
49-
IMAGE_TAG="latest"
50-
elif [ "$BUILD_VERSION" = "3" ]; then
51-
IMAGE_TAG="latest-3"
32+
else
33+
# Enforce STS regional endpoints and set validator images
34+
export AWS_STS_REGIONAL_ENDPOINTS=regional
35+
export CW_INTEG_VALIDATOR_IMAGE_BASE=${AWS_ACCOUNT}.dkr.ecr.us-west-2.amazonaws.com/cw-integ-validator
36+
export S3_INTEG_VALIDATOR_IMAGE_BASE=${AWS_ACCOUNT}.dkr.ecr.us-west-2.amazonaws.com/s3-integ-validator
37+
38+
# Get the default credentials and set as environment variables
39+
CREDS=$(curl 169.254.170.2$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI)
40+
export AWS_ACCESS_KEY_ID=$(echo $CREDS | jq -r .AccessKeyId)
41+
export AWS_SECRET_ACCESS_KEY=$(echo $CREDS | jq -r .SecretAccessKey)
42+
export AWS_SESSION_TOKEN=$(echo $CREDS | jq -r .Token)
43+
44+
aws ecr get-login-password --region ${AWS_REGION} | docker login --username AWS --password-stdin ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com
45+
46+
# Set image tag based on BUILD_VERSION
47+
if [ "$BUILD_VERSION" = "2" ]; then
48+
IMAGE_TAG="latest"
49+
elif [ "$BUILD_VERSION" = "3" ]; then
50+
IMAGE_TAG="latest-3"
51+
fi
52+
53+
docker pull ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:${IMAGE_TAG}
54+
docker tag ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:${IMAGE_TAG} amazon/aws-for-fluent-bit:latest
55+
docker images
56+
make integ
5257
fi
53-
- docker pull ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:${IMAGE_TAG}
54-
- docker tag ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:${IMAGE_TAG} amazon/aws-for-fluent-bit:latest
55-
- docker images
56-
- make integ
5758
5859
artifacts:
5960
files:

buildspec_load_test.yml

Lines changed: 48 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -60,56 +60,55 @@ phases:
6060
6161
if [ "${PUBLISH_ENABLED}" = "false" ]; then
6262
echo "Publishing is disabled for BUILD_VERSION=${BUILD_VERSION}, skipping load tests"
63-
exit 0
64-
fi
65-
# Set stack names based on BUILD_VERSION.
66-
# Do not add BUILD_VERSION for BUILD_VERSION=2 to make load test work with existing resources.
67-
# This can be changed once naming is aligned and resources are resynthesized for BUILD_VERSION=2
68-
- |
69-
if [ "$BUILD_VERSION" = "2" ]; then
70-
export TESTING_RESOURCES_STACK_NAME='load-test-fluent-bit-testing-resources'
71-
export LOG_STORAGE_STACK_NAME='load-test-fluent-bit-log-storage'
72-
export EKS_CLUSTER_NAME='load-test-fluent-bit-eks-cluster'
73-
else
74-
export TESTING_RESOURCES_STACK_NAME="load-test-fluent-bit-testing-resources-v${BUILD_VERSION}"
75-
export LOG_STORAGE_STACK_NAME="load-test-fluent-bit-log-storage-v${BUILD_VERSION}"
76-
export EKS_CLUSTER_NAME="load-test-fluent-bit-eks-cluster-v${BUILD_VERSION}"
77-
fi
78-
echo "Using TESTING_RESOURCES_STACK_NAME: $TESTING_RESOURCES_STACK_NAME"
79-
echo "Using LOG_STORAGE_STACK_NAME: $LOG_STORAGE_STACK_NAME"
80-
echo "Using EKS_CLUSTER_NAME: $EKS_CLUSTER_NAME"
81-
# Execute load test commands (common logic for all supported BUILD_VERSIONs)
82-
- |
83-
if [ "$BUILD_VERSION" = "2" ] || [ "$BUILD_VERSION" = "3" ]; then
84-
# need this for multiline code blocks to raise any errors to codebuild
85-
set -e
86-
echo "Running load tests for AWS for Fluent Bit version $BUILD_VERSION"
87-
88-
# Activate Python virtual environment and install the AWS CDK core dependencies
89-
python -m venv venv
90-
source venv/bin/activate
91-
pip install -r ./load_tests/requirements.txt
92-
if [ "${PLATFORM}" == "EKS" ]; then
93-
aws eks update-kubeconfig --name $EKS_CLUSTER_NAME
94-
fi
95-
CREDS=$(aws sts assume-role --role-arn $LOAD_TEST_CFN_ROLE_ARN --role-session-name load-test-cfn --duration-seconds 3600)
96-
export CREDS
97-
export AWS_ACCESS_KEY_ID=$(echo "${CREDS}" | jq -r '.Credentials.AccessKeyId')
98-
export AWS_SECRET_ACCESS_KEY=$(echo "${CREDS}" | jq -r '.Credentials.SecretAccessKey')
99-
export AWS_SESSION_TOKEN=$(echo "${CREDS}" | jq -r '.Credentials.SessionToken')
100-
# Create and set up related testing resources
101-
python ./load_tests/load_test.py create_testing_resources
102-
source ./load_tests/setup_test_environment.sh
103-
export AWS_ACCESS_KEY_ID=""
104-
export AWS_SECRET_ACCESS_KEY=""
105-
export AWS_SESSION_TOKEN=""
106-
# Run load tests on corresponding platform
107-
python ./load_tests/load_test.py ${PLATFORM}
108-
10963
else
110-
echo "Unsupported BUILD_VERSION: $BUILD_VERSION"
111-
echo "Supported versions are: 2, 3"
112-
exit 1
64+
# Set stack names based on BUILD_VERSION.
65+
# Do not add BUILD_VERSION for BUILD_VERSION=2 to make load test work with existing resources.
66+
# This can be changed once naming is aligned and resources are resynthesized for BUILD_VERSION=2
67+
if [ "$BUILD_VERSION" = "2" ]; then
68+
export TESTING_RESOURCES_STACK_NAME='load-test-fluent-bit-testing-resources'
69+
export LOG_STORAGE_STACK_NAME='load-test-fluent-bit-log-storage'
70+
export EKS_CLUSTER_NAME='load-test-fluent-bit-eks-cluster'
71+
else
72+
export TESTING_RESOURCES_STACK_NAME="load-test-fluent-bit-testing-resources-v${BUILD_VERSION}"
73+
export LOG_STORAGE_STACK_NAME="load-test-fluent-bit-log-storage-v${BUILD_VERSION}"
74+
export EKS_CLUSTER_NAME="load-test-fluent-bit-eks-cluster-v${BUILD_VERSION}"
75+
fi
76+
echo "Using TESTING_RESOURCES_STACK_NAME: $TESTING_RESOURCES_STACK_NAME"
77+
echo "Using LOG_STORAGE_STACK_NAME: $LOG_STORAGE_STACK_NAME"
78+
echo "Using EKS_CLUSTER_NAME: $EKS_CLUSTER_NAME"
79+
80+
# Execute load test commands (common logic for all supported BUILD_VERSIONs)
81+
if [ "$BUILD_VERSION" = "2" ] || [ "$BUILD_VERSION" = "3" ]; then
82+
# need this for multiline code blocks to raise any errors to codebuild
83+
set -e
84+
echo "Running load tests for AWS for Fluent Bit version $BUILD_VERSION"
85+
86+
# Activate Python virtual environment and install the AWS CDK core dependencies
87+
python -m venv venv
88+
source venv/bin/activate
89+
pip install -r ./load_tests/requirements.txt
90+
if [ "${PLATFORM}" == "EKS" ]; then
91+
aws eks update-kubeconfig --name $EKS_CLUSTER_NAME
92+
fi
93+
CREDS=$(aws sts assume-role --role-arn $LOAD_TEST_CFN_ROLE_ARN --role-session-name load-test-cfn --duration-seconds 3600)
94+
export CREDS
95+
export AWS_ACCESS_KEY_ID=$(echo "${CREDS}" | jq -r '.Credentials.AccessKeyId')
96+
export AWS_SECRET_ACCESS_KEY=$(echo "${CREDS}" | jq -r '.Credentials.SecretAccessKey')
97+
export AWS_SESSION_TOKEN=$(echo "${CREDS}" | jq -r '.Credentials.SessionToken')
98+
# Create and set up related testing resources
99+
python ./load_tests/load_test.py create_testing_resources
100+
source ./load_tests/setup_test_environment.sh
101+
export AWS_ACCESS_KEY_ID=""
102+
export AWS_SECRET_ACCESS_KEY=""
103+
export AWS_SESSION_TOKEN=""
104+
# Run load tests on corresponding platform
105+
python ./load_tests/load_test.py ${PLATFORM}
106+
107+
else
108+
echo "Unsupported BUILD_VERSION: $BUILD_VERSION"
109+
echo "Supported versions are: 2, 3"
110+
exit 1
111+
fi
113112
fi
114113
finally:
115114
# Clear up testing resources

0 commit comments

Comments
 (0)