Skip to content

Create a pipeline for official builds #10

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

Merged
merged 10 commits into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 31 additions & 0 deletions build/azure-pipelines/build-common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
steps:
- task: GoTool@0
inputs:
version: '1.16.5'

- task: Go@0
displayName: 'Go: get dependencies'
inputs:
command: 'get'
arguments: '-d'
workingDirectory: '$(Build.SourcesDirectory)/cmd/sqlcmd'

- task: Go@0
displayName: 'Go: build sqlcmd'
inputs:
command: 'build'
arguments: '-o $(Build.BinariesDirectory)'
workingDirectory: '$(Build.SourcesDirectory)/cmd/sqlcmd'

- task: CopyFiles@2
inputs:
TargetFolder: '$(Build.ArtifactStagingDirectory)'
SourceFolder: '$(Build.BinariesDirectory)'
Contents: '**'

- task: PublishPipelineArtifact@1
displayName: 'Publish binary'
inputs:
targetPath: $(Build.ArtifactStagingDirectory)
artifactName: Sqlcmd$(Agent.OS)

129 changes: 129 additions & 0 deletions build/azure-pipelines/build-product.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
trigger:
tags:
include:
- v0.*

stages:
- stage: Compile
displayName: Compile sqlcmd on all 3 platforms
jobs:
- job: Compile_sqlcmd
strategy:
matrix:
linux:
imageName: 'ubuntu-latest'
mac:
imageName: 'macOS-latest'
windows:
imageName: 'windows-latest'
pool:
vmImage: $(imageName)
steps:
- template: build-common.yml

- stage: CreatePackages
displayName: Create packages to publish
jobs:
- job: Sign_and_pack
pool:
vmImage: 'windows-latest'
steps:
- task: PowerShell@2
displayName: Set last tag to variable
inputs:
targetType: 'inline'
script: |
$VERSION_TAG = git describe --tags (git rev-list --tags --max-count=1)
Write-Host("##vso[task.setvariable variable=VERSION_TAG]$VERSION_TAG")
Write-Host($VERSION_TAG)

- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
targetPath: '$(Pipeline.Workspace)'

- task: EsrpCodeSigning@1
displayName: Sign Windows binary
inputs:
ConnectedServiceName: 'Code Signing'
FolderPath: '$(Pipeline.Workspace)\SqlcmdWindows_NT'
Pattern: '*.exe'
signConfigType: 'inlineSignParams'
SessionTimeout: '600'
MaxConcurrency: '5'
MaxRetryAttempts: '5'
inlineOperation: |
[
{
"keyCode": "CP-230012",
"operationSetCode": "SigntoolSign",
"parameters": [
{
"parameterName": "OpusName",
"parameterValue": "go-sqlcmd"
},
{
"parameterName": "OpusInfo",
"parameterValue": "https://github.com/microsoft/go-sqlcmd"
},
{
"parameterName": "PageHash",
"parameterValue": "/NPH"
},
{
"parameterName": "FileDigest",
"parameterValue": "/fd sha256"
},
{
"parameterName": "TimeStamp",
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
}
],
"toolName": "signtool.exe",
"toolVersion": "6.2.9304.0"
},
{
"keyCode": "CP-230012",
"operationSetCode": "SigntoolVerify",
"parameters": [
{
"parameterName": "VerifyAll",
"parameterValue": "/all"
}
],
"toolName": "signtool.exe",
"toolVersion": "6.2.9304.0"
}
]
- task: ArchiveFiles@2
displayName: Zip Windows binary
inputs:
rootFolderOrFile: '$(Pipeline.Workspace)\SqlcmdWindows_NT\Sqlcmd.exe'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(VERSION_TAG)-windows.zip'

- task: ArchiveFiles@2
displayName: Tar Linux binary
inputs:
rootFolderOrFile: '$(Pipeline.Workspace)\SqlcmdLinux'
includeRootFolder: false
archiveType: 'tar'
tarCompression: 'bz2'
archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(VERSION_TAG)-linux.tar.bz2'

- task: ArchiveFiles@2
displayName: Tar Darwin binary
inputs:
rootFolderOrFile: '$(Pipeline.Workspace)\SqlcmdDarwin'
includeRootFolder: false
archiveType: 'tar'
tarCompression: 'bz2'
archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(VERSION_TAG)-darwin.tar.bz2'

- task: PublishPipelineArtifact@1
displayName: 'Publish release archives'
inputs:
targetPath: $(Build.ArtifactStagingDirectory)
artifactName: SqlcmdRelease