build-binary

This commit is contained in:
Hyatt 2021-10-30 17:54:33 -05:00
parent d2e41d6367
commit b42a4df38c
Signed by: nhyatt
GPG Key ID: C50D0BBB5BC40BEA

74
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,74 @@
// cmake '-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-mingw.cmake' .
def label = "jenkins-${UUID.randomUUID().toString()}"
def repository = "registry.c.test-chamber-13.lan"
podTemplate(
label: label,
name: "pipeline-worker",
yaml: """---
apiVersion: v1
kind: Pod
metadata:
name: pipeline-worker
spec:
containers:
- name: compile
imagePullPolicy: Always
image: ${repository}/dockerhub/library/golang:alpine
tty: true
command:
- /bin/cat
""") {
node (label) {
def workspace = pwd()
container("compile") {
stage ("Pull Local Repo") {
checkout([
$class: "GitSCM",
branches: [
[
name: "refs/remotes/origin/main",
],
],
userRemoteConfigs: [
[
url: "ssh://git@gitea.smoothnet.org:31822/nhyatt/go-temper.git",
credentialsId: "Gitea-Read-Only-Token",
],
],
extensions: [
[
$class: "CloneOption",
shallow: true,
],
[
$class: "CheckoutOption",
timeout: 2,
],
],
])
}
stage("Build go-temper") {
container("compile") {
sh """
apk add --no-cache libusb-dev gcc g++ upx
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-temper ./cmd/go-temper
upx --brute go-temper
"""
}
}
stage ("Store Artifacts") {
archiveArtifacts (artifacts: "go-temper",
fingerprint: true,
allowEmptyArchive: false,
onlyIfSuccessful: true,
)
}
}
}
}