Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #24

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6699134
Add files via upload
Gopalakrishnan997 Feb 11, 2022
31c0951
Update Jenkinsfile
Gopalakrishnan997 Feb 11, 2022
f3fde97
Update Jenkinsfile
Gopalakrishnan997 Feb 11, 2022
6aec965
Update Jenkinsfile
Gopalakrishnan997 Feb 11, 2022
8895f1e
Update Jenkinsfile
Gopalakrishnan997 Feb 11, 2022
454bae8
Update Jenkinsfile
Gopalakrishnan997 Feb 11, 2022
5aee005
pust helm
Gopalakrishnan997 Feb 12, 2022
ba17e7e
Update Jenkinsfile
Gopalakrishnan997 Feb 12, 2022
62ea322
Update Jenkinsfile
Gopalakrishnan997 Feb 12, 2022
01da333
Update Jenkinsfile
Gopalakrishnan997 Feb 12, 2022
f981929
Update pom.xml
Gopalakrishnan997 Feb 13, 2022
f204df6
Update pom.xml
Gopalakrishnan997 Feb 13, 2022
99980bb
Update Jenkinsfile
Gopalakrishnan997 Feb 13, 2022
0c28f99
Update values.yaml
Gopalakrishnan997 Feb 13, 2022
1baa534
Update Jenkinsfile
Gopalakrishnan997 Feb 13, 2022
b91131c
Update Jenkinsfile
Gopalakrishnan997 Feb 13, 2022
69f89c8
Update Jenkinsfile
Gopalakrishnan997 Feb 13, 2022
2b18418
Update Jenkinsfile
Gopalakrishnan997 Feb 13, 2022
d3982ac
Update Jenkinsfile
Gopalakrishnan997 Feb 13, 2022
1a98b5a
Update Jenkinsfile
Gopalakrishnan997 Feb 13, 2022
ee782ee
Update Jenkinsfile
Gopalakrishnan997 Feb 13, 2022
69eeeac
Update Jenkinsfile
Gopalakrishnan997 Feb 13, 2022
9f81c92
Update Jenkinsfile
Gopalakrishnan997 Feb 13, 2022
e288dee
Update Jenkinsfile
Gopalakrishnan997 Feb 15, 2022
16391db
Delete oc-deployment directory
Gopalakrishnan997 Feb 15, 2022
60097b1
Update Jenkinsfile
Gopalakrishnan997 Feb 15, 2022
e09f497
Update Jenkinsfile
Gopalakrishnan997 Feb 15, 2022
6cc09d0
Update Jenkinsfile
Gopalakrishnan997 Feb 15, 2022
62ba9f4
Update Jenkinsfile
Gopalakrishnan997 Feb 15, 2022
4e6415d
Update Jenkinsfile
Gopalakrishnan997 Feb 15, 2022
793c2c9
Update Jenkinsfile
Gopalakrishnan997 Feb 15, 2022
78d2cb1
Update Jenkinsfile
Gopalakrishnan997 Feb 15, 2022
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
111 changes: 111 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@

pipeline {
agent any
parameters {
booleanParam(name: 'DeployFromBranch', defaultValue:false,
description: 'The Develop branch is deployed automatically. ' +
'If there is a need to deploy from the other branch, enable this parameter. ' +
'The docker image will be released with generated version and deployed to DEV only.')
}
tools {
maven 'Mavenglobalname'
}
environment {
SERVICE_NAME = 'fromi-otp-service'

}
stages {
stage('Checkout') {
steps {
checkout([
$class: 'GitSCM',
branches: [[name: 'refs/heads/master']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'helmchart']],
submoduleCfg: [],
userRemoteConfigs: [[credentialsId: '13d412be-0d91-447a-b125-db7f5800cdb2', url: 'https://github.com/Gopalakrishnan997/helm-chart.git']]
])
}
}
stage("Adjust version") {
when {
not {
branch 'develop'
}
}
steps {
script {
echo "The branch name - ${env.BRANCH_NAME}"
def startOfTheBranchName = env.BRANCH_NAME.indexOf('/') // get the branch name without feature/hotfix/etc
// new name to have first 20 chars from the branch name
def branchSubstring = env.BRANCH_NAME.substring(startOfTheBranchName + 1, startOfTheBranchName + 21)
echo "${branchSubstring}"
def branchNewVersion = getVersion() + "_" + env.BUILD_NUMBER + "_" + branchSubstring
echo "Version to be released from branch - ${branchNewVersion}"
sh "mvn versions:set -DnewVersion=${branchNewVersion}"
echo "New version in pom.xml - " + getVersion()
}
}
}
stage("Build") {
steps {
sh "mvn clean verify"
}

}
stage('Check Helmchart config') {
when { changeset "*/oc-deployment/**"}
steps {
sh "helm lint ${WORKSPACE}/helmchart/oc-deployment"
}
}
stage("Release helmchart") {
when { changeset "*/oc-deployment/**"}
steps {
script {
def pomVersion = getVersion()
def chart = readYaml (file: 'helmchart/oc-deployment/Chart.yaml')
def chartVersion = chart.version.toString()
echo "Helmchart version - ${chartVersion}"
echo "App version - " + getVersion()
sh "helm package ${WORKSPACE}/helmchart/oc-deployment --version ${chartVersion} --app-version ${chartVersion}"
rtUpload(
serverId: 'jfroginstance',
spec: '''{
"files": [{
"pattern": "*.tgz",
"target": "default-helm"
}]
}
'''
)
}
}
}
stage("Deploy to DEV from branch") {
when {
allOf {
not {
branch 'develop'
}
expression {
return params.DeployFromBranch
}
}
}
steps {
script {
echo "Build and push docker with new version"

}
}
}
}

}

def getVersion() {
return sh(returnStdout: true,
script: 'mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout --batch-mode -U -e -Dsurefire.useFile=false'
).trim()
}
13 changes: 12 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@

<name>Simple Maven example</name>
<url>https://jitpack.io/#jitpack/maven-simple/0.1</url>

<scm>
<connection>scm:git:ssh://[email protected]/Gopalakrishnan997/mavensimple.git</connection>
<url>https://github.com/Gopalakrishnan997/mavensimple.git</url>
<tag>HEAD</tag>
</scm>
<dependencies>
<dependency>
<groupId>junit</groupId>
Expand Down Expand Up @@ -44,6 +48,13 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-scm-plugin</artifactId>
<version>1.11.2</version>
<configuration>
<tag>${project.version}</tag>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down