Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Signing for Windows #8816

Merged
merged 33 commits into from
Feb 11, 2021
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8234fde
Draft config
ivorybilled Feb 5, 2021
740990d
Updated config.yml
ivorybilled Feb 5, 2021
4b49f49
Updated config.yml
ivorybilled Feb 5, 2021
8bb86be
Updated config.yml
ivorybilled Feb 5, 2021
a34f0cb
Updated config.yml
ivorybilled Feb 5, 2021
ec42876
Updated config.yml
ivorybilled Feb 5, 2021
e624eb3
Updated config.yml
ivorybilled Feb 5, 2021
5064b42
Updated config.yml
ivorybilled Feb 5, 2021
74c330f
Create sign-windows.ps1
ivorybilled Feb 8, 2021
b125a18
Updated config.yml
ivorybilled Feb 8, 2021
8ee34c6
Updated config.yml
ivorybilled Feb 8, 2021
5727b68
Delete sign-windows.ps1
ivorybilled Feb 8, 2021
d8b9773
Updated config.yml
ivorybilled Feb 8, 2021
e86685f
Updated config.yml
ivorybilled Feb 8, 2021
87682ae
updating config
ivorybilled Feb 8, 2021
ceacca1
Updated config.yml
ivorybilled Feb 8, 2021
edaa68b
Updated config.yml
ivorybilled Feb 8, 2021
5f07e81
Updated config.yml
ivorybilled Feb 8, 2021
66d6568
Updated config.yml
ivorybilled Feb 8, 2021
23882b7
Updated config.yml
ivorybilled Feb 8, 2021
d0604b7
Updated config.yml
ivorybilled Feb 8, 2021
0639d6f
Updated config.yml
ivorybilled Feb 8, 2021
35b53d0
Updated config.yml
ivorybilled Feb 8, 2021
aa76ea5
Updated config.yml
ivorybilled Feb 8, 2021
9785b6d
Updated config.yml
ivorybilled Feb 8, 2021
85e6560
Create windows-signing.ps1
ivorybilled Feb 9, 2021
3105d48
Updated config.yml
ivorybilled Feb 9, 2021
45cb439
Updated config.yml
ivorybilled Feb 9, 2021
02216a1
Updated config.yml
ivorybilled Feb 9, 2021
bfbafa4
Updated config.yml
ivorybilled Feb 9, 2021
e56dd28
Updated config.yml
ivorybilled Feb 9, 2021
bf22c85
Updated config.yml
ivorybilled Feb 10, 2021
f9e5a2b
Updated config.yml
ivorybilled Feb 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 53 additions & 34 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: 2.1

orbs:
win: circleci/windows@2.2.0
executors:
go-1_14:
working_directory: '/go/src/github.com/influxdata/telegraf'
Expand Down Expand Up @@ -64,6 +65,11 @@ commands:
- store_artifacts:
path: './build/dist'
destination: 'build/dist'
- persist_to_workspace:
root: '/build/dist'
paths:
- '*'

jobs:
deps:
executor: go-1_15
Expand Down Expand Up @@ -143,49 +149,53 @@ jobs:
steps:
- package:
nightly: true
windows-signing:
executor:
name: win/default
shell: powershell.exe
steps:
- attach_workspace:
at: '/build/dist'
- run:
name: "Sign Windows Executables"
shell: powershell.exe
command: |
$tempCertFile = New-TemporaryFile

# Replace with method of retrieving cert and password.
$certText = $env:fakeWindowsCert
$CertPass = $env:fakeWindowsCertPass
$finalFileName = $tempCertFile.FullName
$certBytes = [Convert]::FromBase64String($certText)
[System.IO.File]::WriteAllBytes($finalFileName, $certBytes)
$CertPath = $finalFileName
$Cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($CertPath, $CertPass)

# Replace with circleCI artifact path.
$artifactDirectory = "./build/dist"
$extractDirectory = $artifactDirectory + "\" + "extracted"
foreach ($file in get-ChildItem $artifactDirectory -recurse | where {$_.name -like "*windows*"} | select name)
{
$artifact = $artifactPath + "\" + $file.Name
Expand-Archive -LiteralPath $artifact -DestinationPath $extractDirectory -Force

$subDirectoryPath = $extractDirectory + "\" + (Get-ChildItem -Path $extractDirectory | Select-Object -First 1).Name
$telegrafExePath = $subDirectoryPath + "\" + "telegraf.exe"
Set-AuthenticodeSignature -Certificate $Cert -FilePath $telegrafExePath -TimestampServer http://timestamp.digicert.com
Compress-Archive -Path $subDirectoryPath -DestinationPath $artifact -Force
Remove-Item $extractDirectory -Force -Recurse
}
Remove-Item $finalFileName -Force
workflows:
version: 2
check:
jobs:
- 'macdeps':
filters:
tags:
only: /.*/
- 'deps':
filters:
tags:
only: /.*/
- 'test-go-1_14':
requires:
- 'deps'
filters:
tags:
only: /.*/
- 'test-go-1_14-386':
requires:
- 'deps'
filters:
tags:
only: /.*/
- 'test-go-1_15':
requires:
- 'deps'
filters:
tags:
only: /.*/
- 'test-go-1_15-386':
requires:
- 'deps'
filters:
tags:
only: /.*/
- 'test-go-darwin':
requires:
- 'macdeps'
filters:
tags: # only runs on tags if you specify this filter
only: /.*/
- 'package':
requires:
- 'test-go-darwin'
Expand All @@ -205,6 +215,15 @@ workflows:
only: /.*/
branches:
ignore: /.*/
- 'windows-signing':
requires:
- 'test-go-darwin'
- 'test-go-1_14'
- 'test-go-1_14-386'
- 'test-go-1_15'
- 'test-go-1_15-386'


nightly:
jobs:
- 'deps'
Expand Down Expand Up @@ -237,4 +256,4 @@ workflows:
filters:
branches:
only:
- master
- master