Repository navigation
Expand file tree
/
Copy pathJenkinsfile
More file actions
32 lines (28 loc) · 1.55 KB
/
Copy pathJenkinsfile
File metadata and controls
32 lines (28 loc) · 1.55 KB
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
pipeline {
agent any
environment {
DEBRICKED_TOKEN = credentials('DEBRICKED_TOKEN')
}
stages {
stage('Debricked Scan') {
steps {
script {
// Inspiration taken from https://github.com/trustin/os-maven-plugin/blob/master/src/main/java/kr/motd/maven/os/Detector.java
def osName = System.getProperty("os.name").toLowerCase(Locale.US).replaceAll("[^a-z0-9]+", "")
if (osName.startsWith("linux")) { osName = "linux" }
else if (osName.startsWith("mac") || osName.startsWith("osx")) { osName = "macOS" }
else if (osName.startsWith("windows")) { osName = "windows" }
else { osName = "linux" } // Default to linux
def osArch = System.getProperty("os.arch").toLowerCase(Locale.US).replaceAll("[^a-z0-9]+", "")
if (osArch.matches("(x8664|amd64|ia32e|em64t|x64)")) { osArch = "x86_64" }
else if (osArch.matches("(x8632|x86|i[3-6]86|ia32|x32)")) { osArch = "i386" }
else if (osArch.matches("(aarch_64)")) { osArch = "arm64" }
else { osArch = "x86_64" } // Default to x86 64-bit
println("OS detected: " + osName + " and architecture " + osArch)
sh 'curl -LsS https://github.com/debricked/cli/releases/download/release-v2/cli_' + osName + '_' + osArch + '.tar.gz | tar -xz debricked'
sh './debricked scan'
}
}
}
}
}