Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
cacb78e
Adding jenkins file
Sep 6, 2019
eaadce3
Adding new stages in jenkins file
Sep 6, 2019
be21884
Correcting the jenkins file
Sep 6, 2019
03e69d0
Correct the war to jar for archiving the artifacts.
Sep 6, 2019
948d7d5
Adding user input stages for entering jira in jenkins file
Sep 6, 2019
d7cf7a6
Making parameters are global.
Sep 6, 2019
0ee82ac
Correcting the input parameters
Sep 6, 2019
d626c64
reverting changes
Sep 6, 2019
15060fc
Adding jira id as global param
Sep 6, 2019
c2c47ce
Adding jira id as global param
Sep 6, 2019
1e7ed59
Adding jira id as global param
Sep 6, 2019
b48e2aa
Add code to add comment to jira
Sep 6, 2019
bee898b
Testing upper case and build number
Sep 6, 2019
5fe8318
Making changes to jenkins file for build number
Sep 6, 2019
88d0fe2
Logger corrections to jenkins file
Sep 6, 2019
8df91e9
Making build number changes
Sep 6, 2019
b263ac3
Testing build number
Sep 6, 2019
1b3d087
Testing build number
Sep 6, 2019
844cf30
Making changes for the build number
Sep 6, 2019
67258a7
Making changes for the build number
Sep 6, 2019
b85b50d
changing variable name
Sep 6, 2019
0ce66b2
changing variable name
Sep 6, 2019
3c9e559
Changes to the build number
Sep 6, 2019
d35ea25
Changes to the build number
Sep 6, 2019
b6ee44f
Changes to the build number
Sep 6, 2019
70f8d9e
Reverting the changes
Sep 6, 2019
b501341
testing build parameter
Sep 6, 2019
e59355a
testing build parameter
Sep 6, 2019
9f8e91a
testing build parameter
Sep 6, 2019
d8329b8
Testing build number parameter
Sep 6, 2019
a0c68ec
Adding administrator name who started the deployment build
Sep 6, 2019
a425da6
Testing empty param
Sep 6, 2019
c087197
Testing for empty jira id param
Sep 6, 2019
719fa9c
Testing for empty jira id param
Sep 6, 2019
7195b3b
Testing for empty jira id param
Sep 6, 2019
be92384
Testing for empty jira id param
Sep 6, 2019
e2b4458
testing
Sep 6, 2019
7f20ebf
testing
Sep 6, 2019
36f71e3
Adding null check
Sep 6, 2019
1a1d63e
Adding new jenkins file to check the vulnerabilties in the code.
Sep 6, 2019
ad75a02
Adding file changes
Sep 6, 2019
e0126f0
Correcting echo text
Sep 6, 2019
af6df1d
adding code for testing common message
Sep 6, 2019
2d8f696
adding code for testing common message
Sep 6, 2019
ce6bb37
adding code for testing common message
Sep 6, 2019
be15ad7
testing
Sep 6, 2019
49f620b
Reverting code in the jenkinsfilev1 and adding testing code in jenkin…
Sep 6, 2019
03d076d
Adding stage skip boolean
Sep 6, 2019
a9bf64b
Adding stage skip boolean
Sep 6, 2019
6b6417a
Adding stage skip boolean
Sep 6, 2019
b69f7a2
Making changes to the boolean variable.
Sep 6, 2019
4caa2a6
Reverting the post block for build and test stage
Sep 6, 2019
43dea0c
Adding stage to validate the input form parameters
Sep 6, 2019
e9925f7
testing the stage for the input parameters
Sep 6, 2019
f23bc8a
Reverting changes for final testing
Sep 6, 2019
fc41728
Adding code to validate the input jira id
Sep 6, 2019
a2d6646
Adding indentation changes in the jenkinsfilev3
Sep 7, 2019
6a23b7f
master: fixing testcases and code
Jun 27, 2021
80f3982
master: fixing testcases
Jun 27, 2021
940eff8
master: making code changes
Jun 27, 2021
e694f41
master: adding the jenkins file
Jun 27, 2021
bdcc442
master: adding the vulnerability step check
Jun 27, 2021
2ef8a6f
master: adding the vulnerability changes
Jun 27, 2021
e7fd903
master: adding the jenkins declarative file changes
Jun 27, 2021
81c196e
master: adding build discarder in jenkins declarative pipeline
Jun 27, 2021
6dc7698
Creating develop branch without change
Jul 3, 2021
6526daa
develop - making changes to jenkinsfile
Aug 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Created by .ignore support plugin (hsz.mobi)
### Maven template
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
### Java template
*.class

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml

# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

.idea/
*.iml

/main/src/main/resources/doc/*

*.project
*.classpath
71 changes: 71 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
//scripted jenkins file

node('master') {
try {
properties([
buildDiscarder(logRotator(daysToKeepStr: '3', numToKeepStr: '3', artifactDaysToKeepStr: '15', artifactNumToKeepStr: '5')),
disableConcurrentBuilds()
])

stage("Checkout project") {
echo "Checking out the project"
try {
checkout scm
} catch (Exception e) {
throw e
}
}

stage("Running testcases") {
echo "Running the testcases"
sh "mvn test"
}

stage("Bundling project") {
echo "Bundling the project"
sh "mvn clean install"
}

stage("Deploying to nexus") {
echo "Deploying the bundled jar to the nexus"
}

stage("Sonar analyzer") {
echo "Running sonar analyzer"
}

stage("Running vulnerability check") {
echo "Running the vulnerability step"
// sh "mvn dependency-check:aggregate -DsuppressionFile.path=suppressions.xml"
// sh "mvn dependency-check:aggregate"
}

stage("Building docker image") {
echo "Performing docker setup"
}

stage("Tag and publish to hub") {
echo "Tagging the docker image and pushing it to the hub"
}

stage("Removing local image") {
echo "Clearing the work directory"
}

stage("Performing deployment") {
echo "Performing the deployment"
}

stage("Wipe out directory") {
echo "Wiping out the working directory"
}

stage("Post action") {
echo "Performing the post action step. Setup email or slack notifications"
}
}
catch (Exception e) {
throw e
}
}

24 changes: 24 additions & 0 deletions Jenkinsfile_declarative
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
pipeline {
agent any

options {
buildDiscarder(logRotator(daysToKeepStr: '3', numToKeepStr: '3', artifactDaysToKeepStr: '15', artifactNumToKeepStr: '5'))
}

triggers {
pollSCM 'H * * * *'
}

stages {
stage('Running testcases') {
steps {
sh "mvn test"
}
}
stage('Bundling project') {
steps {
sh "mvn clean install"
}
}
}
}
153 changes: 98 additions & 55 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,59 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>demo</name>
<description>Demo project for Spring Boot</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>demo</name>
<description>Demo project for Spring Boot</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<junit-platform.version>5.3.1</junit-platform.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-platform.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-platform.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<!-- mvn test -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
</plugin>
</plugins>

<!-- vulnerability check changes -->
<!-- mvn dependency-check:aggregate -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<configuration>
<retireJsAnalyzerEnabled>false</retireJsAnalyzerEnabled>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
37 changes: 18 additions & 19 deletions src/main/java/com/example/DemoApplication.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
package com.example;

import com.example.model.ToDo;
import com.example.repository.ToDoRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import com.example.model.ToDo;
import com.example.repository.ToDoRepository;

@SpringBootApplication
public class DemoApplication {

private static final Logger logger = LoggerFactory.getLogger(DemoApplication.class);

public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}

@Bean
public CommandLineRunner setup(ToDoRepository toDoRepository) {
return (args) -> {
toDoRepository.save(new ToDo("Remove unused imports", true));
toDoRepository.save(new ToDo("Clean the code", true));
toDoRepository.save(new ToDo("Build the artifacts", false));
toDoRepository.save(new ToDo("Deploy the jar file", true));
logger.info("The sample data has been generated");
};
}
private static final Logger logger = LoggerFactory.getLogger(DemoApplication.class);

public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}

@Bean
public CommandLineRunner setup(ToDoRepository toDoRepository) {
return (args) -> {
toDoRepository.save(new ToDo("Remove unused imports", true));
toDoRepository.save(new ToDo("Clean the code", true));
toDoRepository.save(new ToDo("Build the artifacts", false));
toDoRepository.save(new ToDo("Deploy the jar file", true));
logger.info("The sample data has been generated");
};
}
}
Loading