Skip to content

Commit faf7467

Browse files
authored
Sign Windows binary (#37)
1 parent 2c7e1f5 commit faf7467

File tree

2 files changed

+42
-10
lines changed

2 files changed

+42
-10
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ build-darwin-arm64:
2525
build-windows-amd64:
2626
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build $(BUILD_OPTS) -o $(BIN_WINDOWS_AMD64) main.go
2727

28+
sign-binaries: sign-binary-windows-amd64
29+
# This needs to run in a Docker container with the graylog/internal-codesigntool image
30+
codesigntool sign $(BIN_WINDOWS_AMD64)
31+
32+
sign-binary-windows-amd64:
33+
2834
install: install-linux install-darwin-amd64
2935

3036
install-darwin-amd64: build-darwin-amd64

jenkins.groovy

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,35 @@ pipeline
2929

3030
sh "make"
3131
}
32+
}
33+
34+
stage('Sign Windows Binaries')
35+
{
36+
agent
37+
{
38+
docker
39+
{
40+
image 'graylog/internal-codesigntool:latest'
41+
args '-u jenkins:jenkins'
42+
registryCredentialsId 'docker-hub'
43+
alwaysPull true
44+
reuseNode true
45+
}
46+
}
47+
48+
environment
49+
{
50+
CODESIGN_USER = credentials('codesign-user')
51+
CODESIGN_PASS = credentials('codesign-pass')
52+
CODESIGN_TOTP_SECRET = credentials('codesign-totp-secret')
53+
CODESIGN_CREDENTIAL_ID = credentials('codesign-credential-id')
54+
}
55+
56+
steps
57+
{
58+
sh 'make sign-binaries'
59+
}
3260

33-
post
34-
{
35-
success
36-
{
37-
archiveArtifacts '*.linux'
38-
archiveArtifacts '*.darwin-amd64'
39-
archiveArtifacts '*.darwin-arm64'
40-
archiveArtifacts '*.exe'
41-
}
42-
}
4361
}
4462

4563
stage('Release')
@@ -76,6 +94,14 @@ pipeline
7694

7795
post
7896
{
97+
success
98+
{
99+
archiveArtifacts '*.linux'
100+
archiveArtifacts '*.darwin-amd64'
101+
archiveArtifacts '*.darwin-arm64'
102+
archiveArtifacts '*.exe'
103+
}
104+
79105
cleanup
80106
{
81107
cleanWs()

0 commit comments

Comments
 (0)