forked from aws/aws-for-fluent-bit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec_load_test.yml
77 lines (76 loc) · 3.2 KB
/
buildspec_load_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
version: 0.2
env:
shell: bash
variables:
THROUGHPUT_LIST: '["20m", "25m", "30m"]'
CW_THROUGHPUT_LIST: '["1m", "2m", "3m"]'
TESTING_RESOURCES_STACK_NAME: 'load-test-fluent-bit-testing-resources'
LOG_STORAGE_STACK_NAME: 'load-test-fluent-bit-log-storage'
EKS_CLUSTER_NAME: 'load-test-fluent-bit-eks-cluster'
PREFIX: 'load-test-fluent-bit-'
phases:
install:
runtime-versions:
golang: 1.16
python: 3.x
nodejs: 14
pre_build:
commands:
- echo Running the load tests
# upgrade node version
- npm install -g n
- n stable
# install cdk
- npm config set prefix /usr/local
- npm install -g [email protected]
# install eksctl
- curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
- mv /tmp/eksctl /usr/local/bin
# install kubectl
- curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/kubectl
- chmod +x ./kubectl
- mkdir -p $HOME/bin && cp ./kubectl $HOME/bin/kubectl && export PATH=$PATH:$HOME/bin
- echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc
# install aws
- pip3 uninstall awscli -y
- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
- unzip awscliv2.zip
- ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/bin --update
- which aws
- aws --version
# install aws-iam-authenticator
- curl -o aws-iam-authenticator https://amazon-eks.s3.us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/aws-iam-authenticator
- chmod +x ./aws-iam-authenticator
- mkdir -p $HOME/bin && cp ./aws-iam-authenticator $HOME/bin/aws-iam-authenticator && export PATH=$PATH:$HOME/bin
- echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc
# pre-config
- aws configure set default.region us-west-2
build:
commands:
# Activate Python virtual environment and install the AWS CDK core dependencies
- python -m venv venv
- source venv/bin/activate
- pip install -r ./load_tests/requirements.txt
- |
if [ "${PLATFORM}" == "EKS" ]; then
aws eks update-kubeconfig --name $EKS_CLUSTER_NAME
fi
- CREDS=$(aws sts assume-role --role-arn $LOAD_TEST_CFN_ROLE_ARN --role-session-name load-test-cfn --duration-seconds 3600)
- export CREDS
- export AWS_ACCESS_KEY_ID=$(echo "${CREDS}" | jq -r '.Credentials.AccessKeyId')
- export AWS_SECRET_ACCESS_KEY=$(echo "${CREDS}" | jq -r '.Credentials.SecretAccessKey')
- export AWS_SESSION_TOKEN=$(echo "${CREDS}" | jq -r '.Credentials.SessionToken')
# Create and set up related testing resources
- python ./load_tests/load_test.py create_testing_resources
- source ./load_tests/setup_test_environment.sh
- export AWS_ACCESS_KEY_ID=""
- export AWS_SECRET_ACCESS_KEY=""
- export AWS_SESSION_TOKEN=""
# Run load tests on corresponding platform
- python ./load_tests/load_test.py ${PLATFORM}
finally:
# Clear up testing resources
- python ./load_tests/load_test.py delete_testing_resources
artifacts:
files:
- '**/*'