OpenSearch Lucene snapshots #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: 'Lucene ref in github.com/apache/lucene' | |
type: string | |
required: false | |
default: 'main' | |
jobs: | |
publish-snapshots: | |
if: github.repository == 'opensearch-project/OpenSearch' | |
runs-on: ubuntu-latest | |
# These permissions are needed to interact with GitHub's OIDC Token endpoint. | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout Lucene ref:${{ github.event.inputs.ref }} | |
uses: actions/checkout@v4 | |
with: | |
repository: 'apache/lucene' | |
ref: ${{ github.event.inputs.ref }} | |
- name: Get Java Min Version and Lucene Revision from Lucene Repository | |
run: | | |
java_version=`cat build.gradle | grep minJavaVersion | head -1 | grep -Eo '_[0-9]+$' | tr -d '_'` | |
echo "JAVA_VERSION=$java_version" >> $GITHUB_ENV | |
echo "REVISION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Setup JDK ${{ env.JAVA_VERSION }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: 'temurin' | |
- name: Initialize gradle settings | |
run: ./gradlew localSettings | |
- name: Publish Lucene to local maven repo. | |
run: ./gradlew publishJarsPublicationToMavenLocal -Pversion.suffix=snapshot-${{ env.REVISION }} | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.LUCENE_SNAPSHOTS_SECRET_ROLE }} | |
aws-region: us-east-1 | |
- name: Get S3 Bucket | |
id: get_s3_bucket | |
run: | | |
lucene_snapshots_bucket=`aws secretsmanager get-secret-value --secret-id jenkins-artifact-bucket-name --query SecretString --output text` | |
echo "::add-mask::$lucene_snapshots_bucket" | |
echo "LUCENE_SNAPSHOTS_BUCKET=$lucene_snapshots_bucket" >> $GITHUB_OUTPUT | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.LUCENE_SNAPSHOTS_S3_ROLE }} | |
aws-region: us-east-1 | |
- name: Copy files to S3 with the aws CLI (New) | |
run: | | |
aws s3 cp ~/.m2/repository/org/apache/lucene/ s3://${{ steps.get_s3_bucket.outputs.LUCENE_SNAPSHOTS_BUCKET }}/snapshots/lucene/org/apache/lucene/ --recursive --no-progress | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.LUCENE_SNAPSHOTS_ROLE }} | |
aws-region: us-west-2 | |
# We will remove this step once all the lucene snapshots old links are updated with the new one | |
- name: Copy files to S3 with the aws CLI (Old) | |
run: | | |
aws s3 cp ~/.m2/repository/org/apache/lucene/ s3://${{ secrets.LUCENE_SNAPSHOTS_BUCKET }}/snapshots/lucene/org/apache/lucene/ --recursive --no-progress |