Skip to content

Commit 038da5f

Browse files
committed
changes
0 parents  commit 038da5f

8 files changed

Lines changed: 182 additions & 0 deletions

File tree

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
target/
2+
pom.xml.tag
3+
pom.xml.releaseBackup
4+
pom.xml.versionsBackup
5+
pom.xml.next
6+
release.properties
7+
dependency-reduced-pom.xml
8+
buildNumber.properties
9+
.mvn/timing.properties
10+
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
11+
.mvn/wrapper/maven-wrapper.jar

Jenkinsfile

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
pipeline {
2+
agent any
3+
4+
options {
5+
//Disable concurrentbuilds for the same job
6+
disableConcurrentBuilds()
7+
// Colorize the console log
8+
ansiColor("xterm")
9+
// Add timestamps to console log
10+
timestamps()
11+
12+
}
13+
14+
environment {
15+
AWS_ACCESS_KEY = credentials('aws_access_key')
16+
AWS_SECRET_KEY = credentials('aws_secret_key')
17+
}
18+
19+
stages {
20+
21+
stage('Build Lambda') {
22+
steps {
23+
echo 'Build'
24+
sh 'mvn clean install'
25+
}
26+
}
27+
stage('Test') {
28+
steps {
29+
echo 'Test'
30+
// sh 'mvn test'
31+
}
32+
}
33+
stage('Push to artifactory') {
34+
steps {
35+
echo 'Push to artifactory'
36+
}
37+
}
38+
39+
stage('Deploy to QA') {
40+
steps {
41+
echo 'Deploy to QA'
42+
sh 'zip -g bermtec-0.0.1.zip **/target'
43+
44+
sh 'aws --version'
45+
sh './deploy-test.sh'
46+
sh 'aws lambda update-function-code --function-name test --zip-file fileb://./target/bermtec-0.0.1.zip'
47+
}
48+
}
49+
50+
stage('Release to Prod') {
51+
steps {
52+
echo 'Release to Prod'
53+
script {
54+
if (env.BRANCH_NAME == "master") {
55+
input('Proceed for Prod ?')
56+
}
57+
}
58+
59+
}
60+
}
61+
62+
stage('Deploy to Prod') {
63+
steps {
64+
script {
65+
if (env.BRANCH_NAME == "master") {
66+
echo 'Deploy to Prod'
67+
sh 'aws configure set aws_access_key_id $AWS_ACCESS_KEY'
68+
sh 'aws configure set aws_secret_access_key $AWS_SECRET_KEY'
69+
sh 'aws s3 cp bermtec-0.0.1.zip s3://bermtec28/lambdaprod'
70+
sh 'aws lambda update-function-code --function-name prodfunction --zip-file fileb://bermtec-0.0.1.zip'
71+
}
72+
}
73+
}
74+
}
75+
76+
}
77+
post {
78+
failure {
79+
echo 'failed'
80+
mail to: '[email protected]',
81+
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
82+
body: "Something is wrong with ${env.BUILD_NUMBER}"
83+
}
84+
success {
85+
echo 'Success'
86+
}
87+
aborted {
88+
echo 'aborted'
89+
}
90+
}
91+
}

LICENSE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
MIT License
2+
3+
Copyright (c) 2022 BermTec Ltd

README.md

Whitespace-only changes.

deploy-test.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
echo 'Script started'
4+
sh 'aws s3 ls'
5+
sh 'aws configure set aws_access_key_id $AWS_ACCESS_KEY'
6+
sh 'aws configure set aws_secret_access_key $AWS_SECRET_KEY'
7+
// sh 'aws configure set region us-east-1'
8+
sh 'aws s3 cp bermtec-0.0.1.zip s3://bermtec28/lambdatest'
9+
echo "Stage 2 Yes"

pom.xml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>com.example</groupId>
6+
<artifactId>bermtec</artifactId>
7+
<version>0.0.1</version>
8+
<name>bermtec</name>
9+
<packaging>jar</packaging>
10+
<description>bermtec 2022 with Spring Boot</description>
11+
<parent>
12+
<groupId>org.springframework.boot</groupId>
13+
<artifactId>spring-boot-starter-parent</artifactId>
14+
<version>2.3.1.RELEASE</version>
15+
<relativePath/> <!-- lookup parent from repository -->
16+
</parent>
17+
<properties>
18+
<java.version>1.8</java.version>
19+
<maven.compiler.source>1.8</maven.compiler.source>
20+
<maven.compiler.target>1.8</maven.compiler.target>
21+
</properties>
22+
<dependencies>
23+
<dependency>
24+
<groupId>com.amazonaws</groupId>
25+
<artifactId>aws-lambda-java-core</artifactId>
26+
<version>1.2.1</version>
27+
</dependency>
28+
</dependencies>
29+
30+
<build>
31+
<plugins>
32+
<plugin>
33+
<groupId>org.apache.maven.plugins</groupId>
34+
<artifactId>maven-shade-plugin</artifactId>
35+
<version>3.2.2</version>
36+
<configuration>
37+
<createDependencyReducedPom>false</createDependencyReducedPom>
38+
</configuration>
39+
<executions>
40+
<execution>
41+
<phase>package</phase>
42+
<goals>
43+
<goal>shade</goal>
44+
</goals>
45+
</execution>
46+
</executions>
47+
</plugin>
48+
</plugins>
49+
</build>
50+
51+
</project>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.example.bermtec;
2+
3+
import com.amazonaws.services.lambda.runtime.Context;
4+
5+
public class GreetingController {
6+
public String greeting(String input, Context context) {
7+
context.getLogger().log("User Input : " + input);
8+
return "Welcome to Bermtec : " + input;
9+
}
10+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.example;
2+
public class GreetingControllerTest {
3+
4+
public void givenName_thenGreetingWithName() {
5+
6+
}
7+
}

0 commit comments

Comments
 (0)