forked from abelnieva/API-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Ruben Galeano
committed
Dec 29, 2020
1 parent
1cffd4f
commit 6c960c1
Showing
17 changed files
with
856 additions
and
38 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
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 @@ | ||
pipeline { | ||
agent any | ||
stages { | ||
// Limpieza del entorno ante ejecuciones previas | ||
stage('Clean'){ | ||
steps { | ||
deleteDir() | ||
sh 'printenv' | ||
} | ||
} | ||
// Configuración de las credenciales temporales de la cuenta educate | ||
stage('Setup Credentials'){ | ||
steps { | ||
deleteDir() | ||
sh "echo ${env.CREDENTIALS} > /var/lib/jenkins/.aws/credentials" | ||
writeFile (file: '/var/lib/jenkins/.aws/credentials', text: "${env.CREDENTIALS}") | ||
|
||
} | ||
} | ||
// Validación de las credenciales temporales haciendo una petición a la API de aws a través del aws cli | ||
stage('Validate Credentials'){ | ||
steps { | ||
deleteDir() | ||
sh "aws s3 ls" | ||
} | ||
} | ||
// Validación del software instalado en el servicio | ||
stage('Validate software'){ | ||
steps { | ||
sh 'sam --version' | ||
sh 'aws --version' | ||
sh 'python3.8 --version' | ||
} | ||
} | ||
} | ||
} |
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 @@ | ||
//A rellenar por el alumno |
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 @@ | ||
// A rellenar por el alumno |
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,86 @@ | ||
pipeline { | ||
agent any | ||
stages { | ||
stage('Clean'){ | ||
steps { | ||
deleteDir() | ||
sh 'printenv' | ||
} | ||
} | ||
|
||
stage('Checkout') { | ||
steps { | ||
// Get some code from a CodeCommit repository | ||
sh "git clone https://${env.CODECOMMIT_USER}:${env.CODECOMMIT_PASSWORD}@git-codecommit.us-east-1.amazonaws.com/v1/repos/todo-list-serverless" | ||
} | ||
} | ||
stage('SetUp'){ | ||
steps{ | ||
// Setup Virtualenv for testing | ||
} | ||
} | ||
stage('Test'){ | ||
steps{ | ||
dir("todo-list-serverless/test") { | ||
// Static program analysis -> radon | ||
echo 'Make some cool static program analysis wich radon. IIs the code enought simple to understand?' | ||
} | ||
} | ||
steps{ | ||
dir("todo-list-serverless/test") { | ||
// Quality program analysis -> flake8 | ||
echo 'echo My code has enought quality?' | ||
} | ||
} | ||
steps{ | ||
dir("todo-list-serverless/test") { | ||
// Security programa analysis -> bandit | ||
echo 'Make some security analysis of the code. Is the code secure?' | ||
} | ||
} | ||
steps{ | ||
dir("todo-list-serverless/test") { | ||
// Unitary testing -> unittest or pytest | ||
// Coverage report -> coverage | ||
echo 'Execute something like coverage run -m & coverage report -m' | ||
} | ||
} | ||
} | ||
stage('Build') { | ||
steps { | ||
dir("todo-list-serverless") { | ||
// Build release | ||
echo 'Maybe something like sam build?' | ||
// Package release and persist in s3 bucket | ||
sh "sam package --template-file template.yaml --output-template-file packaged.yaml --s3-bucket ${env.COUNTRY}-${env.TEAM}-${env.ENVIRONMENT}-${env.SERVICE}-${env.RAND_ID}-artifacts" | ||
} | ||
} | ||
} | ||
stage('Build') { | ||
steps{ | ||
dir("todo-list-serverless/test") { | ||
// Unittest or pytest | ||
// Integration test over local -> unittest or pytest against the lambda functions. | ||
echo 'test all methods works fine. Maybe with sam-local and aws dynamodb official docker image' | ||
} | ||
} | ||
} | ||
stage('Deploy'){ | ||
steps{ | ||
dir("todo-list-serverless") { | ||
// Deploy architecture | ||
sh "yes | sam deploy --template-file packaged.yaml --stack-name ${env.STACK_NAME} --parameter-overrides Environment=${env.ENVIRONMENT}" | ||
} | ||
} | ||
} | ||
stage('Integration Test after deploy'){ | ||
steps{ | ||
dir("todo-list-serverless") { | ||
// Unittest or pytest | ||
// Unitary testing -> unittest or pytest against the lambda functions. | ||
echo 'test all methods works fine' | ||
} | ||
} | ||
} | ||
} | ||
} |
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,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
|
||
# Download terraform | ||
wget https://releases.hashicorp.com/terraform/0.14.3/terraform_0.14.3_linux_amd64.zip | ||
# Unzip terraform | ||
unzip terraform | ||
# remove terraform zip | ||
rm -f terraform_0.14.3_linux_amd64.zip | ||
|
||
|
||
# terraform init | ||
./terraform init | ||
# terraform validate | ||
./terraform validate | ||
# terraform plan -out plan | ||
./terraform plan -out=plan | ||
# terraform apply plan | ||
yes | ./terraform apply plan | ||
|
||
# clean wokspace | ||
rm -rf .terraform |
Oops, something went wrong.