Adds automation to automatically build binary
This commit is contained in:
		
							
								
								
									
										74
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,74 @@ | |||||||
|  | def label = "jenkins-${UUID.randomUUID().toString()}" | ||||||
|  |  | ||||||
|  | def repository = "registry.c.test-chamber-13.lan" | ||||||
|  |  | ||||||
|  | def tag = "0.76" | ||||||
|  |  | ||||||
|  | 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:latest | ||||||
|  |     tty: true | ||||||
|  |     command: | ||||||
|  |     - /bin/cat | ||||||
|  | """) { | ||||||
|  |     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/tplinkcmd.git", | ||||||
|  |                         credentialsId: "Gitea-Read-Only-Token", | ||||||
|  |                     ], | ||||||
|  |                 ], | ||||||
|  |                 extensions: [ | ||||||
|  |                     [ | ||||||
|  |                         $class: "CloneOption", | ||||||
|  |                         shallow: true, | ||||||
|  |                     ], | ||||||
|  |                     [ | ||||||
|  |                         $class: "CheckoutOption", | ||||||
|  |                         timeout: 2, | ||||||
|  |                     ], | ||||||
|  |                 ], | ||||||
|  |             ]) | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         stage("Build Putty") { | ||||||
|  |             container("compile") { | ||||||
|  |                 sh """ | ||||||
|  |                     apt update | ||||||
|  |                     apt install upx -y | ||||||
|  |                     go install -v ./... | ||||||
|  |                     GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -v -ldflags="-s -w" -tags timetzdata -o tplink ./cmd/tpstate | ||||||
|  |                     upx --brute tplink | ||||||
|  |                 """ | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         stage ("Store Artifacts") { | ||||||
|  |             archiveArtifacts (artifacts: "tplink", | ||||||
|  |                 fingerprint: true, | ||||||
|  |                 allowEmptyArchive: false, | ||||||
|  |                 onlyIfSuccessful: true, | ||||||
|  |             ) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user