Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default build.sh logic add for Gradle custom java zippublish plugin #1999

Merged
merged 8 commits into from
Jul 15, 2022
12 changes: 12 additions & 0 deletions scripts/default/opensearch/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,15 @@ distributions="$(dirname "${zipPath}")"
echo "COPY ${distributions}/*.zip"
mkdir -p $OUTPUT/plugins
cp ${distributions}/*.zip ./$OUTPUT/plugins

#This is to check if a component has a plugin opensearch.zippublish applied and run publishMavenzipPublicationToZipstagingRepository.
MAVEN_ZIP_PUBLISH_TASK="publishMavenzipPublicationToZipstagingRepository"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be renamed to publishZipsToMavenRepository or something similar? Much simpler and precise.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaiksaya
so the reason I have added this way is this var MAVEN_ZIP_PUBLISH_TASK is actually referenced same in the java code, https://github.com/opensearch-project/OpenSearch/pull/2988/files#diff-d56f11b358bf18f6e6c28d2a528aa08d4436d01ce9b3c3c45bab1fa970d9cb43R49 and this is the format publishMavenzipPublicationToZipstagingRepository gradle expects for publishing a custom repo (mavenzip) to custom staging repo (zipstaging).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to add this task is coming from the custom gradle plugin (identifies once the plugin is applied).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, Yeah I thought this can be changed in upstream PR as well but looks like we can't since its a gradle requirement.

if ./gradlew tasks -Dopensearch.version=$VERSION --all | grep -qw "^$MAVEN_ZIP_PUBLISH_TASK"
then
./gradlew publishMavenzipPublicationToZipstagingRepository -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT -Dbuild.version_qualifier=$QUALIFIER
echo "Copying the Maven plugin Zips"
mkdir -p $OUTPUT/maven/org/opensearch/plugin
cp -r ./build/local-staging-repo/org/opensearch/plugin/. $OUTPUT/maven/org/opensearch/plugin
else
echo "Not running publishMavenzipPublicationToZipstagingRepository"
fi