This repository has been archived by the owner on May 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Jenkinsfile-tridentbuild-edge
85 lines (81 loc) · 3.33 KB
/
Jenkinsfile-tridentbuild-edge
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
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
This is the default Jenkins Pipeline file used to create our
full weekly build images.
*/
pipeline {
agent { label 'Trident-Master' }
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
}
environment {
// Set the MANIFEST we want to use for this build
TRUEOS_MANIFEST= "${env.WORKSPACE}/trident-edge.json"
}
stages {
stage('Prepare') {
steps {
checkout scm
sh 'if [ -d "build-repo" ] ; then (cd build-repo && git pull) ; else git clone https://github.com/trueos/build.git build-repo ; fi'
}
}
stage('Build') {
post {
always {
archiveArtifacts artifacts: 'build-repo/release/port-logs/latest/.data.json', fingerprint: true
sh 'if [ -d build-repo/release/port-logs-errors ] ; then rm -r build-repo/release/port-logs-errors ; fi'
sh 'mkdir -p build-repo/release/port-logs-errors'
sh 'cp build-repo/release/port-logs/latest/logs/errors/* build-repo/release/port-logs-errors/.'
archiveArtifacts artifacts: 'build-repo/release/port-logs-errors/**', fingerprint: true
sh 'chflags -R noschg build-repo'
}
failure {
archiveArtifacts artifacts: 'build-repo/release/src-logs/**', fingerprint: true
}
}
environment {
SIGNING_KEY = credentials('Trident-sign')
}
steps {
sh 'cd ${WORKSPACE}/build-repo ; make ports'
}
}
stage('ISO') {
post {
always {
archiveArtifacts artifacts: 'build-repo/release/iso-logs/**', fingerprint: true
}
}
environment {
SIGNING_KEY = credentials('Trident-sign')
}
steps {
sh 'cd ${WORKSPACE}/build-repo ; make iso'
}
}
stage('Stage') {
environment {
REMOTE_USER='trident'
REMOTE_SERVER='cdn1.tn.ixsystems.com'
REMOTE_PKG_DIR='/usr/home/trident/cdn/pkg/edge'
REMOTE_ISO_DIR='/usr/home/trident/cdn/iso/edge'
REMOTE_MANIFESTS_DIR='/usr/home/trident/cdn/iso/edge/manifests'
LOCAL_ISO_DIR='build-repo/release/iso/'
LOCAL_PKG_DIR='build-repo/release/packages/'
LOCAL_MANIFESTS_DIR='build-repo/release/pkg-manifests/'
}
steps {
sshagent (credentials: ['Trident-publish']) {
// Packages
sh 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${REMOTE_USER}@${REMOTE_SERVER} mkdir -p ${REMOTE_PKG_DIR} || true'
sh 'rsync -av --delete-after --delay-updates -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${LOCAL_PKG_DIR} ${REMOTE_USER}@${REMOTE_SERVER}:/${REMOTE_PKG_DIR}/'
// ISO Artifacts
sh 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${REMOTE_USER}@${REMOTE_SERVER} mkdir -p ${REMOTE_ISO_DIR}/ || true'
sh 'rsync -av --delete-after --delay-updates -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${LOCAL_ISO_DIR} ${REMOTE_USER}@${REMOTE_SERVER}:${REMOTE_ISO_DIR}'
// PACKAGE MANIFESTS
sh 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${REMOTE_USER}@${REMOTE_SERVER} mkdir -p ${REMOTE_MANIFESTS_DIR}/ || true'
sh 'rsync -av --delete-after --delay-updates -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${LOCAL_MANIFESTS_DIR} ${REMOTE_USER}@${REMOTE_SERVER}:${REMOTE_MANIFESTS_DIR}'
}
}
}
}
}