switches to declarative syntax

This commit is contained in:
Hyatt 2023-10-29 11:47:50 -05:00
parent a45a7dd617
commit 4e247ed59e
Signed by: nhyatt
GPG Key ID: C50D0BBB5BC40BEA

View File

@ -3,27 +3,30 @@ def repositoryCreds = "harbor-repository-creds"
def workspace def workspace
def latestTag def latestTag
def label = "kubernetes-${UUID.randomUUID().toString()}"
def templateName = "pipeline-worker"
def outputFile def outputFile
podTemplate( def label = "kubernetes-${UUID.randomUUID().toString()}"
label: label, def templateName = "pipeline-worker"
name: templateName,
yaml: functions.podYaml( pipeline {
repo: repository, agent {
templateName: templateName, kubernetes{
alpine: true, yaml functions.podYaml(
[ repo: repository,
[ templateName: templateName,
name: "node-18", alpine: true,
path: "${repository}/dockerhub/library/node:18.15", [
command: "/bin/bash" [
] name: "node-18",
] path: "${repository}/dockerhub/library/node:18.15",
) command: "/bin/bash"
) { ]
node (label) { ]
)
}
}
stages {
stage ('Initalize Jenkins') { stage ('Initalize Jenkins') {
steps { steps {
script { script {
@ -63,62 +66,70 @@ podTemplate(
} }
stage ("Clone Signal") { stage ("Clone Signal") {
dir("signal-desktop") { steps {
checkout ([ dir("signal-desktop") {
$class: "GitSCM", checkout ([
branches: [ $class: "GitSCM",
[ branches: [
name: "refs/tags/" + latestTag, [
name: "refs/tags/" + latestTag,
],
], ],
], userRemoteConfigs: [
userRemoteConfigs: [ [
[ url: "https://github.com/signalapp/Signal-Desktop.git",
url: "https://github.com/signalapp/Signal-Desktop.git", ],
], ],
], extensions: [
extensions: [ [
[ $class: "CloneOption",
$class: "CloneOption", shallow: true,
shallow: true, depth: 1
depth: 1 ],
[
$class: "CheckoutOption",
timeout: 2
],
], ],
[ ])
$class: "CheckoutOption", }
timeout: 2
],
],
])
} }
} }
stage ("Build Signal") { stage ("Build Signal") {
container ("node-18") { steps {
writeFile(file: workspace + "/test-chamber-13.lan.root.crt", text: functions.getCurrentRootCA()) container ("node-18") {
sh """ writeFile(file: workspace + "/test-chamber-13.lan.root.crt", text: functions.getCurrentRootCA())
git config --global --add safe.directory '*' sh """
apt-get update -yqq && apt-get full-upgrade -yqq git config --global --add safe.directory '*'
apt-get install -yqq curl wget git jq git-lfs apt-get update -yqq && apt-get full-upgrade -yqq
cd ${workspace}/signal-desktop apt-get install -yqq curl wget git jq git-lfs
cat package.json | jq '.build.linux += {target:["AppImage"]}' > with_appimage_package.json cd ${workspace}/signal-desktop
mv with_appimage_package.json package.json cat package.json | jq '.build.linux += {target:["AppImage"]}' > with_appimage_package.json
yarn install mv with_appimage_package.json package.json
yarn build-release yarn install
""" yarn build-release
"""
outputFile = sh ( outputFile = sh (
script: """ script: """
basename \$(find ${workspace}/signal-desktop/ -name "*.AppImage") basename \$(find ${workspace}/signal-desktop/ -name "*.AppImage")
""", """,
returnStdout: true returnStdout: true
).trim() ).trim()
}
} }
} }
functions.pushArtifact( stage ('Push Artifacts') {
repoCreds: "nexus-generic-upload-bot", steps {
fileName: outputFile, functions.pushArtifact(
filePath: "${workspace}/release/", repoCreds: "nexus-generic-upload-bot",
fileURL: "https://nexus.c.test-chamber-13.lan/repository/generic/signal/" fileName: outputFile,
) filePath: "${workspace}/release/",
fileURL: "https://nexus.c.test-chamber-13.lan/repository/generic/signal/"
)
}
}
} }
} }