Skip to content

Commit c7dceab

Browse files
authored
Merge pull request #12 from couchbaselabs/rponton/DotNetWinPathLength
Work around Windows path limit in couchbase-net-client-scripted-build-pipeline
2 parents dc2df46 + ad45778 commit c7dceab

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

dotnet/sdk/build-pipeline.groovy

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ def PLATFORMS = [
88
"macos",
99
"ubuntu20"
1010
]
11-
def DOTNET_SDK_VERSIONS = ["3.1.410", "5.0.301"]
12-
def ALL_SUPPORTED_SDK_VERSIONS = ["2.1.816", "3.1.410", "5.0.301"]
11+
def DOTNET_SDK_VERSIONS = ["3.1.410", "5.0.302"]
12+
def ALL_SUPPORTED_SDK_VERSIONS = ["2.1.816", "3.1.410", "5.0.302"]
1313
def DOTNET_SDK_VERSION = ""
1414
def CB_SERVER_VERSIONS = [
1515
"7.0-stable",
@@ -21,6 +21,11 @@ def CB_SERVER_VERSIONS = [
2121
def SUFFIX = "r${BUILD_NUMBER}"
2222
def BRANCH = ""
2323

24+
// Windows has a 255 character path limit, still.
25+
// cbdep trying to unzip .NET SDK 5.0.x shows a FileNotFound error, which is really a PathTooLong error
26+
// using this path instead of WORKSPACE\deps gets around the issue.
27+
def CBDEP_WIN_PATH = "%TEMP%\\cbnc\\deps"
28+
2429
// use Replay and change this line to force Combination tests to run, even on a gerrit-trigger build.
2530
// useful for testing test-only changes.
2631
def FORCE_COMBINATION_TEST_RUN = false
@@ -110,8 +115,8 @@ pipeline {
110115

111116
// pack with SNK
112117
withCredentials([file(credentialsId: 'netsdk-signkey', variable: 'SDKSIGNKEY')]) {
113-
batWithEcho("deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet build couchbase-net-client\\Src\\Couchbase\\Couchbase.csproj -c Release /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=${SDKSIGNKEY} /p:Version=${version} /p:IncludeSymbols=true /p:IncludeSource=true /p:SourceLinkCreate=true")
114-
batWithEcho("deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet pack couchbase-net-client\\Src\\Couchbase\\Couchbase.csproj -c Release /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=${SDKSIGNKEY} /p:Version=${version} /p:IncludeSymbols=true /p:IncludeSource=true /p:SourceLinkCreate=true")
118+
batWithEcho("%TEMP%\\cbnc\\deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet build couchbase-net-client\\Src\\Couchbase\\Couchbase.csproj -c Release /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=${SDKSIGNKEY} /p:Version=${version} /p:IncludeSymbols=true /p:IncludeSource=true /p:SourceLinkCreate=true")
119+
batWithEcho("%TEMP%\\cbnc\\deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet pack couchbase-net-client\\Src\\Couchbase\\Couchbase.csproj -c Release /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=${SDKSIGNKEY} /p:Version=${version} /p:IncludeSymbols=true /p:IncludeSource=true /p:SourceLinkCreate=true")
115120
}
116121

117122
// create zip file of release files
@@ -151,7 +156,7 @@ pipeline {
151156
unstash "couchbase-net-client-package"
152157
echo "Publishing package to Nuget .."
153158

154-
batWithEcho("deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet nuget push couchbase-net-client\\**\\*.nupkg -k ${NUGETKEY} -s https://api.nuget.org/v3/index.json --no-symbols true")
159+
batWithEcho("%TEMP%\\cbnc\\deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet nuget push couchbase-net-client\\**\\*.nupkg -k ${NUGETKEY} -s https://api.nuget.org/v3/index.json --no-symbols true")
155160
}
156161
}
157162

@@ -187,13 +192,13 @@ def doBuilds(PLATFORMS, DOTNET_SDK_VERSION, BRANCH, ALL_SUPPORTED_SDK_VERSIONS)
187192

188193
if (BRANCH == "master") {
189194
if (platform.contains("window")) {
190-
batWithEcho("deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet build couchbase-net-client\\couchbase-net-client.sln")
195+
batWithEcho("%TEMP%\\cbnc\\deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet build couchbase-net-client\\couchbase-net-client.sln")
191196
} else {
192197
shWithEcho("deps/dotnet-core-sdk-${DOTNET_SDK_VERSION}/dotnet build couchbase-net-client/couchbase-net-client.sln")
193198
}
194199
} else if (BRANCH == "release27") {
195200
if (platform.contains("window")) {
196-
batWithEcho("deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet build couchbase-net-client\\Src\\couchbase-net-client.sln")
201+
batWithEcho("%TEMP%\\cbnc\\deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet build couchbase-net-client\\Src\\couchbase-net-client.sln")
197202
} else {
198203
shWithEcho("deps/dotnet-core-sdk-${DOTNET_SDK_VERSION}/dotnet build couchbase-net-client/Src/couchbase-net-client.sln")
199204
}
@@ -225,8 +230,8 @@ def doUnitTests(PLATFORMS, DOTNET_SDK_VERSION, BRANCH, ALL_SUPPORTED_SDK_VERSION
225230
if (BRANCH == "master") {
226231
if (platform.contains("window")) {
227232
try {
228-
batWithEcho("deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet --list-sdks")
229-
batWithEcho("deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet test --test-adapter-path:. --logger:junit couchbase-net-client\\tests\\Couchbase.UnitTests\\Couchbase.UnitTests.csproj -f net5.0 --no-build")
233+
batWithEcho("%TEMP%\\cbnc\\deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet --list-sdks")
234+
batWithEcho("%TEMP%\\cbnc\\deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet test --test-adapter-path:. --logger:junit couchbase-net-client\\tests\\Couchbase.UnitTests\\Couchbase.UnitTests.csproj -f net5.0 --no-build")
230235
}
231236
finally {
232237
junit allowEmptyResults: true, testResults: "couchbase-net-client\\tests\\Couchbase.UnitTests\\TestResults\\TestResults.xml"
@@ -241,10 +246,10 @@ def doUnitTests(PLATFORMS, DOTNET_SDK_VERSION, BRANCH, ALL_SUPPORTED_SDK_VERSION
241246
}
242247
} else if (BRANCH == "release27") {
243248
if (platform.contains("window")) {
244-
batWithEcho("deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet restore couchbase-net-client\\Src\\Couchbase.UnitTests\\Couchbase.UnitTests.csproj")//cleanup if NuGet hangs
245-
batWithEcho("deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet test couchbase-net-client\\Src\\Couchbase.UnitTests\\Couchbase.UnitTests.csproj -f net452 --no-build")
246-
batWithEcho("deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet test couchbase-net-client\\Src\\Couchbase.UnitTests\\Couchbase.UnitTests.csproj -f netcoreapp2.0 --no-build")
247-
//batWithEcho("deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet test couchbase-net-client\\Src\\Couchbase.UnitTests\\Couchbase.UnitTests.csproj -f netcoreapp1.1 --no-build")
249+
batWithEcho("%TEMP%\\cbnc\\deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet restore couchbase-net-client\\Src\\Couchbase.UnitTests\\Couchbase.UnitTests.csproj")//cleanup if NuGet hangs
250+
batWithEcho("%TEMP%\\cbnc\\deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet test couchbase-net-client\\Src\\Couchbase.UnitTests\\Couchbase.UnitTests.csproj -f net452 --no-build")
251+
batWithEcho("%TEMP%\\cbnc\\deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet test couchbase-net-client\\Src\\Couchbase.UnitTests\\Couchbase.UnitTests.csproj -f netcoreapp2.0 --no-build")
252+
//batWithEcho("%TEMP%\\cbnc\\deps\\dotnet-core-sdk-${DOTNET_SDK_VERSION}\\dotnet test couchbase-net-client\\Src\\Couchbase.UnitTests\\Couchbase.UnitTests.csproj -f netcoreapp1.1 --no-build")
248253
} else {
249254
shWithEcho("deps/dotnet-core-sdk-${DOTNET_SDK_VERSION}/dotnet restore couchbase-net-client/Src/Couchbase.UnitTests/Couchbase.UnitTests.csproj")//cleanup if NuGet hangs
250255
shWithEcho("deps/dotnet-core-sdk-${DOTNET_SDK_VERSION}/dotnet test couchbase-net-client/Src/Couchbase.UnitTests/Couchbase.UnitTests.csproj -f netcoreapp2.0 --no-build")
@@ -383,8 +388,11 @@ def doCombinationTests(CB_SERVER_VERSIONS, DOTNET_SDK_VERSION, BRANCH, ALL_SUPPO
383388

384389
def installSDK(PLATFORM, DOTNET_SDK_VERSION) {
385390
def install = false
386-
387-
dir("deps") {
391+
def depsDir = "deps"
392+
if (PLATFORM.contains("window")) {
393+
depsDir = "%TEMP%\\cbnc\\deps"
394+
}
395+
dir(depsDir) {
388396
dir("dotnet-core-sdk-${DOTNET_SDK_VERSION}") {
389397
if (PLATFORM.contains("window")) {
390398
install = !fileExists("dotnet.exe")
@@ -397,7 +405,7 @@ def installSDK(PLATFORM, DOTNET_SDK_VERSION) {
397405
if (install) {
398406
echo "Installing .NET SDK ${DOTNET_SDK_VERSION}"
399407
if (PLATFORM.contains("window")) {
400-
batWithEcho("cbdep install -d deps dotnet-core-sdk ${DOTNET_SDK_VERSION}")
408+
batWithEcho("cbdep install -d %TEMP%\\cbnc\\deps dotnet-core-sdk ${DOTNET_SDK_VERSION}")
401409
} else {
402410
shWithEcho("cbdep install -d deps dotnet-core-sdk ${DOTNET_SDK_VERSION}")
403411
}

0 commit comments

Comments
 (0)