Skip to content

Commit 6332d7a

Browse files
authored
Merge branch 'opensearch-project:main' into main
2 parents e16b93f + 3950a87 commit 6332d7a

File tree

362 files changed

+45953
-9906
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

362 files changed

+45953
-9906
lines changed

.github/workflows/maven-publish.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,14 @@ jobs:
3333
export-env: true
3434
env:
3535
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
36-
SONATYPE_USERNAME: op://opensearch-infra-secrets/maven-central-portal-credentials/username
37-
SONATYPE_PASSWORD: op://opensearch-infra-secrets/maven-central-portal-credentials/password
36+
MAVEN_SNAPSHOTS_S3_REPO: op://opensearch-infra-secrets/maven-snapshots-s3/repo
37+
MAVEN_SNAPSHOTS_S3_ROLE: op://opensearch-infra-secrets/maven-snapshots-s3/role
38+
39+
- name: Configure AWS credentials
40+
uses: aws-actions/configure-aws-credentials@v5
41+
with:
42+
role-to-assume: ${{ env.MAVEN_SNAPSHOTS_S3_ROLE }}
43+
aws-region: us-east-1
3844

3945
- name: publish snapshots to maven
4046
run: |

.github/workflows/require-approval.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@ jobs:
3535
else
3636
# Check if the author is in the approvers list
3737
approvers=$(cat .github/CODEOWNERS | grep @ | tr -d '* ' | sed 's/@/,/g' | sed 's/,//1')
38-
if [[ "$approvers" =~ "$author" ]]; then
38+
is_approved=false
39+
IFS=',' read -ra APPROVER_ARRAY <<< "$approvers"
40+
for approver in "${APPROVER_ARRAY[@]}"; do
41+
if [[ "$approver" == "$author" ]]; then
42+
is_approved=true
43+
break
44+
fi
45+
done
46+
if [[ "$is_approved" == "true" ]]; then
3947
echo "$author is in the approval list."
4048
echo "is-require-approval=ml-commons-cicd-env" >> $GITHUB_OUTPUT
4149
else

build-tools/repositories.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66
repositories {
77
mavenLocal()
8-
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
9-
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
8+
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/maven/" }
109
mavenCentral()
1110
maven {url 'https://oss.sonatype.org/content/repositories/snapshots/'}
1211
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/lucene/" }

build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ buildscript {
1111
ext {
1212
opensearch_group = "org.opensearch"
1313
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
14-
opensearch_version = System.getProperty("opensearch.version", "3.3.0-SNAPSHOT")
14+
opensearch_version = System.getProperty("opensearch.version", "3.4.0-SNAPSHOT")
1515
buildVersionQualifier = System.getProperty("build.version_qualifier", "")
1616
asm_version = "9.7"
1717

@@ -31,8 +31,7 @@ buildscript {
3131

3232
repositories {
3333
mavenLocal()
34-
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
35-
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
34+
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/maven/" }
3635
mavenCentral()
3736
maven { url "https://plugins.gradle.org/m2/" }
3837
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/lucene/" }

client/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@ publishing {
7272
}
7373
maven {
7474
name = "Snapshots"
75-
url = "https://central.sonatype.com/repository/maven-snapshots/"
76-
credentials {
77-
username "$System.env.SONATYPE_USERNAME"
78-
password "$System.env.SONATYPE_PASSWORD"
75+
url = System.getenv("MAVEN_SNAPSHOTS_S3_REPO")
76+
credentials(AwsCredentials) {
77+
accessKey = System.getenv("AWS_ACCESS_KEY_ID")
78+
secretKey = System.getenv("AWS_SECRET_ACCESS_KEY")
79+
sessionToken = System.getenv("AWS_SESSION_TOKEN")
7980
}
8081
}
8182
}

common/build.gradle

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ dependencies {
2222
testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.15.2'
2323
testImplementation "org.opensearch.test:framework:${opensearch_version}"
2424

25-
compileOnly group: 'org.apache.commons', name: 'commons-text', version: '1.10.0'
25+
compileOnly group: 'org.opensearch', name:'opensearch-security-spi', version:"${opensearch_build}"
26+
27+
compileOnly group: 'org.apache.commons', name: 'commons-text', version: '1.14.0'
2628
compileOnly group: 'com.google.code.gson', name: 'gson', version: "${versions.gson}"
2729
compileOnly group: 'org.json', name: 'json', version: '20231013'
2830
testImplementation group: 'org.json', name: 'json', version: '20231013'
@@ -111,10 +113,11 @@ publishing {
111113
}
112114
maven {
113115
name = "Snapshots" // optional target repository name
114-
url = "https://central.sonatype.com/repository/maven-snapshots/"
115-
credentials {
116-
username "$System.env.SONATYPE_USERNAME"
117-
password "$System.env.SONATYPE_PASSWORD"
116+
url = System.getenv("MAVEN_SNAPSHOTS_S3_REPO")
117+
credentials(AwsCredentials) {
118+
accessKey = System.getenv("AWS_ACCESS_KEY_ID")
119+
secretKey = System.getenv("AWS_SECRET_ACCESS_KEY")
120+
sessionToken = System.getenv("AWS_SESSION_TOKEN")
118121
}
119122
}
120123
}

common/src/main/java/org/opensearch/ml/common/CommonValue.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ public class CommonValue {
4646
public static final String ML_AGENT_INDEX = ".plugins-ml-agent";
4747
public static final String ML_MEMORY_META_INDEX = ".plugins-ml-memory-meta";
4848
public static final String ML_MEMORY_MESSAGE_INDEX = ".plugins-ml-memory-message";
49-
public static final String ML_MEMORY_CONTAINER_INDEX = ".plugins-ml-memory-container";
49+
public static final String ML_MEMORY_CONTAINER_INDEX = ".plugins-ml-am-memory-container";
50+
public static final String ML_AGENTIC_MEMORY_SYSTEM_INDEX_PREFIX = ".plugins-ml-am";
51+
public static final String ML_AGENTIC_MEMORY_INDEX_PATTERN = ML_AGENTIC_MEMORY_SYSTEM_INDEX_PREFIX + "*";
5052
public static final String ML_STOP_WORDS_INDEX = ".plugins-ml-stop-words";
5153
// index used in 2.19 to track MlTaskBatchUpdate task
5254
public static final String TASK_POLLING_JOB_INDEX = ".ml_commons_task_polling_job";
@@ -68,12 +70,19 @@ public class CommonValue {
6870
public static final String ML_MEMORY_META_INDEX_MAPPING_PATH = "index-mappings/ml_memory_meta.json";
6971
public static final String ML_MEMORY_MESSAGE_INDEX_MAPPING_PATH = "index-mappings/ml_memory_message.json";
7072
public static final String ML_MEMORY_CONTAINER_INDEX_MAPPING_PATH = "index-mappings/ml_memory_container.json";
73+
public static final String ML_MEMORY_SESSION_INDEX_MAPPING_PATH = "index-mappings/ml_memory_sessions.json";
74+
public static final String ML_WORKING_MEMORY_INDEX_MAPPING_PATH = "index-mappings/ml_memory_working.json";
75+
public static final String ML_LONG_TERM_MEMORY_INDEX_MAPPING_PATH = "index-mappings/ml_memory_long_term.json";
76+
public static final String ML_LONG_MEMORY_HISTORY_INDEX_MAPPING_PATH = "index-mappings/ml_memory_long_term_history.json";
7177
public static final String ML_MCP_SESSION_MANAGEMENT_INDEX_MAPPING_PATH = "index-mappings/ml_mcp_session_management.json";
7278
public static final String ML_MCP_TOOLS_INDEX_MAPPING_PATH = "index-mappings/ml_mcp_tools.json";
7379
public static final String ML_JOBS_INDEX_MAPPING_PATH = "index-mappings/ml_jobs.json";
7480
public static final String ML_INDEX_INSIGHT_CONFIG_INDEX_MAPPING_PATH = "index-mappings/ml_index_insight_config.json";
7581
public static final String ML_INDEX_INSIGHT_STORAGE_INDEX_MAPPING_PATH = "index-mappings/ml_index_insight_storage.json";
7682

83+
// Resource type used in resource-access-control
84+
public static final String ML_MODEL_GROUP_RESOURCE_TYPE = "ml-model-group";
85+
7786
// Calculate Versions independently of OpenSearch core version
7887
public static final Version VERSION_2_11_0 = Version.fromString("2.11.0");
7988
public static final Version VERSION_2_12_0 = Version.fromString("2.12.0");

common/src/main/java/org/opensearch/ml/common/MLModel.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -863,17 +863,17 @@ public Tags getTags() {
863863
public Tags getTags(Connector connector) {
864864
// if connector is present, model is a remote model
865865
if (this.algorithm == FunctionName.REMOTE && connector != null) {
866-
return getRemoteModelTags(connector);
866+
return getRemoteModelTags(connector).addTag(IS_HIDDEN_FIELD, isHidden != null && isHidden);
867867
}
868868

869869
// pre-trained models follow a specific naming convention, relying on that to identify a pre-trained model
870870
if (this.name != null
871871
&& (this.name.startsWith("amazon/") || this.name.startsWith("huggingface/"))
872872
&& this.name.split("/").length >= 3) {
873-
return getPreTrainedModelTags();
873+
return getPreTrainedModelTags().addTag(IS_HIDDEN_FIELD, isHidden != null && isHidden);
874874
}
875875

876-
return getCustomModelTags();
876+
return getCustomModelTags().addTag(IS_HIDDEN_FIELD, isHidden != null && isHidden);
877877
}
878878

879879
/**

common/src/main/java/org/opensearch/ml/common/MLModelGroup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package org.opensearch.ml.common;
77

88
import static org.opensearch.core.xcontent.XContentParserUtils.ensureExpectedToken;
9+
import static org.opensearch.ml.common.CommonValue.BACKEND_ROLES_FIELD;
910
import static org.opensearch.ml.common.CommonValue.TENANT_ID_FIELD;
1011
import static org.opensearch.ml.common.CommonValue.VERSION_2_19_0;
1112

@@ -33,7 +34,6 @@ public class MLModelGroup implements ToXContentObject {
3334
public static final String MODEL_GROUP_NAME_FIELD = "name"; // name of the model group
3435
public static final String DESCRIPTION_FIELD = "description"; // description of the model group
3536
public static final String LATEST_VERSION_FIELD = "latest_version"; // latest model version added to the model group
36-
public static final String BACKEND_ROLES_FIELD = "backend_roles"; // back_end roles as specified by the owner/admin
3737
public static final String OWNER = "owner"; // user who creates/owns the model group
3838

3939
public static final String ACCESS = "access"; // assigned to public, private, or null when model group created
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package org.opensearch.ml.common;
7+
8+
import org.opensearch.security.spi.resources.client.ResourceSharingClient;
9+
10+
/**
11+
* Accessor for resource sharing client
12+
*/
13+
public class ResourceSharingClientAccessor {
14+
private ResourceSharingClient CLIENT;
15+
16+
private static ResourceSharingClientAccessor resourceSharingClientAccessor;
17+
18+
private ResourceSharingClientAccessor() {}
19+
20+
public static ResourceSharingClientAccessor getInstance() {
21+
if (resourceSharingClientAccessor == null) {
22+
resourceSharingClientAccessor = new ResourceSharingClientAccessor();
23+
}
24+
25+
return resourceSharingClientAccessor;
26+
}
27+
28+
/**
29+
* Set the resource sharing client
30+
*/
31+
public void setResourceSharingClient(ResourceSharingClient client) {
32+
resourceSharingClientAccessor.CLIENT = client;
33+
}
34+
35+
/**
36+
* Get the resource sharing client
37+
*/
38+
public ResourceSharingClient getResourceSharingClient() {
39+
return resourceSharingClientAccessor.CLIENT;
40+
}
41+
42+
}

0 commit comments

Comments
 (0)