Skip to content

Commit b55d94f

Browse files
Merge branch 'main' into run-staticcheck-on-multiple-platforms
2 parents c665b6e + 758fca9 commit b55d94f

76 files changed

Lines changed: 11953 additions & 5394 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/golangci-lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ jobs:
99
name: lint-pr-changes
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/setup-go@v3
12+
- uses: actions/setup-go@v5
1313
with:
14-
go-version: 1.18
15-
- uses: actions/checkout@v3
14+
go-version: stable
15+
- uses: actions/checkout@v4
1616
- name: golangci-lint
17-
uses: golangci/golangci-lint-action@v3
17+
uses: golangci/golangci-lint-action@v6
1818
with:
1919
version: latest
2020
only-new-issues: true

.github/workflows/pr-validation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Setup go
1414
uses: actions/setup-go@v2
1515
with:
16-
go-version: '1.21'
16+
go-version: '1.22'
1717
- name: Run tests against Linux SQL
1818
run: |
1919
go version
@@ -22,6 +22,6 @@ jobs:
2222
go build .
2323
export SQLCMDPASSWORD=$(date +%s|sha256sum|base64|head -c 32)
2424
export SQLCMDUSER=sa
25-
docker run -m 2GB -e ACCEPT_EULA=1 -d --name sql2017 -p:1433:1433 -e SA_PASSWORD=$SQLCMDPASSWORD mcr.microsoft.com/mssql/server:2017-latest
25+
docker run -m 2GB -e ACCEPT_EULA=1 -d --name sql2022 -p:1433:1433 -e SA_PASSWORD=$SQLCMDPASSWORD mcr.microsoft.com/mssql/server:2022-latest
2626
cd ../..
2727
go test -v ./...

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*.dylib
77
bin
88
obj
9-
9+
.vscode/*
1010
# Test binary, built with `go test -c`
1111
*.test
1212

@@ -32,3 +32,12 @@ darwin-arm64/sqlcmd
3232
linux-amd64/sqlcmd
3333
linux-arm64/sqlcmd
3434
linux-s390x/sqlcmd
35+
36+
# Build artifacts in root
37+
/sqlcmd
38+
/sqlcmd_binary
39+
40+
# certificates used for local testing
41+
*.der
42+
*.pem
43+
*.pfx

.pipelines/LocBuild.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
trigger: none
2+
pr: none
3+
4+
pool:
5+
vmImage: 'windows-latest'
6+
7+
steps:
8+
- checkout: self
9+
persistCredentials: true # needed for the OneLocBuild task to access the repo
10+
11+
- task: OneLocBuild@2
12+
env:
13+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
14+
inputs:
15+
isCreatePrSelected: true
16+
repoType: 'github'
17+
locProj: internal/translations/LocProject.json
18+
outDir: '$(Build.ArtifactStagingDirectory)'
19+
packageSourceAuth: patAuth
20+
dependencyPackageSource: 'https://pkgs.dev.azure.com/msdata/_packaging/SQLDS_SSMS/nuget/v3/index.json'
21+
patVariable: $(System.AccessToken)
22+
23+
- task: PublishPipelineArtifact@1
24+
inputs:
25+
targetPath: '$(Build.ArtifactStagingDirectory)'
26+
artifact: 'drop'

.pipelines/TestSql2017.yml

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
variables:
2-
# AZURE_CLIENT_SECRET and SQLPASSWORD must be defined as secret variables in the pipeline.
3-
# AZURE_TENANT_ID and AZURE_CLIENT_ID are not expected to be secret variables, just regular variables
4-
AZURECLIENTSECRET: $(AZURE_CLIENT_SECRET)
52
PASSWORD: $(SQLPASSWORD)
63
pool:
74
vmImage: 'ubuntu-latest'
@@ -10,45 +7,44 @@ steps:
107
- template: include-install-go-tools.yml
118

129
- task: Docker@2
13-
displayName: 'Run SQL 2017 docker image'
10+
displayName: 'Run SQL 2022 docker image'
1411
inputs:
1512
command: run
16-
arguments: '-m 2GB -e ACCEPT_EULA=1 -d --name sql2017 -p:1433:1433 -e SA_PASSWORD=$(PASSWORD) mcr.microsoft.com/mssql/server:2017-latest'
13+
arguments: '-m 2GB -e ACCEPT_EULA=1 -d --name sql2022 -p:1433:1433 -e SA_PASSWORD=$(PASSWORD) mcr.microsoft.com/mssql/server:2022-latest'
1714

1815
- template: include-runtests-linux.yml
1916
parameters:
20-
RunName: 'SQL2017'
17+
RunName: 'SQL2022'
2118
SQLCMDUSER: sa
2219
SQLPASSWORD: $(PASSWORD)
2320

24-
# The use of client secrets is disallowed now, so commenting out the Azure tests until we can switch to a federated credential.
25-
# - template: include-runtests-linux.yml
26-
# parameters:
27-
# RunName: 'SQLDB'
28-
# # AZURESERVER must be defined as a variable in the pipeline
29-
# SQLCMDSERVER: $(AZURESERVER)
30-
# AZURECLIENTSECRET: $(AZURECLIENTSECRET)
31-
32-
- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4
33-
displayName: Merge coverage data
21+
- task: AzureCLI@2
3422
inputs:
35-
reports: '**/*.coverage.xml"' # REQUIRED # The coverage reports that should be parsed (separated by semicolon). Globbing is supported.
36-
targetdir: 'coverage' # REQUIRED # The directory where the generated report should be saved.
37-
reporttypes: 'HtmlInline_AzurePipelines;Cobertura' # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlSummary, JsonSummary, Latex, LatexSummary, lcov, MarkdownSummary, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, Xml, XmlSummary
38-
sourcedirs: '$(Build.SourcesDirectory)' # Optional directories which contain the corresponding source code (separated by semicolon). The source directories are used if coverage report contains classes without path information.
39-
verbosity: 'Info' # The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off
40-
tag: '$(build.buildnumber)_#$(build.buildid)_$(Build.SourceBranchName)' # Optional tag or build version.
41-
- task: PublishCodeCoverageResults@1
23+
addSpnToEnvironment: true
24+
azureSubscription: $(AZURESUBSCRIPTION_SERVICE_CONNECTION_NAME)
25+
scriptType: pscore
26+
scriptLocation: inlineScript
27+
inlineScript: |
28+
Write-Host "##vso[task.setvariable variable=AZURESUBSCRIPTION_CLIENT_ID;]$env:AZURESUBSCRIPTION_CLIENT_ID"
29+
Write-Host "##vso[task.setvariable variable=AZURESUBSCRIPTION_TENANT_ID;]$env:AZURESUBSCRIPTION_TENANT_ID"
30+
gci env:* | sort-object name
31+
32+
- template: include-runtests-linux.yml
33+
parameters:
34+
RunName: 'SQLDB'
35+
# AZURESERVER must be defined as a variable in the pipeline
36+
SQLCMDSERVER: $(AZURESERVER)
37+
- task: UseDotNet@2
38+
inputs:
39+
packageType: 'runtime'
40+
version: '8.x'
41+
42+
- task: PublishCodeCoverageResults@2
4243
inputs:
43-
codeCoverageTool: Cobertura
4444
pathToSources: '$(Build.SourcesDirectory)'
45-
summaryFileLocation: $(Build.SourcesDirectory)/coverage/*.xml
46-
reportDirectory: $(Build.SourcesDirectory)/coverage
45+
summaryFileLocation: $(Build.SourcesDirectory)/**/*coverage.xml
4746
failIfCoverageEmpty: true
4847
condition: always()
4948
continueOnError: true
50-
env:
51-
disable.coverage.autogenerate: 'true'
5249

53-
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
54-
displayName: ‘Component Detection’
50+

.pipelines/include-install-go-tools.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
steps:
22
- task: GoTool@0
33
inputs:
4-
version: '1.18'
4+
version: '1.22.10'
55
- task: Go@0
66
displayName: 'Go: get dependencies'
77
inputs:

.pipelines/include-runtests-linux.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ parameters:
77
- name: SQLPASSWORD
88
type: string
99
default: ''
10-
- name: AZURECLIENTSECRET
11-
type: string
12-
default: ''
1310
- name: SQLCMDSERVER
1411
type: string
1512
default: .
@@ -28,11 +25,11 @@ steps:
2825
SQLPASSWORD: ${{ parameters.SQLPASSWORD }}
2926
SQLCMDUSER: ${{ parameters.SQLCMDUSER }}
3027
SQLCMDPASSWORD: ${{ parameters.SQLPASSWORD }}
31-
AZURE_TENANT_ID: $(AZURE_TENANT_ID)
32-
AZURE_CLIENT_ID: $(AZURE_CLIENT_ID)
33-
AZURE_CLIENT_SECRET: ${{ parameters.AZURECLIENTSECRET }}
3428
SQLCMDSERVER: ${{ parameters.SQLCMDSERVER }}
3529
SQLCMDDBNAME: ${{ parameters.SQLCMDDBNAME }}
30+
AZURESUBSCRIPTION_CLIENT_ID: $(AZURESUBSCRIPTION_CLIENT_ID)
31+
AZURESUBSCRIPTION_TENANT_ID: $(AZURESUBSCRIPTION_TENANT_ID)
32+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
3633
continueOnError: true
3734
3835
- task: PublishTestResults@2

.vscode/launch.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@
2424
"request": "launch",
2525
"mode" : "auto",
2626
"program": "${workspaceFolder}/cmd/modern",
27-
"args" : ["-S", "davidshi-2022", "-g", "-Q", "select nvarcharcol from encrypt.dbo.encrypted", "--driver-logging-level=65"],
27+
"args" : ["-S", ".", "-Q", "select top 8 name from sys.all_objects"],
28+
},
29+
{
30+
"name" : "Print help",
31+
"type" : "go",
32+
"request": "launch",
33+
"mode" : "auto",
34+
"program": "${workspaceFolder}/cmd/modern",
35+
"args" : ["-?"],
2836
},
2937
{
3038
"name" : "Run file query",

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
22
"go.lintTool": "golangci-lint",
3-
"go.lintOnSave": "workspace"
3+
"go.lintOnSave": "workspace",
4+
"azure-pipelines.1ESPipelineTemplatesSchemaFile": true,
5+
"sarif-viewer.connectToGithubCodeScanning": "on"
46
}

0 commit comments

Comments
 (0)