Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Centralize version settings #1702

Merged
merged 3 commits into from
Mar 24, 2022
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
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,34 @@ jobs:
cp -r build/ ./bwc-test/
cd bwc-test/
./gradlew bwcTestSuite -Dtests.security.manager=false

build-artifact-names:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- id: security-plugin-version
uses: madhead/read-java-properties@66cc8c88f5c6f6069ebfb42586024dd6ffe2e451
Copy link
Member

Choose a reason for hiding this comment

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

will this long string change at any point in future leading to a breaking change?

with:
file: gradle.properties
property: security-plugin.version

- uses: actions/setup-java@v1
with:
java-version: 11

- run: ./gradlew clean assemble
- run: test -s ./build/opensearch-security-${{ steps.security-plugin-version.outputs.value }}-SNAPSHOT.jar

- run: ./gradlew clean assemble -Dbuild.snapshot=false
- run: test -s ./build/opensearch-security-${{ steps.security-plugin-version.outputs.value }}.jar

- run: ./gradlew clean assemble -Dbuild.snapshot=false -Dbuild.version_qualifier=alpha1
- run: test -s ./build/opensearch-security-${{ steps.security-plugin-version.outputs.value }}-alpha1.jar

- run: ./gradlew clean assemble -Dbuild.version_qualifier=alpha1
- run: test -s ./build/opensearch-security-${{ steps.security-plugin-version.outputs.value }}-alpha1-SNAPSHOT.jar

- name: List files in the build directory if there was an error
run: ls -al ./build/
if: failure()
18 changes: 10 additions & 8 deletions .github/workflows/plugin_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: Plugin Install

on: [push, pull_request, workflow_dispatch]

env:
OPENSEARCH_VERSION: "1.4.0"

jobs:
plugin_install:
name: Plugin Install
Expand All @@ -15,25 +12,30 @@ jobs:
jdk: [8, 11, 14]

steps:
- uses: actions/checkout@v2

- id: opensearch-version
uses: madhead/read-java-properties@66cc8c88f5c6f6069ebfb42586024dd6ffe2e451
with:
file: gradle.properties
property: opensearch-core.version

- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.jdk }}

- name: Checkout security
uses: actions/checkout@v2

- name: Build
run: ./gradlew clean assemble -Dbuild.snapshot=false

- name: Download OpenSearch Core
run: |
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{env.OPENSEARCH_VERSION}}/latest/linux/x64/builds/opensearch/dist/opensearch-min-${{env.OPENSEARCH_VERSION}}-linux-x64.tar.gz
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ steps.opensearch-version.outputs.value }}/latest/linux/x64/builds/opensearch/dist/opensearch-min-${{ steps.opensearch-version.outputs.value }}-linux-x64.tar.gz
tar -xzf opensearch-*.tar.gz
rm -f opensearch-*.tar.gz

- name: Move and rename security plugin for installation
run: mv build/distributions/opensearch-security-*.0.zip opensearch-security.zip
run: mv build/distributions/opensearch-security-*.zip opensearch-security.zip

- name: Run OpenSearch with plugin
run: |
Expand Down
16 changes: 12 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import org.gradle.crypto.checksum.Checksum

import java.text.SimpleDateFormat


repositories {
mavenLocal()
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
Expand All @@ -56,7 +55,9 @@ repositories {
}

ext {
opensearch_version = System.getProperty("opensearch.version", "1.4.0-SNAPSHOT")
default_opensearch_version = property("opensearch-core.version") + "-SNAPSHOT"
opensearch_version = System.getProperty("opensearch.version", default_opensearch_version)
buildVersionQualifier = System.getProperty("build.version_qualifier")
}

configurations.all {
Expand Down Expand Up @@ -125,12 +126,19 @@ dependencies {
}

ext {
securityPluginVersion = '2.0.0.0'
securityPluginVersion = property('security-plugin.version')
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
}

group = 'org.opensearch'
version = "${securityPluginVersion}" + (isSnapshot ? "-SNAPSHOT" : "")
version = securityPluginVersion
if (buildVersionQualifier) {
version += "-${buildVersionQualifier}"
}
if (isSnapshot) {
version += "-SNAPSHOT"
}

description = 'OpenSearch Security'


Expand Down
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sets the version of the Security plugin
security-plugin.version=2.0.0.0
# Sets the version of OpenSearch this plugin should be built with
opensearch-core.version=1.4.0