This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_bucket(self, bucket_name, region=None): | |
speak_output = "" | |
try: | |
s3_client.create_bucket(Bucket=bucket_name) | |
except ClientError as e: | |
logging.error(e) | |
if e.response['Error']['Code'] == "BucketAlreadyExists": | |
speak_output = "The requested bucket name is either not available, already \ | |
exists or not unique to AWS, please select a different name and try again." | |
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -ex | |
install_k6() { | |
apt-get update | |
apt-get install dirmngr --install-recommends | |
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61 | |
echo "deb https://dl.bintray.com/loadimpact/deb stable main" | sudo tee -a /etc/apt/sources.list | |
apt-get update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent any | |
environment { | |
K6_API_TOKEN=credentials("K6_API_TOKEN") | |
} | |
stages { | |
stage('Performance Testing') { | |
steps { | |
echo 'Running K6 performance tests...' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -ex | |
public_ip_address=$(curl -q http://checkip.amazonaws.com) | |
/root/bin/aws ec2 authorize-security-group-ingress --group-id sg-006b570caa40214f1 --ip-permissions "[{\"IpProtocol\": \"tcp\", \"FromPort\": 443, \"ToPort\": 443, \"IpRanges\": [{\"CidrIp\": \"${public_ip_address}/32\"}]}]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -ex | |
update_cache() { | |
apt-get update | |
} | |
install_aws_cli() { | |
apt-get install curl unzip python2.7 python-pip -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -ex | |
public_ip_address=$(curl -q http://checkip.amazonaws.com) | |
/root/bin/aws ec2 revoke-security-group-ingress --group-id sg-006b570caa40214f1 --ip-permissions "[{\"IpProtocol\": \"tcp\", \"FromPort\": 443, \"ToPort\": 443, \"IpRanges\": [{\"CidrIp\": \"${public_ip_address}/32\"}]}]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default: &defaults | |
parallelism: 1 | |
docker: | |
- image: ubuntu:latest | |
setup: &setup | |
run: | |
name: Installing aws cli and setting it up | |
command: | | |
chmod 777 setup.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent any | |
stages { | |
stage('Performance Testing') { | |
steps { | |
echo 'Running K6 performance tests...' | |
sh 'sudo chmod +x setup.sh' | |
sh 'sudo ./setup.sh' | |
sh 'k6 run tests/test.js' | |
echo 'Completed Running K6 performance tests!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## How do we enable Firewall? If we add the bash scripts as | |
## https://github.com/loadimpact/k6-circleci-example/tree/master/aws | |
## will the following works? | |
make_scripts_executable: &make_scripts_executable | |
run: | |
name: making scripts executable | |
command: | | |
chmod +x ./authorize_aws_security_group.sh | |
chmod +x ./revoke_aws_security_group.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default: &defaults | |
parallelism: 1 | |
docker: | |
- image: loadimpact/k6:latest | |
k6_performance_tests: &k6_performance_tests | |
run: | |
name: Running Load Tests Using K6 | |
command: | | |
k6 cloud tests/cloud-test.js |
NewerOlder