forked from opensearch-project/cross-cluster-replication
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (116 loc) · 4.58 KB
/
security-knn-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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 --refresh-dependencies 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 --refresh-dependencies 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]