forked from Ad9195/go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
72 lines (67 loc) · 2.3 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
68
69
70
71
72
#!groovy
import groovy.transform.Field
@Field String email_to = '[email protected]'
@Field String email_from = '[email protected]'
@Field String email_reply_to = '[email protected]'
pipeline {
agent any
stages {
stage('Checkout') {
steps {
echo "Running build #${env.BUILD_ID} on ${env.JENKINS_URL}"
dir('go') {
git([
url: '[email protected]:platinasystems/go.git',
credentialsId: "570701f7-c819-4db2-bd31-a0da8a452b41",
branch: 'master'
])
}
dir('system-build') {
checkout([$class: 'GitSCM',
branches: [[name: '*/master']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'SubmoduleOption',
disableSubmodules: false,
parentCredentials: true,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: true]],
submoduleCfg: [],
userRemoteConfigs: [[credentialsId: "570701f7-c819-4db2-bd31-a0da8a452b41",
url: '[email protected]:platinasystems/system-build.git']]])
}
}
}
stage('Build') {
steps {
dir('go') {
echo "Updating worktrees"
sh 'set -x;env;pwd;[ -d worktrees ] && for repo in worktrees/*/*; do echo $repo; [ -d "$repo" ] && (cd $repo;git fetch origin;git reset --hard HEAD;git rebase origin/master);done || true'
echo "Setting git config"
sh 'git config --global [email protected]:.insteadOf \"https://github.com/\"'
echo "Building goes..."
sshagent(credentials: ['570701f7-c819-4db2-bd31-a0da8a452b41']) {
sh 'env PATH=/usr/local/go/bin:/usr/local/x-tools/arm-unknown-linux-gnueabi/bin:${PATH} go run ./main/goes-build/main.go -x -v -z'
}
}
}
}
}
post {
success {
mail body: "GOES build ok: ${env.BUILD_URL}\n\ngoes-platina-mk1-installer is stored on platina4 at /home/jenkins/workspace/go/src/github.com/platinasystems/go/goes-platina-mk1\neg.\nscp 172.16.2.23:/home/jenkins/workspace/go/src/github.com/platinasystems/go/goes-platina-mk1 ~/path/to/somewhere/",
from: email_from,
replyTo: email_reply_to,
subject: 'GOES build ok',
to: email_to
}
failure {
cleanWs()
mail body: "GOES build error: ${env.BUILD_URL}",
from: email_from,
replyTo: email_reply_to,
subject: 'GOES BUILD FAILED',
to: email_to
}
}
}