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": "[email protected]:opensearch-project/k-nn.git",
"notifications": "[email protected]:opensearch-project/notifications.git",
"performance-analyzer": "[email protected]:opensearch-project/performance-analyzer.git",
"performance-analyzer-rca": "[email protected]:opensearch-project/performance-analyzer-rca.git",
"security-dashboards-plugin": "[email protected]:opensearch-project/security-dashboards-plugin",
"security": "[email protected]:opensearch-project/security.git",
"sql": "[email protected]:opensearch-project/sql.git",
Expand Down
144 changes: 144 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,135 @@ 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

Increment the version in OpenSearch patch branch, e.g. 1.2, [OpenSearch#1758](https://github.com/opensearch-project/OpenSearch/pull/1758). After this change is merged, 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

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.

#### Increment Version in Plugins

Check out and update the 1.2 branch.

```
meta git update
meta git pull origin
meta git checkout 1.2
Copy link
Member

Choose a reason for hiding this comment

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

Not a blocker for this PR, just a thought.
I think having an ENV variable for these versions might make it easier when we run this for future versions.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a good idea, did it anyway.

meta git pull origin 1.2
```

Replace known versions.

```
find . -name build.gradle -print0 | xargs -0 sed -i "s/1.2.2-SNAPSHOT/1.2.3-SNAPSHOT/g"
find . -wholename "*/.github/workflows/*.yml" -print0 | xargs -0 sed -i "s/1.2.2-SNAPSHOT/1.2.3-SNAPSHOT/g"
find . -wholename "*/.github/workflows/*.yml" -print0 | xargs -0 sed -i "s/1.2.2.0-SNAPSHOT/1.2.3.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/1.2.2/1.2.3/g"
find . -name CMakeLists.txt -print0 | xargs -0 sed -i "s/1.2.2.0/1.2.3.0/g"
find . -name pom.xml -print0 | xargs -0 sed -i "s/1.2.2/1.2.3/g"
Copy link

@davidlago davidlago Dec 23, 2021

Choose a reason for hiding this comment

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

Beware of blanket find/replace statements. In security, for example, bumping from 1.2.3 to 1.2.4 would have also matched this https://github.com/opensearch-project/security/blob/main/pom.xml#L81

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair enough! I think it’s a poor man’s implementation anyway. What we really need is GHA workflows in each repo that increment versions based on created tags.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

+1 to the component specific actions. It makes it easier for component owners.

find . -name plugin-descriptor.properties -print0 | xargs -0 sed -i "s/1.2.2/1.2.3/g"
```

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

```
find . -name SecurityAdminWrapper.sh -print0 | xargs -0 sed -i "s/1.2.2/1.2.3/g"
```

#### Commit and Push Changes

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

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-1.2.3"
```

#### Create Pull Requests

##### common-utils and job-scheduler

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

```
cd common-utils
gh pr create --title "Incremented version to 1.2.3." --body "Coming from https://github.com/opensearch-project/opensearch-build/issues/1365." --base 1.2 --label v1.2.3'
```

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.

##### 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).

##### 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-SNAPSHOT/opensearch-min-1.2.3-SNAPSHOT-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.

##### 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 1.2.3." --body "Coming from https://github.com/opensearch-project/opensearch-build/issues/1365." --base 1.2 --label v1.2.3'
```

##### 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 1.2
git pull
./gradlew assemble

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

rm ../dashboards-reports/reports-scheduler/src/test/resources/job-scheduler/*
cp ./build/distributions/opensearch-job-scheduler-1.2.3.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-1.2.3.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-1.2.3`.

#### 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/.meta
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"job-scheduler": "[email protected]:opensearch-project/job-scheduler.git",
"k-nn": "[email protected]:opensearch-project/k-nn.git",
"performance-analyzer": "[email protected]:opensearch-project/performance-analyzer.git",
"performance-analyzer-rca": "[email protected]:opensearch-project/performance-analyzer-rca.git",
"security": "[email protected]:opensearch-project/security.git",
"sql": "[email protected]:opensearch-project/sql.git",
"observability": "[email protected]:opensearch-project/observability.git",
Expand Down