Skip to content

Commit

Permalink
Add MDB Realm support (#2041)
Browse files Browse the repository at this point in the history
* replace sync manager with app

* Start working on MDB Realm
- Expose App
- Expose AppConfiguration
- Move stuff from User to App
- Expose the new credentials
- Move Realm_OpenWithSync to SharedRealm
- Replace Uri with partition in SyncConfig

* wire up the network transport (without error handling)

* Add AppException class
Add App.EmailPasswordAuth
Add User.Profile

* Correct content encoding for the message body

* Try to get ci running

* Fix a compilation error

* Fix compile #2

* Add docs for Credentials

* Try using sh instead of readfile

* another try

* Try with a custom app

* ..

* .

* Test fixes

* Reenable session tests

* Reenable more tests

* Reenable more tests

* Try to get some sleep

* inline the sleep

* Try to cat the app_id instead of executing it 🤦‍♂️

* 🤞

* Add port to baas url

* Preserve some serializers

* Add user.customdata

* Fix tests

* Add User.Provider

* Use unencrypted metadata realm for tests

* Lock the stringbuilder

* More attempts to compact the Realm

* some docs + warning fixes

* Add more docs

* Fix some warnings

* Rework errors + add api key creation

* Add api key tests

* fix displayed sdk and platform versions

* Add function support

* Make the error code internal

* more function tests

* Add docs for functions

* More tests

* wip

* Add docs for remote  mongo client

* Add logs link to app exceptions

* Add v10 as package publishing branch

* Build the package as 10.0.0

* Clean up some things

* Clean up some json serialization code

* Some cleanup

* preserve object serializer

* Try to fix iOS tests

* Mount /tmp on docker builds for caching purposes
  • Loading branch information
nirinchev authored Oct 4, 2020
1 parent 9d8b9bc commit adfa151
Show file tree
Hide file tree
Showing 107 changed files with 6,504 additions and 2,866 deletions.
41 changes: 28 additions & 13 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ stage('Checkout') {
userRemoteConfigs: scm.userRemoteConfigs
])

if (env.BRANCH_NAME == 'master') {
// V10TODO: temporary set v10 as publishing branch
if (shouldPublishPackage()) {
versionSuffix = "alpha-${env.BUILD_ID}"
}
else if (env.CHANGE_BRANCH == null || !env.CHANGE_BRANCH.startsWith('release')) {
Expand Down Expand Up @@ -59,9 +60,7 @@ stage('Build wrappers') {
rlmNode('docker') {
unstash 'dotnet-wrappers-source'
dir('wrappers') {
buildDockerEnv("ci/realm-dotnet:wrappers", extra_args: "-f centos.Dockerfile").inside() {
sh "REALM_CMAKE_CONFIGURATION=${configuration} ./build.sh"
}
buildWrappersInDocker('wrappers', 'centos.Dockerfile', "REALM_CMAKE_CONFIGURATION=${configuration} ./build.sh")
}
stash includes: 'wrappers/build/**', name: 'linux-wrappers'
}
Expand All @@ -74,9 +73,7 @@ stage('Build wrappers') {
rlmNode('docker') {
unstash 'dotnet-wrappers-source'
dir('wrappers') {
buildDockerEnv("ci/realm-dotnet:wrappers_android", extra_args: '-f android.Dockerfile').inside() {
sh "./build-android.sh --configuration=${configuration} --ARCH=${localAbi}"
}
buildWrappersInDocker('wrappers_android', 'android.Dockerfile', "./build-android.sh --configuration=${configuration} --ARCH=${localAbi}")
}
stash includes: 'wrappers/build/**', name: "android-wrappers-${localAbi}"
}
Expand All @@ -92,7 +89,7 @@ stage('Build wrappers') {
powershell ".\\build.ps1 Windows -Configuration ${configuration} -Platforms ${localPlatform}"
}
stash includes: 'wrappers/build/**', name: "windows-wrappers-${localPlatform}"
if (env.BRANCH_NAME == 'master') {
if (shouldPublishPackage()) {
archiveArtifacts 'wrappers/build/**/*.pdb'
}
}
Expand All @@ -108,7 +105,7 @@ stage('Build wrappers') {
powershell ".\\build.ps1 WindowsStore -Configuration ${configuration} -Platforms ${localPlatform}"
}
stash includes: 'wrappers/build/**', name: "windowsuniversal-wrappers-${localPlatform}"
if (env.BRANCH_NAME == 'master') {
if (shouldPublishPackage()) {
archiveArtifacts 'wrappers/build/**/*.pdb'
}
}
Expand Down Expand Up @@ -164,7 +161,7 @@ stage('Package') {
packageVersion = getVersion(packages[0].name);
echo "Inferred version is ${packageVersion}"

if (env.BRANCH_NAME == 'master') {
if (shouldPublishPackage()) {
withCredentials([usernamePassword(credentialsId: 'github-packages-token', usernameVariable: 'GITHUB_USERNAME', passwordVariable: 'GITHUB_PASSWORD')]) {
echo "Publishing Realm.Fody.${packageVersion} to github packages"
bat "dotnet nuget add source https://nuget.pkg.github.com/realm/index.json -n github -u ${env.GITHUB_USERNAME} -p ${env.GITHUB_PASSWORD} & exit 0"
Expand Down Expand Up @@ -329,13 +326,18 @@ def NetCoreTest(String nodeName) {
dotnet build -c ${configuration} -f netcoreapp20 -p:RestoreConfigFile=${env.WORKSPACE}/Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${packageVersion}
dotnet run -c ${configuration} -f netcoreapp20 --no-build -- --labels=After --result=${env.WORKSPACE}/TestResults.NetCore.xml
""".trim()

String appLocation = "${env.WORKSPACE}/Tests/TestApps/dotnet-integration-tests"

if (isUnix()) {
if (nodeName == 'docker') {
def test_runner_image = docker.image('mcr.microsoft.com/dotnet/core/sdk:2.1')
test_runner_image.pull()
withRos('3.23.1') { ros ->
test_runner_image.inside("--link ${ros.id}:ros") {
script += ' --ros $ROS_PORT_9080_TCP_ADDR --rosport $ROS_PORT_9080_TCP_PORT'
withRealmCloud(version: '2020-09-24', appsToImport: ["dotnet-integration-tests": appLocation]) { networkName ->
test_runner_image.inside("--network=${networkName}") {
def appId = sh script: "cat ${appLocation}/app_id", returnStdout: true

script += " --baasurl http://mongodb-realm:9090 --baasappid ${appId.trim()}"
// see https://stackoverflow.com/a/53782505
sh """
export HOME=/tmp
Expand Down Expand Up @@ -401,6 +403,19 @@ def reportTests(spec) {
)
}

def buildWrappersInDocker(String label, String image, String invocation) {
String uid = sh(script: 'id -u', returnStdout: true).trim()
String gid = sh(script: 'id -g', returnStdout: true).trim()

buildDockerEnv("ci/realm-dotnet:${label}", extra_args: "-f ${image}").inside("--mount 'type=bind,src=/tmp,dst=/tmp' -u ${uid}:${gid}") {
sh invocation
}
}

boolean shouldPublishPackage() {
return env.BRANCH_NAME == 'master' || (env.CHANGE_BRANCH != null && env.CHANGE_BRANCH == 'v10')
}

// Required due to JENKINS-27421
@NonCPS
List<List<?>> mapToList(Map map) {
Expand Down
Loading

0 comments on commit adfa151

Please sign in to comment.