-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile.libpsl.nsblde4
169 lines (166 loc) · 7.69 KB
/
Jenkinsfile.libpsl.nsblde4
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*
Paste the rest of this file into a standard Pipeline project to
build/test/stage libpsl NSX standard.
Also set Discard old builds, typically log rotation to 2
Poll SCM something useful, like H/45 2 * * *, remember that this job takes
a long time to clone and checkout.
Whomever the user is running this (a.k.a. Jenkins), must have proper
credentials in NonStop SSH.
*/
def localStaging
def downloadVersion
def destinationUser
def destinationHost
def destinationPort
def localDownloads
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '2'))
skipDefaultCheckout()
}
stages {
stage('ituglib') {
steps {
dir('../Ituglib_Build') {
checkout([$class: 'GitSCM',
branches: [[name: 'main']],
extensions: [
[$class: 'CleanBeforeCheckout']],
doGenerateSubmoduleConfigurations: false, extensions: [
[$class: 'CleanCheckout'],
[$class: 'CloneOption', timeout: 120, shallow: true],
[$class: 'CheckoutOption', timeout: 120],
[$class: 'IgnoreNotifyCommit'],
],
userRemoteConfigs: [[url: 'https://github.com/ituglib/ituglib-build.git']]])
}
}
}
stage('setup') {
steps {
script {
def userInput = input(id: 'userInput', message: 'Build Settings?',
parameters: [
string(defaultValue: '', description: 'Libpsl Version', name: 'input'),
string(defaultValue: 'ituglib.randall', description: 'Destination User', name: 'user'),
string(defaultValue: 'tcmvns.tcmsupport.com', description: 'Destination Host', name: 'host'),
string(defaultValue: '49284', description: 'Destination Port', name: 'port'),
])
downloadVersion = userInput.input
destinationUser = userInput.user
destinationHost = userInput.host
destinationPort = userInput.port
load "../Ituglib_Build/Jenkinsfile.globals.all"
load "../Ituglib_Build/Jenkinsfile.globals.nse"
localStaging = "${LOCAL_STAGING}"
localDownloads = "${LOCAL_DOWNLOADS}"
}
}
}
stage('unpack') {
steps {
withEnv(["LIBPSL_VERSION=${downloadVersion}",
'LIBPSL_URL_PREFIX=https://github.com/rockdaboot/libpsl/releases/download',
'DOWNLOADS=/home/ituglib/randall/downloads']){
cleanWs()
sh 'test -f ${DOWNLOADS}/libpsl-${LIBPSL_VERSION}.tar.gz || curl --insecure -L ${LIBPSL_URL_PREFIX}/${LIBPSL_VERSION}/libpsl-${LIBPSL_VERSION}.tar.gz -o ${DOWNLOADS}/libpsl-${LIBPSL_VERSION}.tar.gz'
sh 'tar xf ${DOWNLOADS}/libpsl-${LIBPSL_VERSION}.tar.gz'
sh 'mv libpsl-${LIBPSL_VERSION}/* .'
}
}
}
stage('patch') {
steps {
sh 'sed "/<ws2tcpip.h>/a #elif defined __TANDEM" -i src/psl.c'
sh 'sed "/defined __TANDEM/a # include <unistd.h>" -i src/psl.c'
sh 'sed "/defined __TANDEM/a # include <netinet/in.h>" -i src/psl.c'
sh 'sed "/defined __TANDEM/a # include <netinet/in6.h>" -i src/psl.c'
sh 'sed "/defined __TANDEM/a # include <netdb.h>" -i src/psl.c'
sh 'sed "/defined __TANDEM/a # include <sys/socket.h>" -i src/psl.c'
sh 'sed "s/alloca(/(char *)malloc(/g" -i tests/test-is-cookie-domain-acceptable.c'
sh 'sed "s/alloca(/(char *)malloc(/g" -i tests/test-is-public-all.c'
sh 'sed "s/alloca(/(char *)malloc(/g" -i tests/test-is-public-builtin.c'
sh 'sed "s/alloca(/(char *)malloc(/g" -i tests/test-is-public.c'
sh 'sed "s/alloca(/(char *)malloc(/g" -i tests/test-registrable-domain.c'
}
}
stage('redate') {
steps {
script {
currentTime = sh(returnStdout: true, script: 'date +%Y%m%d%H%M.%S').trim()
sh(returnStdout: true, script: 'echo Set all files to '+currentTime+' to inhibit aclocal-1.16 requirement')
sh(returnStdout: true, script: 'find . -exec touch -t '+currentTime+' {} ";" || echo Ignore any errors')
}
}
}
stage('config') {
steps {
withEnv(['PATH=/usr/coreutils/bin:/usr/local/bin:/usr/bin:/bin:/usr/ucb',
'_RLD_LIB_PATH=/usr/local/lib']) {
sh 'CFLAGS="-c99" CPPFLAGS="-Wnowarn=1252,272,734 -I/usr/include -I/usr/local/include" conf_script_floss_cc'
}
}
}
stage('build') {
steps {
withEnv(['PATH=/usr/coreutils/bin:/usr/local/bin:/usr/bin:/bin:/usr/ucb',
'_RLD_LIB_PATH=/usr/local/lib']) {
sh 'make'
}
}
}
stage('findcall_floss') {
steps {
withEnv(['PATH=/usr/coreutils/bin:/usr/local/bin:/usr/bin:/bin:/usr/ucb',
'_RLD_LIB_PATH=:/usr/local/lib']) {
sh 'findcall_floss || echo "Ignore pthread errors"'
}
}
}
stage('test') {
steps {
withEnv(['PATH=/usr/coreutils/bin:/usr/local/bin:/usr/bin:/bin:/usr/ucb',
'_RLD_LIB_PATH=:/usr/local/lib']) {
sh 'make check'
}
}
}
stage('install') {
steps {
withEnv(['PATH=/usr/coreutils/bin:/usr/local/bin:/usr/bin:/bin:/usr/ucb',
'_RLD_LIB_PATH=:/usr/local/lib']) {
sh 'make install DESTDIR=${WORKSPACE}/install'
}
}
}
stage('package') {
steps {
withEnv(['PATH=/usr/coreutils/bin:/usr/local/bin:/usr/bin:/bin:/usr/ucb',
'_RLD_LIB_PATH=:/usr/local/lib',
'BASENAME=libpsl',
"DEST=${localStaging}"]) {
sh 'export INSTALL_LOCATION="${WORKSPACE}/install" && export VERSION_PATH="${INSTALL_LOCATION}/usr/local/bin/psl" && . ${WORKSPACE}/../Ituglib_Build/dist.info.nse && bash ${WORKSPACE}/../Ituglib_Build/package.bin.nomanifest'
}
}
}
stage('remote') {
steps {
withEnv(['PATH=/usr/coreutils/bin:/usr/local/bin:/usr/bin:/bin:/usr/ucb',
'_RLD_LIB_PATH=:/usr/local/lib',
'BASENAME=libpsl',
'DEST=/home/ituglib/randall/stage',
"REMOTE=-oPort=${destinationPort} ${destinationUser}@${destinationHost}",
'REMOTE_DEST=/web/stage']) {
sh 'echo "put $DEST/${BASENAME}-* $REMOTE_DEST" | /G/system/zssh/sftposs $REMOTE'
sh 'rm ${DEST}/${BASENAME}-*'
}
}
}
}
post {
always {
mail bcc: '', body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\nDuration: ${currentBuild.durationString}\nChange: ${currentBuild.changeSets}\n More info at: ${env.BUILD_URL}", cc: '', from: '[email protected]', replyTo: '', subject: "[Jenkins NSBLDE4] ${currentBuild.currentResult}: job ${env.JOB_NAME}", to: '[email protected]'
}
}
}