Skip to content

Commit

Permalink
[Backport 2.x] Fix bucket selector aggregation writeable name. (#1780) (
Browse files Browse the repository at this point in the history
#1785)

* Fixed pipeline aggregation registration.

Signed-off-by: AWSHurneyt <[email protected]>

* Updated unit tests.

Signed-off-by: AWSHurneyt <[email protected]>

* Moved unit tests to common utils where those assets are currently located.

Signed-off-by: AWSHurneyt <[email protected]>

* Adjusted workflows to refresh dependencies.

Signed-off-by: AWSHurneyt <[email protected]>

---------

Signed-off-by: AWSHurneyt <[email protected]>
Co-authored-by: Craig Perkins <[email protected]>
  • Loading branch information
AWSHurneyt and cwperks authored Jan 28, 2025
1 parent a6285e9 commit 403fcd1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 380 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/multi-node-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ jobs:
- name: Run integration tests with multi node config
run: |
chown -R 1000:1000 `pwd`
su `id -un 1000` -c "whoami && java -version && ./gradlew integTest -PnumNodes=3"
su `id -un 1000` -c "whoami && java -version && ./gradlew integTest -PnumNodes=3 --refresh-dependencies"
4 changes: 2 additions & 2 deletions .github/workflows/security-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
java-version: ${{ matrix.java }}
- name: Build Alerting
# Only assembling since the full build is governed by other workflows
run: ./gradlew assemble
run: ./gradlew assemble --refresh-dependencies
- name: Pull and Run Docker
run: |
plugin=`basename $(ls alerting/build/distributions/*.zip)`
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
if [ $security -gt 0 ]
then
echo "Security plugin is available"
./gradlew :alerting:integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername=docker-cluster -Dsecurity=true -Dhttps=true -Duser=admin -Dpassword=myStrongPassword123!
./gradlew :alerting:integTest --refresh-dependencies -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername=docker-cluster -Dsecurity=true -Dhttps=true -Duser=admin -Dpassword=myStrongPassword123!
else
echo "Security plugin is NOT available skipping this run as tests without security have already been run"
fi
4 changes: 2 additions & 2 deletions .github/workflows/test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Build and run with Gradle
run: |
chown -R 1000:1000 `pwd`
su `id -un 1000` -c "whoami && java -version && ./gradlew assemble integTest"
su `id -un 1000` -c "whoami && java -version && ./gradlew assemble integTest --refresh-dependencies"
- name: Create Artifact Path
run: |
mkdir -p alerting-artifacts
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
java-version: ${{ matrix.java }}
- name: Build and run with Gradle
working-directory: ${{ env.WORKING_DIR }}
run: ./gradlew assemble ${{ env.BUILD_ARGS }}
run: ./gradlew assemble ${{ env.BUILD_ARGS }} --refresh-dependencies
env:
_JAVA_OPTIONS: ${{ matrix.os_java_options }}
- name: Create Artifact Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ import org.opensearch.common.settings.SettingsFilter
import org.opensearch.commons.alerting.action.AlertingActions
import org.opensearch.commons.alerting.action.DocLevelMonitorFanOutAction
import org.opensearch.commons.alerting.aggregation.bucketselectorext.BucketSelectorExtAggregationBuilder
import org.opensearch.commons.alerting.aggregation.bucketselectorext.BucketSelectorIndices
import org.opensearch.commons.alerting.model.BucketLevelTrigger
import org.opensearch.commons.alerting.model.ChainedAlertTrigger
import org.opensearch.commons.alerting.model.ClusterMetricsInput
Expand Down Expand Up @@ -468,10 +469,8 @@ internal class AlertingPlugin : PainlessExtension, ActionPlugin, ScriptPlugin, R
SearchPlugin.PipelineAggregationSpec(
BucketSelectorExtAggregationBuilder.NAME,
{ sin: StreamInput -> BucketSelectorExtAggregationBuilder(sin) },
{ parser: XContentParser, agg_name: String ->
BucketSelectorExtAggregationBuilder.parse(agg_name, parser)
}
)
{ parser: XContentParser, agg_name: String -> BucketSelectorExtAggregationBuilder.parse(agg_name, parser) }
).addResultReader({ sin: StreamInput -> BucketSelectorIndices(sin) })
)
}

Expand Down
Loading

0 comments on commit 403fcd1

Please sign in to comment.