This repository has been archived by the owner on Oct 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
1,719 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!groovy | ||
pipeline { | ||
agent { | ||
label { | ||
label "aws-sct-builders-eu-west-1" | ||
} | ||
} | ||
options { | ||
timestamps() | ||
disableConcurrentBuilds() | ||
timeout([time: 30, unit: 'MINUTES']) | ||
buildDiscarder(logRotator(numToKeepStr: '20')) | ||
} | ||
stages { | ||
stage('Checkout') { | ||
steps { | ||
checkout scm | ||
} | ||
} | ||
stage('create virtualenv') { | ||
steps { | ||
script { | ||
wrap([$class: 'BuildUser']) { | ||
dir('cloudformation') { | ||
sh """ | ||
#!/bin/bash | ||
set -xe | ||
python3 -m venv .venv3 | ||
source .venv3/bin/activate | ||
pip install --upgrade pip | ||
pip install -r requirements.txt | ||
""" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
stage('test') { | ||
steps { | ||
script { | ||
wrap([$class: 'BuildUser']) { | ||
dir('cloudformation') { | ||
sh """ | ||
#!/bin/bash | ||
set -xe | ||
source .venv3/bin/activate | ||
# regenerate the teample | ||
jinja2 scylla.yaml.j2 > scylla.yaml | ||
# lint the template | ||
cfn-lint --template scylla.yaml --region us-east-1 | ||
# running the test | ||
pytest --log-cli-level info | ||
""" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
## Installation | ||
``` | ||
python3 -m venv .venv3 | ||
source .venv3/bin/activate | ||
install -r requirements.txt | ||
``` | ||
|
||
## Testing | ||
``` bash | ||
# regenerate the teample | ||
jinja2 scylla.yaml.j2 > scylla.yaml | ||
|
||
# lint the template | ||
cfn-lint --template scylla.yaml --region us-east-1 | ||
|
||
# running the test | ||
pytest --log-cli-level info | ||
``` | ||
|
||
# Using the template | ||
``` | ||
# run the template from command line | ||
aws cloudformation create-stack --region eu-west-1 --stack-name fruch-test-05 --template-body file://scylla.yaml \ | ||
--parameters ParameterKey=KeyName,ParameterValue=scylla-qa-ec2 \ | ||
ParameterKey=InstanceType,ParameterValue=i3.large \ | ||
ParameterKey=AvailabilityZone,ParameterValue=eu-west-1a \ | ||
ParameterKey=ClusterName,ParameterValue=fruch \ | ||
ParameterKey=InstanceCount,ParameterValue=3 \ | ||
ParameterKey=ScyllaAmi,ParameterValue=ami-0ececa5cacea302a8 | ||
``` | ||
Example of link to start the cloudforamtion: | ||
|
||
https://eu-west-1.console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stacks/create/review?templateURL=https://s3-eu-west-1.amazonaws.com/cf-templates-1jy8um4tbzwit-eu-west-1/2019241R3e-scylla.templateenk889k0zz&stackName=fruch-test¶m_ScyllaAmi=ami-0ececa5cacea302a8 | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
def pytest_addoption(parser): | ||
parser.addoption("--keep-cfn", action="store_true", default=False) | ||
parser.addoption("--stack-name", action="store", default=None) | ||
parser.addoption("--region", action="store", default="us-east-1") | ||
parser.addoption("--ami", action="store", default="ami-0b48ed57ebc0d5f06") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[pytest] | ||
log_format = %(asctime)s %(levelname)s %(message)s | ||
log_date_format = %Y-%m-%d %H:%M:%S |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
cfn-lint==0.23.4 | ||
boto3==1.9.216 | ||
pytest==5.1.1 | ||
Jinja2==2.10.1 | ||
jinja2-cli==0.7.0 |
Oops, something went wrong.