diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 16070d1a85..b75d901525 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -13,21 +13,75 @@ jobs: name: Run integration tests runs-on: ubuntu-latest steps: + # build backend plugin + - name: Set up JDK 14 + uses: actions/setup-java@v1 + with: + java-version: 14.0.x + + - name: Cache Maven packages + uses: actions/cache@v1 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: Checkout OpenSearch + uses: actions/checkout@v2 + with: + repository: 'opensearch-project/OpenSearch' + path: OpenSearch + ref: '1.x' + + - name: Build OpenSearch + working-directory: ./OpenSearch + run: ./gradlew publishToMavenLocal -Dbuild.version_qualifier=rc1 -Dbuild.snapshot=false + + - name: Checkout security + uses: actions/checkout@v2 + with: + repository: 'opensearch-project/security' + path: security + ref: 'main' + + - name: Package + working-directory: ./security + run: mvn -B clean package -Padvanced -DskipTests + + - name: Download OpenSearch Core + run: | + wget https://artifacts.opensearch.org/snapshots/core/opensearch/1.0.0-rc1/opensearch-1.0.0-rc1-SNAPSHOT-linux-x64-latest.tar.gz + tar -xzf opensearch-*.tar.gz + - name: Run OpenSearch with plugin run: | - docker build -t opensearch-test:1.0.0-beta1 -<> config/opensearch.yml - RUN echo "discovery.type: single-node" >> config/opensearch.yml - ENTRYPOINT bin/opensearch + cat > os-ep.sh <> /opensearch/config/opensearch.yml + chown 1001:1001 -R /opensearch + su -c "/opensearch/bin/opensearch" -s /bin/bash opensearch + EOF + docker build -t opensearch-test:latest -f- . <', + fmt: '/_plugins/_security/api/<%=resourceName%>', req: { resourceName: { type: 'string', @@ -76,7 +76,7 @@ export default function (Client: any, config: any, components: any) { method: 'PUT', needBody: true, url: { - fmt: '/_opendistro/_security/api/<%=resourceName%>/<%=id%>', + fmt: '/_plugins/_security/api/<%=resourceName%>/<%=id%>', req: { resourceName: { type: 'string', @@ -104,7 +104,7 @@ export default function (Client: any, config: any, components: any) { method: 'PUT', needBody: true, url: { - fmt: '/_opendistro/_security/api/<%=resourceName%>', + fmt: '/_plugins/_security/api/<%=resourceName%>', req: { resourceName: { type: 'string', @@ -128,7 +128,7 @@ export default function (Client: any, config: any, components: any) { Client.prototype.opensearch_security.prototype.getResource = ca({ method: 'GET', url: { - fmt: '/_opendistro/_security/api/<%=resourceName%>/<%=id%>', + fmt: '/_plugins/_security/api/<%=resourceName%>/<%=id%>', req: { resourceName: { type: 'string', @@ -148,7 +148,7 @@ export default function (Client: any, config: any, components: any) { Client.prototype.opensearch_security.prototype.deleteResource = ca({ method: 'DELETE', url: { - fmt: '/_opendistro/_security/api/<%=resourceName%>/<%=id%>', + fmt: '/_plugins/_security/api/<%=resourceName%>/<%=id%>', req: { resourceName: { type: 'string', @@ -168,7 +168,7 @@ export default function (Client: any, config: any, components: any) { Client.prototype.opensearch_security.prototype.clearCache = ca({ method: 'DELETE', url: { - fmt: '/_opendistro/_security/api/cache', + fmt: '/_plugins/_security/api/cache', }, }); @@ -206,7 +206,7 @@ export default function (Client: any, config: any, components: any) { Client.prototype.opensearch_security.prototype.getAudit = ca({ method: 'GET', url: { - fmt: '/_opendistro/_security/api/audit', + fmt: '/_plugins/_security/api/audit', }, }); @@ -217,7 +217,7 @@ export default function (Client: any, config: any, components: any) { method: 'PUT', needBody: true, url: { - fmt: '/_opendistro/_security/api/audit/config', + fmt: '/_plugins/_security/api/audit/config', }, }); } diff --git a/server/backend/opensearch_security_plugin.ts b/server/backend/opensearch_security_plugin.ts index d5cdf28d39..7b7798769b 100644 --- a/server/backend/opensearch_security_plugin.ts +++ b/server/backend/opensearch_security_plugin.ts @@ -26,7 +26,7 @@ export default function (Client: any, config: any, components: any) { */ Client.prototype.opensearch_security.prototype.authinfo = ca({ url: { - fmt: '/_opendistro/_security/authinfo', + fmt: '/_plugins/_security/authinfo', }, }); @@ -44,7 +44,7 @@ export default function (Client: any, config: any, components: any) { */ Client.prototype.opensearch_security.prototype.multitenancyinfo = ca({ url: { - fmt: '/_opendistro/_security/kibanainfo', + fmt: '/_plugins/_security/dashboardsinfo', }, }); @@ -56,7 +56,7 @@ export default function (Client: any, config: any, components: any) { */ Client.prototype.opensearch_security.prototype.tenantinfo = ca({ url: { - fmt: '/_opendistro/_security/tenantinfo', + fmt: '/_plugins/_security/tenantinfo', }, }); @@ -67,7 +67,7 @@ export default function (Client: any, config: any, components: any) { method: 'POST', needBody: true, url: { - fmt: '/_opendistro/_security/api/authtoken', + fmt: '/_plugins/_security/api/authtoken', }, }); } diff --git a/test/jest_integration/basic_auth.test.ts b/test/jest_integration/basic_auth.test.ts index a11c426e1b..8a61b74c0a 100644 --- a/test/jest_integration/basic_auth.test.ts +++ b/test/jest_integration/basic_auth.test.ts @@ -92,7 +92,7 @@ describe('start OpenSearch Dashboards server', () => { // update ES security config to enable anonymous auth const getConfigResponse = await wreck.get( - 'https://localhost:9200/_opendistro/_security/api/securityconfig', + 'https://localhost:9200/_plugins/_security/api/securityconfig', { rejectUnauthorized: false, headers: { @@ -105,7 +105,7 @@ describe('start OpenSearch Dashboards server', () => { try { config.dynamic!.http!.anonymous_auth_enabled = true; const updateConfigResponse = await wreck.put( - 'https://localhost:9200/_opendistro/_security/api/securityconfig/config', + 'https://localhost:9200/_plugins/_security/api/securityconfig/config', { payload: config, rejectUnauthorized: false,