Skip to content

Commit

Permalink
Add Github Workflow to build and publish lucene snapshots. (#2906)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mch2 authored Apr 15, 2022
1 parent a6b4967 commit ca9151f
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/lucene-snapshots.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
- [Submitting Changes](#submitting-changes)
- [Backports](#backports)
- [LineLint](#linelint)
- [Lucene Snapshots](#lucene-snapshots)

# Developer Guide

Expand Down Expand Up @@ -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.

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`.
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,9 @@ public static void configureRepositories(Project project) {
throw new GradleException("Malformed lucene snapshot version: " + luceneVersion);
}
String revision = matcher.group(1);
// TODO(cleanup) - Setup own lucene snapshot repo
MavenArtifactRepository luceneRepo = repos.maven(repo -> {
repo.setName("lucene-snapshots");
repo.setUrl("https://artifacts.opensearch.org/snapshots/lucene/");
repo.setUrl("https://d1nvenhzbhpy0q.cloudfront.net/snapshots/lucene/");
});
repos.exclusiveContent(exclusiveRepo -> {
exclusiveRepo.filter(
Expand Down

0 comments on commit ca9151f

Please sign in to comment.