Skip to content
This repository has been archived by the owner on Oct 7, 2022. It is now read-only.

Fix snapshot build and depend on OpenSearch 1.1. #62

Merged
merged 1 commit into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Move Notebooks to Plugins Dir
run: mv dashboards-notebooks OpenSearch-Dashboards/plugins/dashboards-notebooks

- name: OpenSearch Dashboards Pluign Bootstrap
- name: OpenSearch Dashboards Plugin Bootstrap
run: |
cd OpenSearch-Dashboards/plugins/dashboards-notebooks
yarn osd bootstrap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: Test and Build OpenSearch Notebooks Backend Plugin
on: [push, pull_request]

env:
OPENSEARCH_VERSION: '1.0'
COMMON_UTILS_VERSION: '1.0'
OPENSEARCH_PLUGIN_VERSION: 1.0.0.0
OPENSEARCH_VERSION: '1.1.0-SNAPSHOT'
OPENSEARCH_BRANCH: '1.x'
COMMON_UTILS_BRANCH: 'main'

jobs:
build:
Expand All @@ -25,26 +25,26 @@ jobs:
with:
repository: 'opensearch-project/OpenSearch'
path: OpenSearch
ref: ${{ env.OPENSEARCH_VERSION }}
ref: ${{ env.OPENSEARCH_BRANCH }}
- name: Build OpenSearch
working-directory: ./OpenSearch
run: ./gradlew publishToMavenLocal -Dbuild.snapshot=false
run: ./gradlew publishToMavenLocal

# dependencies: common-utils
- name: Checkout common-utils
uses: actions/checkout@v2
with:
ref: ${{ env.COMMON_UTILS_VERSION }}
repository: 'opensearch-project/common-utils'
path: common-utils
ref: ${{ env.COMMON_UTILS_BRANCH }}
- name: Build common-utils
working-directory: ./common-utils
run: ./gradlew publishToMavenLocal -Dopensearch.version=1.0.0
run: ./gradlew publishToMavenLocal -Dopensearch.version=${{ env.OPENSEARCH_VERSION }}

- name: Build with Gradle
run: |
cd opensearch-notebooks
./gradlew build -Dopensearch.version=1.0.0
./gradlew build -Dopensearch.version=${{ env.OPENSEARCH_VERSION }}

- name: Create Artifact Path
run: |
Expand Down
18 changes: 10 additions & 8 deletions opensearch-notebooks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ import java.util.concurrent.Callable

buildscript {
ext {
opensearch_version = System.getProperty("opensearch.version", "1.0.0")
opensearch_version = System.getProperty("opensearch.version", "1.1.0-SNAPSHOT")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 1.1.0-SNAPSHOT as a default seems like something that would fall out of date very easily. Could we simply error out if opensearch.version isn't set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could. But we do this in so many plugins, so I'd prefer to do this as a separate issue/PR, and standardize across the set.

// 1.0.0 -> 1.0.0.0, and 1.0.0-SNAPSHOT -> 1.0.0.0-SNAPSHOT
opensearch_build = opensearch_version.replaceAll(/(\.\d)([^\d]*)$/, '$1.0$2')
Comment on lines +33 to +34
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we want to implicitly morph the incoming version with an extra .0 ?

Copy link
Member Author

@dblock dblock Aug 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For historical reasons OpenSearch is a 3-digit version, so you start with 1.1.0 or 1.1.0-SNAPSHOT, but common utils and plugins are 4-digit, so 1.1.0.0 and 1.1.0.0-SNAPSHOT. We have opensearch-project/OpenSearch#1093 open to stop doing that.

Copy link
Member Author

@dblock dblock Aug 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a clever(er) way of doing opensearch_version - '-SNAPSHOT' + '.0' + ('-SNAPSHOT' if opensearch_version.contains('-SNAPSHOT') else '').

common_utils_version = System.getProperty("common_utils.version", opensearch_build)
kotlin_version = System.getProperty("kotlin.version", "1.4.0")
}

Expand Down Expand Up @@ -112,14 +115,9 @@ ext {
projectSubstitutions = [:]
licenseFile = rootProject.file('LICENSE.txt')
noticeFile = rootProject.file('NOTICE.txt')
opensearchVersion = "${version}"
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
}

if (isSnapshot) {
version += "-SNAPSHOT"
}

plugins.withId('java') {
sourceCompatibility = targetCompatibility = "1.8"
}
Expand All @@ -130,7 +128,11 @@ plugins.withId('org.jetbrains.kotlin.jvm') {

allprojects {
group = "org.opensearch"
version = "${opensearchVersion}.0"

version = "${opensearch_version}" - "-SNAPSHOT" + ".0"
if (isSnapshot) {
version += "-SNAPSHOT"
}

plugins.withId('java') {
sourceCompatibility = targetCompatibility = "1.8"
Expand All @@ -142,7 +144,7 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
compile "org.jetbrains.kotlin:kotlin-stdlib-common:${kotlin_version}"
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9"
compile "${group}:common-utils:${version}"
compile "${group}:common-utils:${common_utils_version}"
compile group: 'com.google.guava', name: 'guava', version: '15.0'
testImplementation(
'org.assertj:assertj-core:3.16.1',
Expand Down
27 changes: 0 additions & 27 deletions opensearch-notebooks/gradle.properties

This file was deleted.