Skip to content

Commit c8db4eb

Browse files
committed
Fix Jenkins PR Validation
* iOS : - Fixed and simplify script to download the right CBL and VS binary. * C : - Applied the same method as iOS get the lastest CBL version. - Removed obsolete logging code snippet as the API has been changed in 4.0 * Android: - Updated AGP from 8.0.2 to 8.13.2 to fix JDK 21 incompatibility issue. - Update Android script to get CBL and VS version based on isReleased flag.
1 parent 1b022bb commit c8db4eb

File tree

8 files changed

+99
-74
lines changed

8 files changed

+99
-74
lines changed

jenkins/android_build.sh

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,35 @@ fi
7070
CBL_URL="http://proget.build.couchbase.com:8080/api/get_version?product=couchbase-lite-android&version=${CBL_VERSION}"
7171
VS_URL="http://proget.build.couchbase.com:8080/api/get_version?product=couchbase-lite-android-vector-search&version=${VS_VERSION}"
7272

73-
CBL_BUILD=$(curl -s $CBL_URL | $JQ -r '.BuildNumber')
74-
VS_BUILD=$(curl -s $VS_URL | $JQ -r '.BuildNumber')
73+
CBL_RESPONSE=$(curl -s $CBL_URL)
74+
CBL_IS_RELEASE=$(echo -n "$CBL_RESPONSE" | $JQ -r '.IsRelease')
75+
CBL_BUILD=$(echo -n "$CBL_RESPONSE" | $JQ -r '.BuildNumber')
76+
77+
if [ "${CBL_BUILD}" == "" ] || [ "${CBL_BUILD}" == "null" ]; then
78+
echo "No latest successful build found for CBL v${CBL_VERSION}"
79+
exit 3
80+
fi
81+
82+
VS_RESPONSE=$(curl -s $VS_URL)
83+
VS_IS_RELEASE=$(echo -n "$VS_RESPONSE" | $JQ -r '.IsRelease')
84+
VS_BUILD=$(echo -n "$VS_RESPONSE" | $JQ -r '.BuildNumber')
85+
86+
if [ "${VS_BUILD}" == "" ] || [ "${VS_BUILD}" == "null" ]; then
87+
echo "No latest successful build found for VS v${VS_VERSION}"
88+
exit 3
89+
fi
90+
91+
if [ "${CBL_IS_RELEASE}" == "true" ]; then
92+
CBL_VERSION_ARG="${CBL_VERSION}"
93+
else
94+
CBL_VERSION_ARG="${CBL_VERSION}-${CBL_BUILD}"
95+
fi
96+
97+
if [ "${VS_IS_RELEASE}" == "true" ]; then
98+
VS_VERSION_ARG="${VS_VERSION}"
99+
else
100+
VS_VERSION_ARG="${VS_VERSION}-${VS_BUILD}"
101+
fi
75102

76103
pushd $ANDROID_DIR/examples/
77-
./gradlew assembleDebug -PcblVersion=$CBL_VERSION-$CBL_BUILD -PextVersion=$VS_VERSION-$VS_BUILD
104+
./gradlew assembleDebug -PcblVersion=${CBL_VERSION_ARG} -PextVersion=${VS_VERSION_ARG}

jenkins/c_build.sh

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,41 @@
22

33
if [[ "$#" -ne 1 ]]; then
44
echo "This script requires a version argument"
5+
exit 1
56
fi
67

7-
THIS_DIR=$( dirname -- $(realpath "$0"); )
8-
version="$1"
8+
THIS_DIR=$( dirname -- $(realpath "$0") )
9+
CBL_VERSION="$1"
910
pushd "$THIS_DIR/../modules/c/examples/code_snippets"
1011

11-
build_num=$(curl -s http://dbapi.build.couchbase.com:8000/v1/products/couchbase-lite-c/releases/$version/versions/$version/builds?filter=last_complete | jq .build_num | bc)
12+
RESPONSE=$(curl -s "http://proget.build.couchbase.com:8080/api/get_version?product=couchbase-lite-c&version=${CBL_VERSION}")
13+
CBL_IS_RELEASE=$(echo -n "$RESPONSE" | jq .IsRelease)
14+
CBL_BUILD_NO=$(echo -n "$RESPONSE" | jq .BuildNumber)
15+
16+
if [ "${CBL_BUILD_NO}" == "" ] || [ "${CBL_BUILD_NO}" == "null" ]; then
17+
echo "No latest successful build found for CBL v${CBL_VERSION}"
18+
exit 3
19+
fi
20+
21+
if [ "${CBL_IS_RELEASE}" == "true" ]; then
22+
PACKAGE_NAME="couchbase-lite-c-enterprise-${CBL_VERSION}-linux-x86_64.tar.gz"
23+
DOWNLOAD_URL="https://latestbuilds.service.couchbase.com/builds/releases/mobile/couchbase-lite-c/${CBL_VERSION}/${PACKAGE_NAME}"
24+
else
25+
PACKAGE_NAME="couchbase-lite-c-enterprise-${CBL_VERSION}-${CBL_BUILD_NO}-linux-x86_64.tar.gz"
26+
DOWNLOAD_URL="https://latestbuilds.service.couchbase.com/builds/latestbuilds/couchbase-lite-c/${CBL_VERSION}/${CBL_BUILD_NO}/${PACKAGE_NAME}"
27+
fi
28+
29+
rm -rf downloaded
1230
mkdir -p downloaded
1331

1432
pushd downloaded
1533
DOWNLOAD_DIR=$(pwd)
16-
wget http://latestbuilds.service.couchbase.com/builds/latestbuilds/couchbase-lite-c/$version/$build_num/couchbase-lite-c-enterprise-$version-$build_num-linux-x86_64.tar.gz
17-
tar xf couchbase-lite-c-enterprise-$version-$build_num-linux-x86_64.tar.gz
18-
rm couchbase-lite-c-enterprise-$version-$build_num-linux-x86_64.tar.gz
34+
wget "${DOWNLOAD_URL}"
35+
tar xf "${PACKAGE_NAME}"
36+
rm "${PACKAGE_NAME}"
1937
popd
2038

2139
mkdir -p build
2240
pushd build
23-
cmake -DCMAKE_PREFIX_PATH="$DOWNLOAD_DIR/libcblite-$version" ..
41+
cmake -DCMAKE_PREFIX_PATH="$DOWNLOAD_DIR/libcblite-${CBL_VERSION}" ..
2442
make -j12

jenkins/ios.sh

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,72 +3,74 @@
33
CBL_VERSION=$1
44
VS_VERSION=$2
55

6-
dir=$( dirname -- $(realpath "$0"); )
7-
8-
# Get latest good CBL iOS EE build for given version
9-
CBL_URL="http://proget.build.couchbase.com:8080/api/open_latestbuilds?product=couchbase-lite-ios&version=${cbl_version}"
6+
if [ -z "${CBL_VERSION}" ] || [ -z "${VS_VERSION}" ]; then
7+
echo "Usage: $0 <CBL_VERSION> <VS_VERSION>"
8+
exit 1
9+
fi
1010

11-
# Grab the redirect url
12-
CBL_SOURCE_URL=$(curl -s -L -o /dev/null -w '%{url_effective}' "${CBL_URL}")
11+
dir=$( dirname -- $(realpath "$0") )
1312

1413
CBL="http://proget.build.couchbase.com:8080/api/get_version?product=couchbase-lite-ios&version=${CBL_VERSION}"
1514
RESPONSE=$(curl -s $CBL)
16-
CBL_IS_RELEASE=$(echo -n $RESPONSE | jq .IsRelease)
17-
CBL_BUILD_NO=$(echo -n $RESPONSE | jq .BuildNumber)
15+
CBL_IS_RELEASE=$(echo -n "$RESPONSE" | jq .IsRelease)
16+
CBL_BUILD_NO=$(echo -n "$RESPONSE" | jq .BuildNumber)
1817

19-
if [ "${CBL_BUILD_NO}" == "" ]
18+
if [ "${CBL_BUILD_NO}" == "" ] || [ "${CBL_BUILD_NO}" == "null" ]
2019
then
2120
echo "No latest successful build found for CBL v${CBL_VERSION}"
2221
exit 3
2322
fi
2423

2524
VS="http://proget.build.couchbase.com:8080/api/get_version?product=couchbase-lite-ios-vector-search&version=${VS_VERSION}&ee=true"
2625
RESPONSE=$(curl -s $VS)
27-
VS_BUILD_NO=$(echo -n $RESPONSE | jq .BuildNumber)
26+
VS_IS_RELEASE=$(echo -n "$RESPONSE" | jq .IsRelease)
27+
VS_BUILD_NO=$(echo -n "$RESPONSE" | jq .BuildNumber)
2828

29-
if [ "${VS_BUILD_NO}" == "" ]
29+
if [ "${VS_BUILD_NO}" == "" ] || [ "${VS_BUILD_NO}" == "null" ]
3030
then
3131
echo "No latest successful build found for VS v${VS_VERSION}"
3232
exit 3
3333
fi
3434

35+
# Download VS extension once (platform-independent)
36+
if [ "${VS_IS_RELEASE}" == "true" ]; then
37+
VS_PACKAGE_NAME="couchbase-lite-vector-search-${VS_VERSION}-apple.zip"
38+
VS_URL="https://latestbuilds.service.couchbase.com/builds/releases/mobile/couchbase-lite-vector-search/${VS_VERSION}/${VS_PACKAGE_NAME}"
39+
else
40+
VS_PACKAGE_NAME="couchbase-lite-vector-search-${VS_VERSION}-${VS_BUILD_NO}-apple.zip"
41+
VS_URL="https://latestbuilds.service.couchbase.com/builds/latestbuilds/couchbase-lite-vector-search/${VS_VERSION}/${VS_BUILD_NO}/${VS_PACKAGE_NAME}"
42+
fi
43+
44+
VS_DOWNLOAD_DIR="${dir}/../vs_downloaded"
45+
rm -rf "${VS_DOWNLOAD_DIR}"
46+
mkdir -p "${VS_DOWNLOAD_DIR}"
47+
wget -P "${VS_DOWNLOAD_DIR}" "${VS_URL}"
48+
3549
for PLATFORM in "objc" "swift"
3650
do
3751
echo $PLATFORM
3852
pushd "${dir}/../modules/${PLATFORM}/examples"
3953

4054
# In case script fails mid-way, cleanup on start
41-
if [ -d "downloaded" ]; then
42-
rm -rf "downloaded"
43-
fi
55+
rm -rf "downloaded"
4456
mkdir -p downloaded
4557

4658
pushd downloaded
47-
# Get CBL
48-
CBL_SOURCE_URL=$(curl -s -L -o /dev/null -w '%{url_effective}' "http://proget.build.couchbase.com:8080/api/open_latestbuilds?product=couchbase-lite-ios&version=${CBL_VERSION}")
4959

50-
if [ $CBL_IS_RELEASE == true ]; then
60+
# Get CBL
61+
if [ "${CBL_IS_RELEASE}" == "true" ]; then
5162
CBL_PACKAGE_NAME="couchbase-lite-${PLATFORM}_xc_enterprise_${CBL_VERSION}.zip"
63+
CBL_URL="https://latestbuilds.service.couchbase.com/builds/releases/mobile/couchbase-lite-ios/${CBL_VERSION}/${CBL_PACKAGE_NAME}"
5264
else
5365
CBL_PACKAGE_NAME="couchbase-lite-${PLATFORM}_xc_enterprise_${CBL_VERSION}-${CBL_BUILD_NO}.zip"
66+
CBL_URL="https://latestbuilds.service.couchbase.com/builds/latestbuilds/couchbase-lite-ios/${CBL_VERSION}/${CBL_BUILD_NO}/${CBL_PACKAGE_NAME}"
5467
fi
5568

56-
wget "$CBL_SOURCE_URL$CBL_PACKAGE_NAME"
57-
unzip -o $CBL_PACKAGE_NAME -d "../Frameworks/"
69+
wget "${CBL_URL}"
70+
unzip -o "${CBL_PACKAGE_NAME}" -d "../Frameworks/"
5871

5972
# Get VS extension
60-
VS_SOURCE_URL=$(curl -s -L -o /dev/null -w '%{url_effective}' "http://proget.build.couchbase.com:8080/api/open_latestbuilds?product=couchbase-lite-ios-vector-search&version=${VS_VERSION}")
61-
echo $VS_SOURCE_URL
62-
VS_PACKAGE_NAME="couchbase-lite-vector-search-${VS_VERSION}-${VS_BUILD_NO}-apple.zip"
63-
wget "$VS_SOURCE_URL$VS_PACKAGE_NAME"
64-
unzip -o $VS_PACKAGE_NAME -d "../Frameworks/"
65-
66-
# Check if download was successful
67-
if [ $? -eq 0 ]; then
68-
echo "Package downloaded successfully."
69-
else
70-
echo "Failed to download the package."
71-
fi
73+
unzip -o "${VS_DOWNLOAD_DIR}/${VS_PACKAGE_NAME}" -d "../Frameworks/"
7274

7375
popd
7476

@@ -79,3 +81,5 @@ do
7981
popd
8082

8183
done
84+
85+
rm -rf "${VS_DOWNLOAD_DIR}"

modules/android/examples/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
}
77
dependencies {
88
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20"
9-
classpath 'com.android.tools.build:gradle:8.0.2'
9+
classpath 'com.android.tools.build:gradle:8.13.2'
1010
}
1111
}
1212

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

modules/android/examples/java_snippets/app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ android {
3333
targetCompatibility JavaVersion.VERSION_11
3434
}
3535

36-
lintOptions {
37-
disable 'UseSparseArrays'
38-
abortOnError false
39-
}
4036

4137
sourceSets {
4238
main {
@@ -46,6 +42,10 @@ android {
4642
]
4743
}
4844
}
45+
lint {
46+
abortOnError false
47+
disable 'UseSparseArrays'
48+
}
4949
}
5050

5151
repositories {

modules/c/examples/code_snippets/main.cpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,10 +1688,6 @@ static void start_replication() {
16881688
}
16891689

16901690
static void console_log_sink() {
1691-
// tag::console-logging[]
1692-
CBLLog_SetConsoleLevel(kCBLLogVerbose);
1693-
// end::console-logging[]
1694-
16951691
// tag::new-console-logging[]
16961692
CBLConsoleLogSink logSink {};
16971693
logSink.level = kCBLLogVerbose;
@@ -1701,23 +1697,6 @@ static void console_log_sink() {
17011697
}
17021698

17031699
static void file_log_sink() {
1704-
// tag::file-logging[]
1705-
// NOTE: No error handling, for brevity (see getting started)
1706-
1707-
// NOTE: You will need to use a platform appropriate method for finding
1708-
// a temporary directory
1709-
1710-
CBLLogFileConfiguration config {}; // Don't bother zeroing, since we set all properties
1711-
config.level = kCBLLogInfo;
1712-
config.directory = FLSTR("/tmp/logs");;
1713-
config.maxRotateCount = 12;
1714-
config.maxSize = 1048576;
1715-
config.usePlaintext = false;
1716-
1717-
CBLError err{};
1718-
CBLLog_SetFileConfig(config, &err);
1719-
// end::file-logging[]
1720-
17211700
// tag::new-file-logging[]
17221701
CBLFileLogSink logSink {};
17231702
logSink.level = kCBLLogVerbose;
@@ -1742,10 +1721,6 @@ static void custom_log_sink_callback(CBLLogDomain domain, CBLLogLevel level, FLS
17421721
// end::new-custom-logging[]
17431722

17441723
static void enable_custom_log_sink() {
1745-
// tag::set-custom-logging[]
1746-
CBLLog_SetCallback(custom_log_callback);
1747-
// end::set-custom-logging[]
1748-
17491724
// tag::set-new-custom-logging[]
17501725
CBLCustomLogSink logSink {};
17511726
logSink.level = kCBLLogVerbose;

modules/objc/examples/code_snippets/SampleCodeTest.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,11 +683,12 @@ - (void) dontTestCollectionOperatorIn {
683683
[CBLQueryExpression property:@"last"],
684684
[CBLQueryExpression property:@"username"]];
685685

686-
[CBLQueryBuilder select:@[[CBLQuerySelectResult all]]
686+
CBLQuery *query = [CBLQueryBuilder select:@[[CBLQuerySelectResult all]]
687687
from:[CBLQueryDataSource collection:self.collection]
688688
where:[[CBLQueryExpression string:@"Armani"] in:values]];
689-
NSLog(@"%@", query);
690689
// end::query-collection-operator-in[]
690+
691+
NSLog(@"%@", query);
691692
}
692693

693694
- (void) dontTestLikeOperator {

0 commit comments

Comments
 (0)