Skip to content

Commit

Permalink
Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mslosarz committed Mar 8, 2019
1 parent 9d66dc6 commit 2d15305
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
35 changes: 22 additions & 13 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,44 @@
/**
* docker run --name jenkins_local -d -v jenkins_home:/var/jenkins_home -p 9000:8080 -p 50000:50000 jenkins/jenkins:lts
* PLUGINS:
* - Pipeline: AWS Steps
* - Groovy
*
* CREDENTIALS:
* - ADD Jenkins global credentials -> add PRIV_AWS_ACCESS (aws key / assigned to admin user)
* - ADD ssh key for Jenkins user (jenkins / github)
*/
* CREATE FOLDER (name of folder will be used as an environment eg dev/test/prod)
* - inside FOLDER create pipeline project that will points to this Jenkinsfile
*/

def functions

pipeline {
agent any

options {
timeout(time: 15, unit: 'MINUTES')
timeout(time: 15, unit: "MINUTES")
withAWS(region: "${params.AWS_REGION}")
withCredentials([[$class : "AmazonWebServicesCredentialsBinding",
credentialsId : "${params.CREDENTIAL_ID}",
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']])
}

parameters {
text(name: 'CREDENTIAL_ID', defaultValue: 'PRIV_AWS_ACCESS', description: 'Supply name of AWS_KEY (Stored on Jenkins)')
choice(name: 'CREDENTIAL_ID', choices: 'PRIV_AWS_ACCESS', description: 'Supply name of AWS_KEY (Stored on Jenkins)')
choice(name: 'AWS_REGION', choices: 'eu-west-1\neu-west-2', description: 'Pick up region where app should be deployed (Ireland / London)')
}

stages {
stage('Setup S3 Deployment bucket') {
steps{
stage('Load functions') {
steps {
script {
functions = load(pwd() + '/build/functions.groovy')
}
}
}
stage('CloudFormation setup') {
steps {
script {
sh "aws cloudformation validate-template --template-body file://cfn/deployment/s3bucket.cfn.yaml"
def response = cfnValidate(file:'cfn/deployment/s3bucket.cfn.yaml')
echo "template description: ${response.description}"
functions.validateTemplate()
functions.updateDeploymentBucket()
functions.uploadTemplates()
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ AWS should redirect you to lambda configuration page. Now to deploy your lambda
- change handler to `dist/handler.handler`

That's all :) now you can enjoy playing with lambda written in TypeScript

#There is also other way to do that!
As you can see this project contains Jenkinsfile so you can easily build and deploy this lambda automatically!

What needs to be done:
1. create folder in your existing Jenkins e.g. dev/test/prod (it's very important because folder is used to distinguish environment)
2. Inside folder create the pipeline job (with the name you want), and configure it to use jenkinsfile from this project
3. Run build!





Expand Down

0 comments on commit 2d15305

Please # to comment.