From b42a4df38cf21d36e5514ffaaade5b96ee401c42 Mon Sep 17 00:00:00 2001
From: The_Spider <nhyatt@smoothnet.org>
Date: Sat, 30 Oct 2021 17:54:33 -0500
Subject: [PATCH] build-binary

---
 Jenkinsfile | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)
 create mode 100644 Jenkinsfile

diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..b0ee472
--- /dev/null
+++ b/Jenkinsfile
@@ -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,
+                )
+            }
+        }
+    }
+}
\ No newline at end of file