-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor cicd pipeline #764
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.32.0 | ||
2.32.0.20231031 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ env: | |
LOG_STORAGE_STACK_NAME: 'load-test-fluent-bit-log-storage' | ||
EKS_CLUSTER_NAME: 'load-test-fluent-bit-eks-cluster' | ||
PREFIX: 'load-test-fluent-bit-' | ||
# Use the following field to shorten the load tests | ||
# LOAD_TEST_RUN_TIME_IN_SECONDS: 10 # Default 600 | ||
|
||
phases: | ||
install: | ||
|
@@ -61,17 +63,21 @@ phases: | |
- 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 | ||
- | | ||
for i in {1..2}; do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why add retries like this? IIRC I added retries in the python code already, which I think is better than using bash. |
||
python ./load_tests/load_test.py ${PLATFORM} && break \ | ||
|| ( | ||
if [ $i == 2 ]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
echo "Load test retries failed. Exiting." | ||
exit 1 | ||
fi | ||
echo "Retrying load tests. Attempt" $(($i+1))) | ||
done | ||
artifacts: | ||
files: | ||
- '**/*' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there 1.x ?? reduce future upgrade effort > |
||
python: 3.x | ||
nodejs: 14 | ||
pre_build: | ||
commands: | ||
- echo Running the ecs load test infrastructure creation | ||
# upgrade node version | ||
- npm install -g n | ||
- n stable | ||
# install cdk | ||
- npm config set prefix /usr/local | ||
- npm install -g [email protected] | ||
# 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 | ||
# 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 | ||
- 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') | ||
# Clean up testing resources | ||
- python ./load_tests/load_test.py delete_testing_resources | ||
# Create and set up related testing resources | ||
- python ./load_tests/load_test.py create_testing_resources | ||
artifacts: | ||
files: | ||
- '**/*' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
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 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 | ||
# 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 | ||
- 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') | ||
# Clean up testing resources | ||
- python ./load_tests/load_test.py delete_testing_resources | ||
artifacts: | ||
files: | ||
- '**/*' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ phases: | |
fi | ||
|
||
# Push the image to ECR | ||
- './scripts/publish.sh cicd-publish ${REGION_TO_PUSH}' | ||
- './scripts/publish.sh cicd-publish private-ecr' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why make this change? |
||
|
||
# Nullify the temporary credentials for the assumed role to publish | ||
- | | ||
|
@@ -55,7 +55,7 @@ phases: | |
- export AWS_SESSION_TOKEN=`echo $CREDS | jq -r .Credentials.SessionToken` | ||
|
||
# Verify from the verification account | ||
- './scripts/publish.sh cicd-verify ${REGION_TO_PUSH}' | ||
- './scripts/publish.sh cicd-verify-publish private-ecr' | ||
artifacts: | ||
files: | ||
- '**/*' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ phases: | |
commands: | ||
# Enforce STS regional endpoints | ||
- export AWS_STS_REGIONAL_ENDPOINTS=regional | ||
- './scripts/publish.sh cicd-publish-ssm ${AWS_REGION}' | ||
- './scripts/publish.sh cicd-publish-ssm' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? |
||
|
||
# Assume role to verify, get the credentials, and set them as environment variables. | ||
# Verification should be done using the credentials from a different account. It ensures that | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
create_testing_resources/cdk.out | ||
create_testing_resources/kinesis_s3_firehose/cdk.out | ||
create_testing_resources/kinesis_s3_firehose/load-test-fluent-bit- | ||
task_definitions/*_*m.json | ||
__pycache__ | ||
.venv | ||
.venv | ||
.env |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we make this
2
as a configure retry parameter ?