Update build.gradle #367
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
name: Security and knn tests | |
# This workflow is triggered on pull requests to main branch | |
on: | |
pull_request: | |
branches: | |
- '*' | |
push: | |
branches: | |
- '*' | |
jobs: | |
req: | |
# Job name | |
name: plugin check | |
runs-on: ubuntu-latest | |
outputs: | |
isSecurityPluginAvailable: ${{ steps.plugin-availability-check.outputs.isSecurityPluginAvailable }} | |
isKnnPluginAvailable: ${{ steps.plugin-availability-check.outputs.isKnnPluginAvailable }} | |
steps: | |
# This step uses the checkout Github action: https://github.com/actions/checkout | |
- name: Checkout Branch | |
uses: actions/checkout@v2 | |
- id: plugin-availability-check | |
name: "plugin check" | |
run: | | |
opensearch_version=$(grep "System.getProperty(\"opensearch.version\", \"" build.gradle | grep '\([0-9]\|[.]\)\{5\}' -o) | |
opensearch_version=$opensearch_version".0-SNAPSHOT" | |
# we publish build artifacts to the below url | |
sec_plugin_url="https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/plugin/opensearch-security/"$opensearch_version"/" | |
sec_st=$(curl -s -o /dev/null -w "%{http_code}" $sec_plugin_url) | |
if [ "$sec_st" = "200" ]; then | |
echo "isSecurityPluginAvailable=True" >> $GITHUB_OUTPUT | |
cat $GITHUB_OUTPUT | |
else | |
echo "isSecurityPluginAvailable=False" >> $GITHUB_OUTPUT | |
cat $GITHUB_OUTPUT | |
fi | |
knn_plugin_url="https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/plugin/opensearch-knn/"$opensearch_version"/" | |
knn_st=$(curl -s -o /dev/null -w "%{http_code}" $knn_plugin_url) | |
if [ "$knn_st" = "200" ]; then | |
echo "isKnnPluginAvailable=True" >> $GITHUB_OUTPUT | |
cat $GITHUB_OUTPUT | |
else | |
echo "isKnnPluginAvailable=False" >> $GITHUB_OUTPUT | |
cat $GITHUB_OUTPUT | |
fi | |
build: | |
needs: req | |
if: ${{ 'True' == needs.req.outputs.isSecurityPluginAvailable }} | |
# Job name | |
name: Build and Run Security tests | |
runs-on: ubuntu-latest | |
steps: | |
# This step uses the setup-java Github action: https://github.com/actions/setup-java | |
- name: Set Up JDK 17 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
# This step uses the checkout Github action: https://github.com/actions/checkout | |
- name: Checkout Branch | |
uses: actions/checkout@v2 | |
- name: Build and run Replication tests | |
run: | | |
ls -al src/test/resources/security/plugin | |
./gradlew clean release -Dbuild.snapshot=true -PnumNodes=1 -Psecurity=true | |
- name: Upload failed logs | |
uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: logs | |
path: | | |
build/testclusters/integTest-*/logs/* | |
build/testclusters/leaderCluster-*/logs/* | |
build/testclusters/followCluster-*/logs/* | |
- name: Create Artifact Path | |
run: | | |
mkdir -p cross-cluster-replication-artifacts | |
cp ./build/distributions/*.zip cross-cluster-replication-artifacts | |
- name: Uploads coverage | |
with: | |
fetch-depth: 2 | |
uses: codecov/[email protected] | |
knn-build: | |
needs: req | |
if: ${{ 'True' == needs.req.outputs.isKnnPluginAvailable }} | |
# Job name | |
name: Build and Run Knn tests | |
runs-on: ubuntu-latest | |
steps: | |
# This step uses the setup-java Github action: https://github.com/actions/setup-java | |
- name: Set Up JDK 17 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
# This step uses the checkout Github action: https://github.com/actions/checkout | |
- name: Checkout Branch | |
uses: actions/checkout@v2 | |
- name: Build and run Replication tests | |
run: | | |
./gradlew clean release -Dbuild.snapshot=true -PnumNodes=1 -Dtests.class=org.opensearch.replication.BasicReplicationIT -Dtests.method="test knn index replication" -Pknn=true | |
- name: Upload failed logs | |
uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: logs | |
path: | | |
build/testclusters/integTest-*/logs/* | |
build/testclusters/leaderCluster-*/logs/* | |
build/testclusters/followCluster-*/logs/* | |
- name: Create Artifact Path | |
run: | | |
mkdir -p cross-cluster-replication-artifacts | |
cp ./build/distributions/*.zip cross-cluster-replication-artifacts | |
- name: Uploads coverage | |
with: | |
fetch-depth: 2 | |
uses: codecov/[email protected] |