Skip to content

Commit 2dc52e6

Browse files
authored
Wire up dataset parameter for .NET testing (#110)
1 parent faf5ce5 commit 2dc52e6

File tree

9 files changed

+53
-25
lines changed

9 files changed

+53
-25
lines changed

jenkins/pipelines/dotnet/Jenkinsfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pipeline {
44
choice(name: 'CBL_EDITION', choices: ['enterprise', 'community'], description: 'Couchbase Lite Edition')
55
string(name: 'CBL_VERSION', defaultValue: '3.2.0', description: 'Couchbase Lite Version')
66
string(name: 'CBL_BUILD', defaultValue: '', description: 'Couchbase Lite Build Number')
7+
string(name: 'CBL_DATASET_VERSION', defaultValue: '3.2', description: 'The version of the Couchbase Lite datasets to use')
78
string(name: 'SGW_URL', defaultValue: '', description: "The url of Sync Gateway to download")
89
}
910
options {
@@ -16,8 +17,10 @@ pipeline {
1617
script {
1718
if (params.CBL_VERSION == '') { error "CBL_VERSION is required" }
1819
if (params.CBL_BUILD == '') { error "CBL_BUILD is required" }
20+
if (params.CBL_DATASET_VERSION == '') { error "CBL_DATASET_VERSION is required" }
1921
if (params.SGW_URL == '') { error "SGW_URL is required" }
2022
currentBuild.displayName = "${params.CBL_VERSION}-${params.CBL_BUILD}-${CBL_EDITION}"
23+
currentBuild.description = "Dataset: ${params.CBL_DATASET_VERSION}"
2124
}
2225
}
2326
}
@@ -30,7 +33,7 @@ pipeline {
3033
timeout(time: 60, unit: 'MINUTES')
3134
}
3235
steps {
33-
pwsh "jenkins\\pipelines\\dotnet\\test_winui.ps1 -Edition ${params.CBL_EDITION} -Version ${params.CBL_VERSION} -Build ${params.CBL_BUILD} -SgwUrl ${params.SGW_URL}"
36+
pwsh "jenkins\\pipelines\\dotnet\\test_winui.ps1 -Version ${params.CBL_VERSION} -Build ${params.CBL_BUILD} -Dataset ${params.CBL_DATASET_VERSION} -SgwUrl ${params.SGW_URL}"
3437
}
3538
post {
3639
always {
@@ -51,7 +54,7 @@ pipeline {
5154
}
5255
steps {
5356
sh 'security unlock-keychain -p ${KEYCHAIN_PASSWORD} ~/Library/Keychains/login.keychain-db'
54-
sh "jenkins/pipelines/dotnet/test_mac.sh ${params.CBL_EDITION} ${params.CBL_VERSION} ${params.CBL_BUILD} '${params.SGW_URL}'"
57+
sh "jenkins/pipelines/dotnet/test_mac.sh ${params.CBL_VERSION} ${params.CBL_BUILD} ${params.CBL_DATASET_VERSION} '${params.SGW_URL}'"
5558
}
5659
post {
5760
always {
@@ -75,7 +78,7 @@ pipeline {
7578
agent { label 'mob-e2e-mac-01' }
7679
steps {
7780
sh 'security unlock-keychain -p ${KEYCHAIN_PASSWORD} ~/Library/Keychains/login.keychain-db'
78-
sh "jenkins/pipelines/dotnet/test_ios.sh ${params.CBL_EDITION} ${params.CBL_VERSION} ${params.CBL_BUILD} '${params.SGW_URL}'"
81+
sh "jenkins/pipelines/dotnet/test_ios.sh ${params.CBL_VERSION} ${params.CBL_BUILD} ${params.CBL_DATASET_VERSION} '${params.SGW_URL}'"
7982
}
8083
post {
8184
always {
@@ -90,7 +93,7 @@ pipeline {
9093
}
9194
agent { label 'mob-e2e-mac-01' }
9295
steps {
93-
sh "jenkins/pipelines/dotnet/test_android.sh ${params.CBL_EDITION} ${params.CBL_VERSION} ${params.CBL_BUILD} '${params.SGW_URL}'"
96+
sh "jenkins/pipelines/dotnet/test_android.sh ${params.CBL_VERSION} ${params.CBL_BUILD} ${params.CBL_DATASET_VERSION} '${params.SGW_URL}'"
9497
}
9598
post {
9699
always {

jenkins/pipelines/dotnet/build_winui.ps1

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ Import-Module $PSScriptRoot\prepare_env.psm1 -Force
22

33
$DOTNET_VERSION = Get-DotnetVersion
44

5-
Install-DotNet
6-
Install-Maui
7-
Copy-Datasets
8-
95
Banner -Text "Executing build for .NET $DOTNET_VERSION WinUI"
106

117
# Build

jenkins/pipelines/dotnet/prepare_env.psm1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ Invoke-WebRequest https://raw.githubusercontent.com/couchbaselabs/couchbase-mobi
22
Import-Module $PSScriptRoot/prepare_dotnet.psm1 -Force
33

44
function Copy-Datasets {
5-
Banner -Text "Copying dataset resources"
5+
param (
6+
[Parameter(Mandatory=$true)][string]$Version
7+
)
8+
Banner -Text "Copying dataset resources v$Version"
69

710
Push-Location $PSScriptRoot/../../../servers/dotnet/testserver/Resources/Raw
8-
Copy-Item -Force $PSScriptRoot/../../../dataset/server/dbs/*.zip . -Verbose
11+
Copy-Item -Force $PSScriptRoot/../../../dataset/server/dbs/$Version/*.zip . -Verbose
912
Copy-Item -Recurse -Force $PSScriptRoot/../../../dataset/server/blobs . -Verbose
1013
Pop-Location
1114
}

jenkins/pipelines/dotnet/prepare_env.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,16 @@ fi
1414
source $PREPARE_DOTNET_SCRIPT
1515

1616
function copy_datasets() {
17-
banner "Copying dataset resources"
17+
if [ $# -ne 1 ]; then
18+
echo "No version provided to copy_datasets!"
19+
exit 1
20+
fi
21+
22+
banner "Copying dataset resources v$1"
1823

1924
mkdir -p $SCRIPT_DIR/../../../servers/dotnet/testserver/Resources/Raw
2025
pushd $SCRIPT_DIR/../../../servers/dotnet/testserver/Resources/Raw
21-
cp -fv $SCRIPT_DIR/../../../dataset/server/dbs/*.zip .
26+
cp -fv $SCRIPT_DIR/../../../dataset/server/dbs/$1/*.zip .
2227
cp -Rfv $SCRIPT_DIR/../../../dataset/server/blobs .
2328
popd
2429
}

jenkins/pipelines/dotnet/test_android.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
44

55
source $SCRIPT_DIR/test_common.sh
66

7-
sgw_url="$4"
87
if [ $# -lt 3 ]; then
98
usage
109
exit 1
1110
fi
1211

13-
prepare_dotnet
12+
cbl_version=$1
13+
cbl_build=$2
14+
dataset_version=$3
15+
sgw_url="$4"
16+
17+
prepare_dotnet $dataset_version
1418

15-
modify_package $2 $3
19+
modify_package $cbl_version $cbl_build
1620
$SCRIPT_DIR/build_android.sh
1721

1822
banner "Looking up connected Android device"

jenkins/pipelines/dotnet/test_common.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,24 @@
33
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
44

55
function usage() {
6-
echo "Usage: $0 <edition> <version> <build> [sgw_url]"
7-
echo "edition: enterprise or community (currently unused)"
6+
echo "Usage: $0 <version> <build> <dataset_version> [sgw_url]"
87
echo "version: CBL version (e.g. 3.2.1)"
98
echo "build: CBL build number"
9+
echo "dataset_version: Version of the Couchbase Lite datasets to use"
1010
echo "sgw_url: URL of Sync Gateway to download and use"
1111
}
1212

1313
function prepare_dotnet() {
14+
if [ $# -ne 1 ]; then
15+
echo "No dataset version provided to prepare_dotnet!"
16+
exit 1
17+
fi
18+
1419
source $SCRIPT_DIR/prepare_env.sh
1520
install_dotnet
1621
install_maui
1722
install_xharness
18-
copy_datasets
23+
copy_datasets $1
1924
}
2025

2126
function modify_package() {

jenkins/pipelines/dotnet/test_ios.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
44

55
source $SCRIPT_DIR/test_common.sh
66

7-
sgw_url="$4"
87
if [ $# -lt 3 ]; then
98
usage
109
exit 1
1110
fi
1211

13-
prepare_dotnet
12+
cbl_version=$1
13+
cbl_build=$2
14+
dataset_version=$3
15+
sgw_url="$4"
16+
17+
prepare_dotnet $dataset_version
1418

1519
banner "Looking up connected iOS device"
1620
if [ -f $SCRIPT_DIR/ios_device.txt ]; then
@@ -23,7 +27,7 @@ fi
2327

2428
echo "Found device $ios_device..."
2529

26-
modify_package $2 $3
30+
modify_package $cbl_version $cbl_build
2731
$SCRIPT_DIR/build_ios.sh
2832
$SCRIPT_DIR/run_ios.sh $ios_device
2933
$SCRIPT_DIR/../shared/setup_backend.sh $sgw_url

jenkins/pipelines/dotnet/test_mac.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
44

55
source $SCRIPT_DIR/test_common.sh
66

7-
sgw_url="$4"
87
if [ $# -lt 3 ]; then
98
usage
109
exit 1
1110
fi
1211

13-
prepare_dotnet
12+
cbl_version=$1
13+
cbl_build=$2
14+
dataset_version=$3
15+
sgw_url="$4"
16+
17+
prepare_dotnet $dataset_version
1418

15-
modify_package $2 $3
19+
modify_package $cbl_version $cbl_build
1620
$SCRIPT_DIR/build_mac.sh
1721
$SCRIPT_DIR/run_mac.sh
1822
$SCRIPT_DIR/../shared/setup_backend.sh $sgw_url

jenkins/pipelines/dotnet/test_winui.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
param (
2-
[Parameter()][string]$Edition = "enterprise",
32
[Parameter(Mandatory=$true)][string]$Version,
43
[Parameter(Mandatory=$true)][string]$Build,
4+
[Parameter(Mandatory=$true)][string]$Dataset,
55
[Parameter()][string]$SgwUrl = ""
66
)
77

88
Import-Module $PSScriptRoot/prepare_env.psm1 -Force
99
$ErrorActionPreference = "Stop"
1010

11+
Install-DotNet
12+
Install-Maui
13+
Copy-Datasets -Version $Dataset
14+
1115
$nugetPackageVersion = "$Version-b$($Build.PadLeft(4, '0'))"
1216
Write-Host "Using NuGet package version $nugetPackageVersion"
1317
& $env:LOCALAPPDATA\Microsoft\dotnet\dotnet add $PSScriptRoot\..\..\..\servers\dotnet\testserver.logic\testserver.logic.csproj package couchbase.lite.enterprise --version $nugetPackageVersion

0 commit comments

Comments
 (0)