Skip to content

Commit

Permalink
Backport main changes to 1.x (opensearch-project#126)
Browse files Browse the repository at this point in the history
* Fix copyright notice and add DCO check workflow (opensearch-project#94)

Signed-off-by: Ashish Agrawal <ashisagr@amazon.com>

* Update build.sh script to include optional platform param. (opensearch-project#95)

Signed-off-by: Marc Handalian <handalm@amazon.com>

* Add codeowners support for repo (opensearch-project#96)

Signed-off-by: Ryan Bogan <10944539+ryanbogan@users.noreply.github.com>

* Bump version to 1.3 (opensearch-project#99)

Signed-off-by: Ashish Agrawal <ashisagr@amazon.com>

* Auto-increment version on new release tags. (opensearch-project#106)

Signed-off-by: Daniel Doubrovkine (dB.) <dblock@dblock.org>

* Remove jcenter repository (opensearch-project#115)

Signed-off-by: Peter Nied <peternied@hotmail.com>

* Using Github App token to trigger CI for version increment PRs (opensearch-project#116)

Signed-off-by: Vacha Shah <vachshah@amazon.com>

* Fixes copyright headers (opensearch-project#117)

Signed-off-by: Drew Baugher <46505179+dbbaughe@users.noreply.github.com>

* Remove jcenter repository missed on first pass (opensearch-project#118)

Signed-off-by: Peter Nied <petern@amazon.com>

* Run CI/CD on Java 8, 11, 14 and 17. (opensearch-project#121)

* Run CI/CD on Java 8, 11, 14 and 17.

Signed-off-by: Daniel Doubrovkine (dB.) <dblock@dblock.org>

* Add JDK 17.

Signed-off-by: Daniel Doubrovkine (dB.) <dblock@dblock.org>

* Add .whitesource configuration file (opensearch-project#109)

Co-authored-by: whitesource-for-github-com[bot] <50673670+whitesource-for-github-com[bot]@users.noreply.github.com>

Co-authored-by: Ashish Agrawal <ashisagr@amazon.com>
Co-authored-by: Marc Handalian <handalm@amazon.com>
Co-authored-by: Ryan Bogan <10944539+ryanbogan@users.noreply.github.com>
Co-authored-by: Daniel Doubrovkine (dB.) <dblock@dblock.org>
Co-authored-by: Peter Nied <peternied@hotmail.com>
Co-authored-by: Vacha Shah <vachshah@amazon.com>
Co-authored-by: Drew Baugher <46505179+dbbaughe@users.noreply.github.com>
Co-authored-by: Peter Nied <petern@amazon.com>
Co-authored-by: whitesource-for-github-com[bot] <50673670+whitesource-for-github-com[bot]@users.noreply.github.com>
Signed-off-by: AWSHurneyt <hurneyt@amazon.com>
  • Loading branch information
10 people authored and AWSHurneyt committed Feb 29, 2024
1 parent a6987af commit 1a8a885
Show file tree
Hide file tree
Showing 122 changed files with 316 additions and 2,516 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This should match the owning team set up in https://github.com/orgs/opensearch-project/teams
* @opensearch-project/common-utils
40 changes: 40 additions & 0 deletions .github/workflows/ci-17.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Test
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"

jobs:
build:

name: Build and Test (17)
runs-on: ubuntu-latest

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

- name: Setup Java 11
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 11

- name: Build
run: |
./gradlew build --build-cache
- name: Setup Java 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17

- name: Test
run: |
./gradlew test --build-cache
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ jobs:
build:
strategy:
matrix:
java: [14]
java:
- 8
- 11
- 14

name: Build and Test
runs-on: ubuntu-latest
Expand All @@ -25,14 +28,13 @@ jobs:
with:
java-version: ${{ matrix.java }}

# common-utils
- name: Build and Test
run: |
./gradlew build -Dopensearch.version=1.2.0-SNAPSHOT
./gradlew build
- name: Publish to Maven Local
run: |
./gradlew publishToMavenLocal -Dopensearch.version=1.2.0-SNAPSHOT
./gradlew publishToMavenLocal
- name: Upload Coverage Report
uses: codecov/codecov-action@v1
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/dco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Developer Certificate of Origin Check

on: [pull_request]

jobs:
check:
runs-on: ubuntu-latest

steps:
- name: Get PR Commits
id: 'get-pr-commits'
uses: tim-actions/get-pr-commits@v1.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: DCO Check
uses: tim-actions/dco@v1.1.0
with:
commits: ${{ steps.get-pr-commits.outputs.commits }}
52 changes: 52 additions & 0 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Increment Version

on:
push:
tags:
- '*.*.*.*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: GitHub App token
id: github_app_token
uses: tibdex/github-app-token@v1.5.0
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
installation_id: 22958780

- uses: actions/checkout@v2
- name: Fetch Tag and Version Information
run: |
TAG=$(echo "${GITHUB_REF#refs/*/}")
CURRENT_VERSION_ARRAY=($(echo "$TAG" | tr . '\n'))
BASE=$(IFS=. ; echo "${CURRENT_VERSION_ARRAY[*]:0:2}")
CURRENT_VERSION=$(IFS=. ; echo "${CURRENT_VERSION_ARRAY[*]:0:3}")
CURRENT_VERSION_ARRAY[2]=$((CURRENT_VERSION_ARRAY[2]+1))
NEXT_VERSION=$(IFS=. ; echo "${CURRENT_VERSION_ARRAY[*]:0:3}")
echo "TAG=$TAG" >> $GITHUB_ENV
echo "BASE=$BASE" >> $GITHUB_ENV
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
ref: ${{ env.BASE }}
token: ${{ steps.github_app_token.outputs.token }}

- name: Increment Version
run: |
echo Incrementing $CURRENT_VERSION to $NEXT_VERSION
sed -i "s/$CURRENT_VERSION-SNAPSHOT/$NEXT_VERSION-SNAPSHOT/g" build.gradle
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ steps.github_app_token.outputs.token }}
base: ${{ env.BASE }}
commit-message: Incremented version to ${{ env.NEXT_VERSION }}
delete-branch: true
title: '[AUTO] Incremented version to ${{ env.NEXT_VERSION }}.'
body: |
I've noticed that a new tag ${{ env.TAG }} was pushed, and incremented the version from ${{ env.CURRENT_VERSION }} to ${{ env.NEXT_VERSION }}.
15 changes: 15 additions & 0 deletions .whitesource
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"scanSettings": {
"configMode": "AUTO",
"configExternalURL": "",
"projectToken": "",
"baseBranches": []
},
"checkRunSettings": {
"vulnerableCheckRunConclusionLevel": "failure",
"displayMode": "diff"
},
"issueSettings": {
"minSeverityLevel": "LOW"
}
}
49 changes: 48 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,51 @@
## Contributing to this Project

OpenSearch is a community project that is built and maintained by people just like **you**.
[This document](https://github.com/opensearch-project/.github/blob/main/CONTRIBUTING.md) explains how you can contribute to this and related projects.
[This document](https://github.com/opensearch-project/.github/blob/main/CONTRIBUTING.md) explains how you can contribute to this and related projects.

## Developer Certificate of Origin

OpenSearch is an open source product released under the Apache 2.0 license (see either [the Apache site](https://www.apache.org/licenses/LICENSE-2.0) or the [LICENSE.txt file](LICENSE.txt)). The Apache 2.0 license allows you to freely use, modify, distribute, and sell your own products that include Apache 2.0 licensed software.

We respect intellectual property rights of others and we want to make sure all incoming contributions are correctly attributed and licensed. A Developer Certificate of Origin (DCO) is a lightweight mechanism to do that.

The DCO is a declaration attached to every contribution made by every developer. In the commit message of the contribution, the developer simply adds a `Signed-off-by` statement and thereby agrees to the DCO, which you can find below or at [DeveloperCertificate.org](http://developercertificate.org/).

```
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the
best of my knowledge, is covered under an appropriate open
source license and I have the right under that license to
submit that work with modifications, whether created in whole
or in part by me, under the same open source license (unless
I am permitted to submit under a different license), as
Indicated in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including
all personal information I submit with it, including my
sign-off) is maintained indefinitely and may be redistributed
consistent with this project or the open source license(s)
involved.
```

We require that every contribution to OpenSearch is signed with a Developer Certificate of Origin. Additionally, please use your real name. We do not accept anonymous contributors nor those utilizing pseudonyms.

Each commit must include a DCO which looks like this

```
Signed-off-by: Jane Smith <jane.smith@email.com>
```

You may type this line on your own when writing your commit messages. However, if your user.name and user.email are set in your git configs, you can use `-s` or `– – signoff` to add the `Signed-off-by` line to the end of the commit message.
6 changes: 3 additions & 3 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- [Developer Guide](#developer-guide)
- [Forking and Cloning](#forking-and-cloning)
- [Install Prerequisites](#install-prerequisites)
- [JDK 14](#jdk-14)
- [JDK 11](#jdk-11)
- [Building](#building)
- [Using IntelliJ IDEA](#using-intellij-idea)
- [Submitting Changes](#submitting-changes)
Expand All @@ -16,9 +16,9 @@ Fork this repository on GitHub, and clone locally with `git clone`.

### Install Prerequisites

#### JDK 14
#### JDK 11

OpenSearch components build using Java 14 at a minimum. This means you must have a JDK 14 installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK 14 installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-14`.
OpenSearch components build using Java 11 at a minimum. This means you must have a JDK 11 installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK 11 installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-11`.

### Building

Expand Down
4 changes: 2 additions & 2 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
OpenSearch
Copyright 2021 OpenSearch Contributors
OpenSearch (https://opensearch.org/)
Copyright OpenSearch Contributors

This product includes software developed by
Elasticsearch (http://www.elastic.co).
Expand Down
12 changes: 2 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

buildscript {
ext {
opensearch_group = "org.opensearch"
opensearch_version = System.getProperty("opensearch.version", "1.2.0-SNAPSHOT")
opensearch_version = System.getProperty("opensearch.version", "1.3.0-SNAPSHOT")
kotlin_version = System.getProperty("kotlin.version", "1.4.32")
}

repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
}

Expand All @@ -42,7 +35,6 @@ repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
}

Expand Down
8 changes: 1 addition & 7 deletions detekt.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
---
#
# Copyright OpenSearch Contributors
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#

style:
ForbiddenComment:
Expand Down
6 changes: 5 additions & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ function usage() {
echo "Arguments:"
echo -e "-v VERSION\t[Required] OpenSearch version."
echo -e "-s SNAPSHOT\t[Optional] Build a snapshot, default is 'false'."
echo -e "-p PLATFORM\t[Optional] Platform, ignored."
echo -e "-a ARCHITECTURE\t[Optional] Build architecture, ignored."
echo -e "-o OUTPUT\t[Optional] Output path, default is 'artifacts'."
echo -e "-h help"
}

while getopts ":h:v:s:o:a:" arg; do
while getopts ":h:v:s:o:p:a:" arg; do
case $arg in
h)
usage
Expand All @@ -31,6 +32,9 @@ while getopts ":h:v:s:o:a:" arg; do
o)
OUTPUT=$OPTARG
;;
p)
PLATFORM=$OPTARG
;;
a)
ARCHITECTURE=$OPTARG
;;
Expand Down
8 changes: 1 addition & 7 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

rootProject.name = 'common-utils'
23 changes: 1 addition & 22 deletions spotless.license.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

/*
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

23 changes: 1 addition & 22 deletions src/main/java/org/opensearch/commons/ConfigConstants.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

/*
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

package org.opensearch.commons;
Expand Down
Loading

0 comments on commit 1a8a885

Please sign in to comment.