forked from opensearch-project/index-management
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Peter Zhu <[email protected]>
- Loading branch information
1 parent
b3b7d2a
commit 4c22b7f
Showing
12 changed files
with
531 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Apply 'untriaged' label during issue lifecycle | ||
|
||
on: | ||
issues: | ||
types: [opened, reopened, transferred] | ||
|
||
jobs: | ||
apply-label: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
github.rest.issues.addLabels({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
labels: ['untriaged'] | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Releases | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: GitHub App token | ||
id: github_app_token | ||
uses: tibdex/[email protected] | ||
with: | ||
app_id: ${{ secrets.APP_ID }} | ||
private_key: ${{ secrets.APP_PRIVATE_KEY }} | ||
installation_id: 22958780 | ||
- name: Get tag | ||
id: tag | ||
uses: dawidd6/action-get-tag@v1 | ||
- uses: actions/checkout@v2 | ||
- uses: ncipollo/release-action@v1 | ||
with: | ||
github_token: ${{ steps.github_app_token.outputs.token }} | ||
bodyFile: release-notes/opensearch-index-management.release-notes-${{steps.tag.outputs.tag}}.md |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
name: Backport | ||
on: | ||
pull_request_target: | ||
types: | ||
- closed | ||
- labeled | ||
|
||
jobs: | ||
backport: | ||
runs-on: ubuntu-latest | ||
if: > | ||
github.event.pull_request.merged | ||
&& ( | ||
github.event.action == 'closed' | ||
|| ( | ||
github.event.action == 'labeled' | ||
&& contains(github.event.label.name, 'backport') | ||
) | ||
) | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
name: Backport | ||
steps: | ||
- name: GitHub App token | ||
id: github_app_token | ||
uses: tibdex/[email protected] | ||
with: | ||
app_id: ${{ secrets.APP_ID }} | ||
private_key: ${{ secrets.APP_PRIVATE_KEY }} | ||
installation_id: 22958780 | ||
|
||
- name: Backport | ||
uses: VachaShah/[email protected] | ||
with: | ||
github_token: ${{ steps.github_app_token.outputs.token }} | ||
head_template: backport/backport-<%= number %>-to-<%= base %> | ||
labels_template: "<%= JSON.stringify([...labels, 'autocut']) %>" | ||
failure_labels: "failed backport" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Backward compatibility test workflow | ||
on: | ||
pull_request: | ||
branches: | ||
- "*" | ||
push: | ||
branches: | ||
- "*" | ||
|
||
jobs: | ||
test: | ||
# This job runs on Linux | ||
runs-on: ubuntu-latest | ||
steps: | ||
# This step uses the setup-java Github action: https://github.com/actions/setup-java | ||
- name: Set Up JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: temurin # Temurin is a distribution of adoptium | ||
java-version: 17 | ||
# index-management | ||
- name: Checkout Branch | ||
uses: actions/checkout@v2 | ||
- name: Run IM Backwards Compatibility Tests | ||
run: | | ||
echo "Running backwards compatibility tests..." | ||
./gradlew bwcTestSuite | ||
- name: Upload failed logs | ||
uses: actions/upload-artifact@v2 | ||
if: failure() | ||
with: | ||
name: logs | ||
path: build/testclusters/indexmanagementBwcCluster*/logs/* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Create Documentation Issue | ||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
- labeled | ||
env: | ||
PR_NUMBER: ${{ github.event.number }} | ||
|
||
jobs: | ||
create-issue: | ||
if: ${{ github.event.label.name == 'needs-documentation' }} | ||
runs-on: ubuntu-latest | ||
name: Create Documentation Issue | ||
steps: | ||
- name: GitHub App token | ||
id: github_app_token | ||
uses: tibdex/[email protected] | ||
with: | ||
app_id: ${{ secrets.APP_ID }} | ||
private_key: ${{ secrets.APP_PRIVATE_KEY }} | ||
installation_id: 22958780 | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Edit the issue template | ||
run: | | ||
echo "https://github.com/opensearch-project/index-management/pull/${{ env.PR_NUMBER }}." >> ./.github/ISSUE_TEMPLATE/documentation.md | ||
- name: Create Issue From File | ||
id: create-issue | ||
uses: peter-evans/create-issue-from-file@v4 | ||
with: | ||
title: Add documentation related to new feature | ||
content-filepath: ./.github/ISSUE_TEMPLATE/documentation.md | ||
labels: documentation | ||
repository: opensearch-project/documentation-website | ||
token: ${{ steps.github_app_token.outputs.token }} | ||
|
||
- name: Print Issue | ||
run: echo Created related documentation issue ${{ steps.create-issue.outputs.issue-number }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Delete merged branch of the backport PRs | ||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
delete-branch: | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.event.pull_request.head.ref,'backport/') | ||
steps: | ||
- name: Delete merged branch | ||
uses: SvanBoxel/delete-merged-branch@main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: Docker Security Test Workflow | ||
on: | ||
pull_request: | ||
branches: | ||
- "**" | ||
push: | ||
branches: | ||
- "**" | ||
|
||
jobs: | ||
docker-test: | ||
# This job runs on Linux | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set Up JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: temurin # Temurin is a distribution of adoptium | ||
java-version: 17 | ||
- name: Checkout Branch | ||
uses: actions/checkout@v2 | ||
- name: Build Index Management | ||
run: ./gradlew assemble | ||
- name: Pull and Run Docker | ||
run: | | ||
plugin=`basename $(ls build/distributions/*.zip)` | ||
list_of_files=`ls` | ||
list_of_all_files=`ls build/distributions/` | ||
version=`echo $plugin|awk -F- '{print $4}'| cut -d. -f 1-3` | ||
plugin_version=`echo $plugin|awk -F- '{print $4}'| cut -d. -f 1-4` | ||
qualifier=`echo $plugin|awk -F- '{print $4}'| cut -d. -f 1-1` | ||
candidate_version=`echo $plugin|awk -F- '{print $5}'| cut -d. -f 1-1` | ||
if qualifier | ||
then | ||
docker_version=$version-$qualifier | ||
else | ||
docker_version=$version | ||
fi | ||
[[ -z $candidate_version ]] && candidate_version=$qualifier && qualifier="" | ||
echo plugin version plugin_version qualifier candidate_version docker_version | ||
echo "($plugin) ($version) ($plugin_version) ($qualifier) ($candidate_version) ($docker_version)" | ||
echo $ls $list_of_all_files | ||
if docker pull opensearchstaging/opensearch:$docker_version | ||
then | ||
echo "FROM opensearchstaging/opensearch:$docker_version" >> Dockerfile | ||
echo "RUN if [ -d /usr/share/opensearch/plugins/opensearch-index-management ]; then /usr/share/opensearch/bin/opensearch-plugin remove opensearch-index-management; fi" >> Dockerfile | ||
echo "ADD build/distributions/$plugin /tmp/" >> Dockerfile | ||
echo "RUN /usr/share/opensearch/bin/opensearch-plugin install --batch file:/tmp/$plugin" >> Dockerfile | ||
echo "RUN echo 'path.repo: ["/usr/share/opensearch/data/repo"]' >> /usr/share/opensearch/config/opensearch.yml" >> Dockerfile | ||
docker build -t opensearch-index-management:test . | ||
echo "imagePresent=true" >> $GITHUB_ENV | ||
else | ||
echo "imagePresent=false" >> $GITHUB_ENV | ||
fi | ||
- name: Run Docker Image | ||
if: env.imagePresent == 'true' | ||
run: | | ||
cd .. | ||
container_id=`docker run -p 9200:9200 -d -p 9600:9600 -e "discovery.type=single-node" opensearch-index-management:test` | ||
sleep 120 | ||
echo `docker logs $container_id` | ||
- name: Run Index Management Test for security enabled test cases | ||
if: env.imagePresent == 'true' | ||
run: | | ||
container_id=`docker ps -q` | ||
plugins=`docker exec $container_id /usr/share/opensearch/bin/opensearch-plugin list` | ||
echo "plugins: $plugins" | ||
security=`echo $plugins | grep opensearch-security | wc -l` | ||
echo $security | ||
if [ $security -gt 0 ] | ||
then | ||
echo "Security plugin is available" | ||
./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername=docker-cluster -Dsecurity=true -Dhttps=true -Duser=admin -Dpassword=admin --tests '*SecurityBehaviorIT' | ||
else | ||
echo "Security plugin is NOT available skipping this run as tests without security have already been run" | ||
fi | ||
- name: Upload failed logs | ||
uses: actions/upload-artifact@v2 | ||
if: failure() | ||
with: | ||
name: logs | ||
path: build/testclusters/integTest-*/logs/* | ||
- name: Collect docker logs on failure | ||
uses: jwalton/gh-docker-logs@v2 | ||
with: | ||
dest: './logs' | ||
- name: Tar logs | ||
run: tar cvzf ./logs.tgz ./logs | ||
- name: Upload logs to GitHub | ||
uses: actions/upload-artifact@v2 | ||
if: failure() | ||
with: | ||
name: logs.tgz | ||
path: ./logs.tgz |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Release Drafter | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
update_release_draft: | ||
name: Update draft release notes | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Update draft release notes | ||
uses: release-drafter/release-drafter@v5 | ||
with: | ||
config-name: draft-release-notes-config.yml | ||
name: Version (set here) | ||
tag: (None) | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Link Checker | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: lychee Link Checker | ||
id: lychee | ||
uses: lycheeverse/lychee-action@master | ||
with: | ||
args: --accept=200,403,429 **/*.html **/*.md **/*.txt **/*.json | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
- name: Fail if there were link errors | ||
run: exit ${{ steps.lychee.outputs.exit_code }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Publish snapshots to maven | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
- '[0-9]+.[0-9]+' | ||
- '[0-9]+.x' | ||
|
||
jobs: | ||
build-and-publish-snapshots: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
id-token: write | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: temurin # Temurin is a distribution of adoptium | ||
java-version: 11 | ||
- uses: actions/checkout@v3 | ||
- uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
role-to-assume: ${{ secrets.PUBLISH_SNAPSHOTS_ROLE }} | ||
aws-region: us-east-1 | ||
- name: publish snapshots to maven | ||
run: | | ||
export SONATYPE_USERNAME=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-username --query SecretString --output text) | ||
export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text) | ||
echo "::add-mask::$SONATYPE_USERNAME" | ||
echo "::add-mask::$SONATYPE_PASSWORD" | ||
./gradlew publishPluginZipPublicationToSnapshotsRepository |
Oops, something went wrong.