-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
67 lines (53 loc) · 1.43 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '30', artifactNumToKeepStr: '10', daysToKeepStr: '180', numToKeepStr: '120')), disableConcurrentBuilds(), parameters([string(defaultValue: 'staging', description: '', name: 'branch')]), pipelineTriggers([])])
pipeline {
agent any
environment {
// git_repo_credential_token = 'd60cc6087e37205c8813e95f004597a926813e0e'
git_repo_url = 'https://github.com/prakashul/knowledgemeet.git'
}
stages {
stage ('Workspace Cleanup') {
steps {
deleteDir()
}
}
stage ('SCM Checkout') {
steps {
script {
git branch: branch, credentialsId: git_repo_credential_token, url: git_repo_url
}
}
}
stage ('Branch Checkout') {
steps {
sh 'git checkout '+env.branch
}
}
stage ('Build Artifact') {
steps {
sh 'echo Building Artifact'
}
}
stage ('Push Artifact') {
when { branch 'staging' }
steps {
echo 'Pushing Artifact As Branch given is staging'
script {
try {
timeout(time: 20, unit: 'SECONDS') {
input 'Do you want to proceed to the Deployment?'
}
}
catch(err) {
err.printStackTrace()
}
sh 'echo Proceeding'
}
}
}
stage ('Deploy') {
steps {
sh 'echo Deploying'
}
}}
}