Add Github Workflow to build and publish lucene snapshots. (#2906)

This change introduces a github workflow so that we can build and push snapshots of lucene.
The RepositoriesSetupPlugin is also updated with a url from where these snapshots can be retrieved.

Signed-off-by: Marc Handalian <handalm@amazon.com>
This commit is contained in:
Marc Handalian 2022-04-15 13:09:33 -07:00 committed by GitHub
parent a6b4967dcf
commit ca9151fa24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 2 deletions

55
.github/workflows/lucene-snapshots.yml vendored Normal file
View File

@ -0,0 +1,55 @@
# This workflow will check out, build, and publish snapshots of lucene.
name: OpenSearch Lucene snapshots
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
ref:
description:
required: false
default: 'main'
jobs:
publish-snapshots:
runs-on: ubuntu-latest
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- name: Checkout Lucene
uses: actions/checkout@v2
with:
repository: 'apache/lucene'
path: lucene
ref: ${{ github.event.inputs.ref }}
- name: Set hash
working-directory: ./lucene
run: |
echo "::set-output name=REVISION::$(git rev-parse --short HEAD)"
id: version
- name: Publish Lucene to local maven repo.
working-directory: ./lucene
run: ./gradlew publishJarsPublicationToMavenLocal -Pversion.suffix=snapshot-${{ steps.version.outputs.REVISION }}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.LUCENE_SNAPSHOTS_ROLE }}
aws-region: us-west-2
- name: Copy files to S3 with the aws CLI.
run: |
aws s3 cp ~/.m2/repository/org/apache/lucene/ s3://${{ secrets.LUCENE_SNAPSHOTS_BUCKET }}/snapshots/lucene/org/apache/lucene/ --recursive --no-progress

View File

@ -49,6 +49,7 @@
- [Submitting Changes](#submitting-changes) - [Submitting Changes](#submitting-changes)
- [Backports](#backports) - [Backports](#backports)
- [LineLint](#linelint) - [LineLint](#linelint)
- [Lucene Snapshots](#lucene-snapshots)
# Developer Guide # Developer Guide
@ -488,3 +489,8 @@ Executing the binary will automatically search the local directory tree for lint
Pass a list of files or directories to limit your search. Pass a list of files or directories to limit your search.
linelint README.md LICENSE linelint README.md LICENSE
# Lucene Snapshots
The Github workflow in [lucene-snapshots.yml](.github/workflows/lucene-snapshots.yml) is a Github worfklow executable by maintainers to build a top-down snapshot build of lucene.
These snapshots are available to test compatibility with upcoming changes to Lucene by updating the version at [version.properties](buildsrc/version.properties) with the `version-snapshot-sha` version.
Example: `lucene = 10.0.0-snapshot-2e941fc`.

View File

@ -92,10 +92,9 @@ public class RepositoriesSetupPlugin implements Plugin<Project> {
throw new GradleException("Malformed lucene snapshot version: " + luceneVersion); throw new GradleException("Malformed lucene snapshot version: " + luceneVersion);
} }
String revision = matcher.group(1); String revision = matcher.group(1);
// TODO(cleanup) - Setup own lucene snapshot repo
MavenArtifactRepository luceneRepo = repos.maven(repo -> { MavenArtifactRepository luceneRepo = repos.maven(repo -> {
repo.setName("lucene-snapshots"); repo.setName("lucene-snapshots");
repo.setUrl("https://artifacts.opensearch.org/snapshots/lucene/"); repo.setUrl("https://d1nvenhzbhpy0q.cloudfront.net/snapshots/lucene/");
}); });
repos.exclusiveContent(exclusiveRepo -> { repos.exclusiveContent(exclusiveRepo -> {
exclusiveRepo.filter( exclusiveRepo.filter(