Skip to content

Commit e397291

Browse files
authored
Merge pull request #64 from microsoft/stuartpa/package-msi
MSI (Windows) release package
2 parents 0887990 + 65eb2aa commit e397291

15 files changed

+686
-3
lines changed

Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ LABEL maintainer="Microsoft" \
2323
org.label-schema.build-date=$BUILD_DATE \
2424
org.label-schema.docker.cmd="docker run -it microsoft/sqlcmd:$PACKAGE_VERSION"
2525

26-
2726
COPY ./sqlcmd /usr/bin/sqlcmd
2827

2928
CMD ["sqlcmd"]

build/azure-pipelines/package-common-create.yml

+81-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ steps:
2323
Write-Host("##vso[task.setvariable variable=VERSION_TAG]$VERSION_TAG")
2424
Write-Host($VERSION_TAG)
2525
- task: CmdLine@2
26+
condition: ne(variables.OS, 'windows')
2627
displayName: 'Build ${{ parameters.OS }}/${{ parameters.Type }} distribution'
2728
inputs:
2829
script: release/${{ parameters.OS }}/${{ parameters.Type }}/pipeline.sh
@@ -31,8 +32,87 @@ steps:
3132
CLI_VERSION: $(VERSION_TAG)
3233
BUILD_OUTPUT: $(Pipeline.Workspace)
3334
BUILD_STAGINGDIRECTORY: $(Build.ArtifactStagingDirectory)
35+
- task: VSBuild@1
36+
condition: eq(variables.OS, 'windows')
37+
displayName: 'Build Windows MSI distribution'
38+
inputs:
39+
solution: '$(Build.SourcesCliDirectory)\release\windows\msi\sqlcmd.wixproj'
40+
msbuildArchitecture: 'x86'
41+
msbuildArgs: '/p:Configuration=Release'
42+
env:
43+
CLI_VERSION: $(VERSION_TAG)
44+
- task: EsrpCodeSigning@1
45+
condition: eq(variables.OS, 'windows')
46+
inputs:
47+
ConnectedServiceName: 'Code Signing'
48+
FolderPath: '$(Build.SourcesDirectory)/release/windows/msi/bin/Release'
49+
Pattern: '*.msi'
50+
signConfigType: 'inlineSignParams'
51+
inlineOperation: |
52+
[
53+
{
54+
"keyCode": "CP-230012",
55+
"operationSetCode": "SigntoolSign",
56+
"parameters": [
57+
{
58+
"parameterName": "OpusName",
59+
"parameterValue": "Sqlcmd Tools"
60+
},
61+
{
62+
"parameterName": "OpusInfo",
63+
"parameterValue": "https://github.com/microsoft/go-sqlcmd"
64+
},
65+
{
66+
"parameterName": "PageHash",
67+
"parameterValue": "/NPH"
68+
},
69+
{
70+
"parameterName": "FileDigest",
71+
"parameterValue": "/fd sha256"
72+
},
73+
{
74+
"parameterName": "TimeStamp",
75+
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
76+
}
77+
],
78+
"toolName": "signtool.exe",
79+
"toolVersion": "6.2.9304.0"
80+
},
81+
{
82+
"keyCode": "CP-230012",
83+
"operationSetCode": "SigntoolVerify",
84+
"parameters": [
85+
{
86+
"parameterName": "VerifyAll",
87+
"parameterValue": "/all"
88+
}
89+
],
90+
"toolName": "signtool.exe",
91+
"toolVersion": "6.2.9304.0"
92+
}
93+
]
94+
SessionTimeout: '600'
95+
MaxConcurrency: '50'
96+
MaxRetryAttempts: '20'
97+
- task: Bash@3
98+
condition: eq(variables.OS, 'windows')
99+
displayName: 'Rename MSI'
100+
inputs:
101+
targetType: 'inline'
102+
script: |
103+
mv "$(Build.SourcesDirectory)/release/windows/msi/bin/Release/sqlcmd.msi" "$(Build.SourcesDirectory)/release/windows/msi/bin/Release/sqlcmd_${CLI_VERSION}-${CLI_VERSION_REVISION}.msi"
104+
env:
105+
CLI_VERSION: $(VERSION_TAG)
106+
CLI_VERSION_REVISION: 1
107+
- task: CopyFiles@2
108+
condition: eq(variables.OS, 'windows')
109+
displayName: 'Copy MSI to: $(Build.ArtifactStagingDirectory)'
110+
inputs:
111+
sourceFolder: $(Build.SourcesDirectory)/release/windows/msi/bin/Release
112+
contents: '?(*.msi|*.md)'
113+
TargetFolder: $(Build.ArtifactStagingDirectory)
34114
- task: EsrpCodeSigning@1
35-
condition: ne(variables.Type, 'docker')
115+
condition: and(eq(variables.OS, 'linux'), ne(variables.Type, 'docker'))
36116
inputs:
37117
ConnectedServiceName: 'Code Signing'
38118
FolderPath: $(Build.ArtifactStagingDirectory)

build/azure-pipelines/package-common-test.yml

+12-1
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,21 @@ steps:
1616
Write-Host("##vso[task.setvariable variable=VERSION_TAG]$VERSION_TAG")
1717
Write-Host($VERSION_TAG)
1818
- task: CmdLine@2
19-
displayName: 'Test ${{ parameters.OS }}/${{ parameters.Type }} distribution'
19+
condition: ne(variables.OS, 'windows')
20+
displayName: 'Test ${{ parameters.OS }}/${{ parameters.Type }} package'
2021
inputs:
2122
script: release/${{ parameters.OS }}/${{ parameters.Type }}/pipeline-test.sh
2223
workingDirectory: $(Build.SourcesCliDirectory)
2324
env:
2425
CLI_VERSION: $(VERSION_TAG)
2526
BUILD_STAGINGDIRECTORY: $(Build.ArtifactStagingDirectory)
27+
- task: PowerShell@2
28+
condition: eq(variables.OS, 'windows')
29+
displayName: 'Test ${{ parameters.OS }}/${{ parameters.Type }} package'
30+
inputs:
31+
targetType: 'filePath'
32+
filePath: '$(Build.SourcesDirectory)\release\windows\msi\scripts\pipeline-test.ps1'
33+
failOnStderr: true
34+
env:
35+
CLI_VERSION: $(VERSION_TAG)
36+

build/azure-pipelines/package-product.yml

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pr: none
66

77
variables:
88
Build.SourcesCliDirectory: '$(Build.SourcesDirectory)/'
9+
MSI_OUTPUT_DIR: '$(Build.SourcesCliDirectory)/output'
910

1011
stages:
1112
- stage: CreatePackages
@@ -26,6 +27,10 @@ stages:
2627
imageName: 'ubuntu-latest'
2728
os: linux
2829
type: docker
30+
windows:
31+
imageName: 'windows-2019'
32+
os: windows
33+
type: msi
2934
pool:
3035
vmImage: $(imageName)
3136
steps:

release/windows/msi/README.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Windows MSI
2+
3+
This document provides instructions on creating the MSI.
4+
5+
## Prerequisites
6+
7+
1. WIX Toolset
8+
2. Turn on the '.NET Framework 3.5' Windows Feature (required for WIX Toolset)
9+
3. Install [WIX Toolset build tools](http://wixtoolset.org/releases/) if not already installed
10+
4. Install [Microsoft Build Tools](https://www.microsoft.com/en-us/download/details.aspx?id=48159)
11+
12+
## Building
13+
14+
1. Set the `CLI_VERSION` environment variable
15+
2. Run `release\windows\msi\scripts\pipeline.cmd`
16+
3. The unsigned MSI will be in the `.\output\msi` folder
17+
18+
> **Note:** For `building step 1.` above set both env-vars to the same version-tag for the immediate, this will consolidated in the future.
19+
20+
## Release Install/Update/Uninstall Steps
21+
22+
> **Note:** Replace `{{HOST}}` and `{{CLI_VERSION}}` with the appropriate values.
23+
24+
### Install `Sqlcmd Tools` on Windows
25+
26+
The MSI distributable is used for installing or updating the `Sqlcmd Tools` CLI on Windows.
27+
28+
[Download the MSI Installer](http://{{HOST}}/sqlcmd-{{CLI_VERSION}}.msi)
29+
30+
When the installer asks if it can make changes to your computer, click the `Yes` box.
31+
32+
### Uninstall
33+
34+
You can uninstall the `SqlCmd Tools` from the Windows _Apps and Features_ list. To uninstall:
35+
36+
| Platform | Instructions |
37+
| ------------- |--------------------------------------------------------|
38+
| Windows 10 | Start > Settings > Apps |
39+
| Windows 8 | Start > Control Panel > Programs > Uninstall a program |
40+
41+
The program to uninstall is listed as **Sqlcmd Tools** . Select this application, then click the `Uninstall` button.

0 commit comments

Comments
 (0)