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

Added cookbook to increment versions across all plugins. #119

Merged
merged 10 commits into from
Jan 5, 2022
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
/k-nn/
/notifications/
/performance-analyzer/
/performance-analyzer-rca/
/security-dashboards-plugin/
/security/
/sql/
Expand Down
1 change: 1 addition & 0 deletions .meta
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"k-nn": "git@github.com:opensearch-project/k-nn.git",
"notifications": "git@github.com:opensearch-project/notifications.git",
"performance-analyzer": "git@github.com:opensearch-project/performance-analyzer.git",
"performance-analyzer-rca": "git@github.com:opensearch-project/performance-analyzer-rca.git",
"security-dashboards-plugin": "git@github.com:opensearch-project/security-dashboards-plugin",
"security": "git@github.com:opensearch-project/security.git",
"sql": "git@github.com:opensearch-project/sql.git",
Expand Down
158 changes: 158 additions & 0 deletions META.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
- [Create or Update Labels in All Plugin Repos](#create-or-update-labels-in-all-plugin-repos)
- [Create an Issue in All Plugin Repos](#create-an-issue-in-all-plugin-repos)
- [Open a Pull Request in Each Repo](#open-a-pull-request-in-each-repo)
- [Increment a Version in Every Plugin](#increment-a-version-in-every-plugin)
- [Increment Version in OpenSearch](#increment-version-in-opensearch)
- [Create a 1.2.3 Manifest](#create-a-123-manifest)
- [Increment Version in Plugins](#increment-version-in-plugins)
- [Commit and Push Changes](#commit-and-push-changes)
- [Create Pull Requests](#create-pull-requests)
- [common-utils and job-scheduler](#common-utils-and-job-scheduler)
- [alerting](#alerting)
- [min-SNAPSHOT](#min-snapshot)
- [Remaining Plugins](#remaining-plugins)
- [Update job-scheduler Snapshots](#update-job-scheduler-snapshots)
- [Update the Manifest](#update-the-manifest)

## Managing OpenSearch Plugins

Expand Down Expand Up @@ -96,3 +108,149 @@ meta exec "git commit -s -m 'Removed integtest.sh.'"
meta exec "git push username remove-integtest-sh"
meta exec "gh pr create --title 'Removing default integtest.sh.' --body='Coming from https://github.com/opensearch-project/opensearch-build/issues/497, removing default integtest.sh.'"
```

### Increment a Version in Every Plugin

Because one cannot install an older version of a plugin on a newer version of OpenSearch (see [OpenSearch#1707](https://github.com/opensearch-project/OpenSearch/issues/1707)), it's common to have to increment versions in all plugins, without making other changes. This was the case in [the 1.2.3 release](https://github.com/opensearch-project/opensearch-build/issues/1365).

See also [opensearch-build#1375](https://github.com/opensearch-project/opensearch-build/issues/1375) which aims to supersede this labor-intensive process with plugins auto-incrementing versions for the next development iteration.

#### Increment Version in OpenSearch

The auto-increment workflow in [OpenSearch#1816](https://github.com/opensearch-project/OpenSearch/pull/1816) will increment the version in OpenSearch patch branch, e.g. 1.2, [OpenSearch#1758](https://github.com/opensearch-project/OpenSearch/pull/1758), and backport the version increment change in OpenSearch to `1.x` ([OpenSearch#1759](https://github.com/opensearch-project/OpenSearch/pull/1759)) and `main` ([OpenSearch#1760](https://github.com/opensearch-project/OpenSearch/pull/1760)).

#### Create a 1.2.3 Manifest

A workflow will create a new manifest that only contains OpenSearch, e.g. [opensearch-build#1369](https://github.com/opensearch-project/opensearch-build/pull/1369). After this manifest is merged, wait for a successful SNAPSHOT build.

#### Prepare for Increments

In the examples below we are incrementing 1.2.2 to 1.2.3.

```
export INCREMENT_BASE=1.2
export INCREMENT_FROM=1.2.2
export INCREMENT_TO=1.2.3
```

#### Increment Version in Plugins

Check out and update the 1.2 branch.

```
meta git update
meta git pull origin
meta git checkout $INCREMENT_BASE
meta git pull origin $INCREMENT_BASE
```

Replace known versions.

```
find . -name build.gradle -print0 | xargs -0 sed -i "s/$INCREMENT_FROM-SNAPSHOT/$INCREMENT_TO-SNAPSHOT/g"
find . -wholename "*/.github/workflows/*.yml" -print0 | xargs -0 sed -i "s/$INCREMENT_FROM-SNAPSHOT/$INCREMENT_TO-SNAPSHOT/g"
find . -wholename "*/.github/workflows/*.yml" -print0 | xargs -0 sed -i "s/$INCREMENT_FROM.0-SNAPSHOT/$INCREMENT_TO.0-SNAPSHOT/g"
```

Plugins such as k-nn and security need some exact version replacements.

```
find . -name build.gradle -print0 | xargs -0 sed -i "s/$INCREMENT_FROM/$INCREMENT_TO/g"
find . -name CMakeLists.txt -print0 | xargs -0 sed -i "s/$INCREMENT_FROM.0/$INCREMENT_TO.0/g"
find . -name pom.xml -print0 | xargs -0 sed -i "s/$INCREMENT_FROM/$INCREMENT_TO/g"
find . -name plugin-descriptor.properties -print0 | xargs -0 sed -i "s/$INCREMENT_FROM/$INCREMENT_TO/g"
```

The cross-cluster-replication plugin needs an update in `SecurityAdminWrapper.sh`.

```
find . -name SecurityAdminWrapper.sh -print0 | xargs -0 sed -i "s/$INCREMENT_FROM/$INCREMENT_TO/g"
```

#### Commit and Push Changes

```
meta git checkout -b increment-to-$INCREMENT_TO
meta git add .
meta git commit -s -m "Incremented version to $INCREMENT_TO."
```

Create a remote for your own forks of the plugins. Replace `<your-github-username>`.

```
meta exec "gh repo fork --remote --remote-name <your-github-username>"
```

Ensure that a remote exists for your fork for every repo.

```
meta exec "git remote get-url origin | sed s/opensearch-project/<your-github-username>/g | xargs git remote add <your-github-username>"
```

Push the changes to your fork.

```
meta exec "git push <your-github-username> increment-to-$INCREMENT_TO"
```

#### Create Pull Requests

##### common-utils

An auto-increment workflow (see [common-utils#106](https://github.com/opensearch-project/common-utils/pull/106)) will auto-increment the version, e.g. [common-utils#105](https://github.com/opensearch-project/common-utils/pull/105).

##### job-scheduler

Make a pull request incrementing the version into `job-scheduler` that depends on `OpenSearch`, e.g. [job-scheduler#110](https://github.com/opensearch-project/job-scheduler/pull/110).

```
cd job-scheduler
gh pr create --title "Incremented version to $INCREMENT_TO." --body "Coming from https://github.com/opensearch-project/opensearch-build/issues/1365." --base $INCREMENT_BASE --label v$INCREMENT_TO'
```

Add `common-utils` and `job-scheduler` to the 1.2.3 manifest, e.g. [opensearch-build#1374](https://github.com/opensearch-project/opensearch-build/pull/1374) and [opensearch-build#1376](https://github.com/opensearch-project/opensearch-build/pull/1376) (you can combine both as `job-scheduler` doesn't depend on `common-utils`), and wait for a successful SNAPSHOT build.

##### min-SNAPSHOT

Check that a snapshot build has been published, e.g. [opensearch-min-1.2.3-SNAPSHOT-linux-x64-latest.tar.gz](https://artifacts.opensearch.org/snapshots/core/opensearch/1.2.3/opensearch-min-1.2.3-linux-x64-latest.tar.gz), which is required by most plugins' backwards compatibility tests. See [opensearch-build#1261](https://github.com/opensearch-project/opensearch-build/issues/1261) for automating this.

##### alerting

Make a pull request incrementing the version into `alerting`, which contains `notifications` that `index-management` depends on, e.g. [alerting#261](https://github.com/opensearch-project/alerting/pull/261). Add that plugin to the manifest and wait for a successful SNAPSHOT build, e.g. [opensearch-build#1379](https://github.com/opensearch-project/opensearch-build/pull/1379).

##### Remaining Plugins

Create pull requests referencing the [parent release issue in opensearch-build](https://github.com/opensearch-project/opensearch-build/issues/1365). You will be prompted for where to push code, choose your fork.

```
meta exec 'gh pr create --title "Incremented version to $INCREMENT_TO." --body "Coming from https://github.com/opensearch-project/opensearch-build/issues/1365." --base $INCREMENT_BASE --label v$INCREMENT_TO'
```

##### Update job-scheduler Snapshots

In addition to the above changes, build and replace the job-scheduler SNAPSHOT jar in `anomaly-detection`, `dashboards-reports`, and `index-management`.

```
cd job-scheduler
git checkout $INCREMENT_BASE
git pull
./gradlew assemble

rm ../anomaly-detection/src/test/resources/job-scheduler/*
cp ./build/distributions/opensearch-job-scheduler-$INCREMENT_TO.0-SNAPSHOT.zip ../anomaly-detection/src/test/resources/job-scheduler/
rm -rf ../anomaly-detection/src/test/resources/org/opensearch/ad/bwc/job-scheduler/$INCREMENT_FROM.0-SNAPSHOT
mkdir -p ../anomaly-detection/src/test/resources/org/opensearch/ad/bwc/job-scheduler/$INCREMENT_TO.0-SNAPSHOT
cp ./build/distributions/opensearch-job-scheduler-$INCREMENT_TO.0-SNAPSHOT.zip ../anomaly-detection/src/test/resources/org/opensearch/ad/bwc/job-scheduler/$INCREMENT_TO.0-SNAPSHOT

rm ../dashboards-reports/reports-scheduler/src/test/resources/job-scheduler/*
cp ./build/distributions/opensearch-job-scheduler-$INCREMENT_TO.0-SNAPSHOT.zip ../dashboards-reports/reports-scheduler/src/test/resources/job-scheduler/

rm ../index-management/src/test/resources/job-scheduler/*
cp ./build/distributions/opensearch-job-scheduler-$INCREMENT_TO.0-SNAPSHOT.zip ../index-management/src/test/resources/job-scheduler/
```

For each of `anomaly-detection`, `dashboards-reports`, and `index-management`, use `git add .` to add the above updated-files, commit, and push an update, e.g. `git push <your-github-username> increment-to-$INCREMENT_TO`.

#### Update the Manifest

Ensure all plugins pass CI and the version increments have been merged. Add the remaining components to the manifest, e.g. [opensearch-build#1380](https://github.com/opensearch-project/opensearch-build/pull/1380).
1 change: 1 addition & 0 deletions plugins/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/job-scheduler/
/k-nn/
/performance-analyzer/
/performance-analyzer-rca/
/security/
/sql/
/trace-analytics/
Expand Down
1 change: 1 addition & 0 deletions plugins/.meta
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"job-scheduler": "git@github.com:opensearch-project/job-scheduler.git",
"k-nn": "git@github.com:opensearch-project/k-nn.git",
"performance-analyzer": "git@github.com:opensearch-project/performance-analyzer.git",
"performance-analyzer-rca": "git@github.com:opensearch-project/performance-analyzer-rca.git",
"security": "git@github.com:opensearch-project/security.git",
"sql": "git@github.com:opensearch-project/sql.git",
"observability": "git@github.com:opensearch-project/observability.git",
Expand Down