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

use proper gradle dep. to fetch security plugin #566

Merged
merged 1 commit into from
Sep 26, 2022
Merged

use proper gradle dep. to fetch security plugin #566

merged 1 commit into from
Sep 26, 2022

Conversation

rursprung
Copy link
Contributor

Description

there's no need to manually construct a URL and try to fetch the artefact from there. the plugin is published on maven and we can directly use the gradle/maven dependency to fetch it.

in order to more easily identify it, a new configuration type has been added: opensearchPlugin.

for reference see the discussions on the following issues/PRs:

Signed-off-by: Ralph Ursprung [email protected]

Issues Resolved

n/a

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@rursprung rursprung requested a review from a team September 20, 2022 09:35
@rursprung
Copy link
Contributor Author

CC @dblock @ankitkala @prudhvigodithi (you were involved in the original maven discussions)

@codecov-commenter
Copy link

codecov-commenter commented Sep 20, 2022

Codecov Report

Merging #566 (abf7b2b) into main (5ac1023) will decrease coverage by 1.78%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##               main     #566      +/-   ##
============================================
- Coverage     75.10%   73.31%   -1.79%     
+ Complexity     1008      987      -21     
============================================
  Files           141      141              
  Lines          4595     4595              
  Branches        506      506              
============================================
- Hits           3451     3369      -82     
- Misses          832      913      +81     
- Partials        312      313       +1     
Impacted Files Coverage Δ
...ch/replication/task/index/IndexReplicationState.kt 51.66% <0.00%> (-15.00%) ⬇️
...ication/action/setup/TransportSetupChecksAction.kt 59.52% <0.00%> (-14.29%) ⬇️
...ication/seqno/RemoteClusterRetentionLeaseHelper.kt 80.00% <0.00%> (-11.67%) ⬇️
...tion/repository/RemoteClusterMultiChunkTransfer.kt 90.24% <0.00%> (-9.76%) ⬇️
.../replication/metadata/store/ReplicationMetadata.kt 62.96% <0.00%> (-8.65%) ⬇️
...ication/action/stop/StopIndexReplicationRequest.kt 50.00% <0.00%> (-5.00%) ⬇️
...ion/action/resume/ResumeIndexReplicationRequest.kt 50.00% <0.00%> (-5.00%) ⬇️
...tlin/org/opensearch/replication/util/Extensions.kt 65.47% <0.00%> (-4.77%) ⬇️
...n/index/ReplicateIndexClusterManagerNodeRequest.kt 50.00% <0.00%> (-4.17%) ⬇️
...ication/action/setup/ValidatePermissionsRequest.kt 62.50% <0.00%> (-4.17%) ⬇️
... and 12 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@rursprung
Copy link
Contributor Author

rursprung commented Sep 20, 2022

just realised that in my local test i failed to pass -Psecurity=true and thus didn't run into this 🙈

the problem is that so far you had an org.gradle.api.file.RegularFile and now i have a java.io.File.
from what i can see you anyway don't use the RegularFile but directly call getAsFile() on it: https://github.com/opensearch-project/OpenSearch/blob/4ea32312ca6220d759d69ef6750a0369324fdb2d/buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java#L410-L414

i've now reduced my change to only change the gradle behaviour and leave the whole RegularFile voodoo in place (note that the javadoc for it clearly says that you shouldn't do what is being done here!). i'd suggest to create a follow-up issue in OpenSearch to just add a new API in TestClusterConfiguration which accepts a File directly. then this code here can be further simplified.

there's no need to manually construct a URL and try to fetch the
artefact from there. the plugin is published on maven and we can
directly use the gradle/maven dependency to fetch it.

in order to more easily identify it, a new configuration type has been
added: `opensearchPlugin`.

for reference see the discussions on the following issues/PRs:
- #274
- #455

Signed-off-by: Ralph Ursprung <[email protected]>
@rursprung
Copy link
Contributor Author

i think the current set of build failures is unrelated, i also get them on a clean main branch. can you please verify/confirm this?

@ankitkala
Copy link
Member

i think the current set of build failures is unrelated, i also get them on a clean main branch. can you please verify/confirm this?

Yep. Those are unrelated. I've triggered a retry.

Thanks for fixing this btw :-)

@ankitkala ankitkala enabled auto-merge (squash) September 22, 2022 07:57
@rursprung
Copy link
Contributor Author

i'd suggest to create a follow-up issue in OpenSearch to just add a new API in TestClusterConfiguration which accepts a File directly. then this code here can be further simplified.

i've now raised opensearch-project/OpenSearch#4589

@ankitkala ankitkala merged commit e1dc511 into opensearch-project:main Sep 26, 2022
@rursprung rursprung deleted the use-gradle-dependency-for-opensearch-security-plugin branch September 26, 2022 09:04
@dblock
Copy link
Member

dblock commented Sep 29, 2022

@rursprung Should we use the same approach for things like opensearch-project/job-scheduler#242? Let's document this too somewhere?

@rursprung
Copy link
Contributor Author

@rursprung Should we use the same approach for things like opensearch-project/job-scheduler#242? Let's document this too somewhere?

i think you should use this pattern anywhere you're accessing resources which are available on maven (this is one of the reasons why i'm a big advocate of putting everything there ;)).

i was only aware of this case here (due to ticket links in the past), but if you have more such cases it might make sense to have a tracking issue somewhere to check everything and adapt it to simplify things? though i don't think that it's something super urgent.

documenting it might make sense, though a lot of it is just standard gradle stuff.

@dblock
Copy link
Member

dblock commented Oct 4, 2022

@rursprung I opened opensearch-project/opensearch-plugins#169, please feel free to pitch in! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants