Adds Jenkinsfile
This commit is contained in:
parent
cea5b78c7b
commit
4ca6497a28
70
Jenkinsfile
vendored
Normal file
70
Jenkinsfile
vendored
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
#!groovy
|
||||||
|
|
||||||
|
def repository = "registry.c.test-chamber-13.lan"
|
||||||
|
def repositoryCreds = "harbor-repository-creds"
|
||||||
|
|
||||||
|
def label = "kubernetes-${UUID.randomUUID().toString()}"
|
||||||
|
def templateName = "pipeline-worker"
|
||||||
|
podTemplate(
|
||||||
|
label: label,
|
||||||
|
name: templateName,
|
||||||
|
yaml: functions.podYaml(
|
||||||
|
repo: repository,
|
||||||
|
templateName: templateName,
|
||||||
|
[
|
||||||
|
[
|
||||||
|
name: "compile",
|
||||||
|
path: "${repository}/dockerhub/library/golang:alpine",
|
||||||
|
]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
node (label) {
|
||||||
|
def workspace = pwd()
|
||||||
|
|
||||||
|
stage ("Pull Local Repo") {
|
||||||
|
checkout([
|
||||||
|
$class: "GitSCM",
|
||||||
|
branches: [
|
||||||
|
[
|
||||||
|
name: "refs/remotes/origin/main",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
userRemoteConfigs: [
|
||||||
|
[
|
||||||
|
url: "ssh://git@gitea.smoothnet.org:31822/nhyatt/bind-response-policy-zone-creator.git",
|
||||||
|
credentialsId: "Gitea-Read-Only-Token",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
extensions: [
|
||||||
|
[
|
||||||
|
$class: "CloneOption",
|
||||||
|
shallow: true,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
$class: "CheckoutOption",
|
||||||
|
timeout: 2,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
stage("Build Binary") {
|
||||||
|
container("compile") {
|
||||||
|
sh """
|
||||||
|
apk add --no-cache gcc musl-dev upx
|
||||||
|
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -v -ldflags="-s -w" -tags timetzdata -o pihole-zone-generator ./cmd/bind
|
||||||
|
upx --lzma pihole-zone-generator
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage ("Store Artifacts") {
|
||||||
|
archiveArtifacts (artifacts: "pihole-zone-generator",
|
||||||
|
fingerprint: true,
|
||||||
|
allowEmptyArchive: false,
|
||||||
|
onlyIfSuccessful: true,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user