forked from PegaSysEng/pantheon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.release.branch
37 lines (36 loc) · 1.41 KB
/
Jenkinsfile.release.branch
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
void tryAddKnownHost(String hostUrl){
// ssh-keygen -F ${hostUrl} will fail (in bash that means status code != 0) if ${hostUrl} is not yet a known host
def statusCode = sh script:"ssh-keygen -F ${hostUrl}", returnStatus:true
if(statusCode != 0){
sh "mkdir -p ~/.ssh"
sh "ssh-keyscan ${hostUrl} >> ~/.ssh/known_hosts"
}
}
pipeline {
agent {
docker { image 'pegasyseng/pantheon-build:0.0.7-jdk11' }
}
parameters {
string(name: 'TAG_NAME', defaultValue: '', description: '[MANDATORY] Name of the Tag to create the branch from')
string(name: 'BRANCH_NAME', defaultValue: '', description: '[MANDATORY] The desired name of the new branch')
}
stages {
stage('Release') {
steps {
sshagent(
credentials: ['pegasys-admin-github-ssh-private-key']
) {
withEnv([
'GIT_COMMITTER_NAME="PegaSys Admin"',
'GIT_COMMITTER_EMAIL="[email protected]"',
'GIT_AUTHOR_NAME="PegaSys Admin"',
'GIT_AUTHOR_EMAIL="[email protected]"'
]) {
tryAddKnownHost('github.com')
sh "./branch-from-tag.sh ${params.TAG_NAME} ${params.BRANCH_NAME}"
}
}
}
}
}
}