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

SOLR-14847: Create Solr Server TGZ #1844

Merged
merged 8 commits into from
Sep 10, 2020
Merged

SOLR-14847: Create Solr Server TGZ #1844

merged 8 commits into from
Sep 10, 2020

Conversation

madrob
Copy link
Contributor

@madrob madrob commented Sep 8, 2020

No description provided.

solr/packaging/build.gradle Outdated Show resolved Hide resolved
@HoustonPutman HoustonPutman changed the title SOLR-14847 Create Solr Server TGZ SOLR-14847: Create Solr Server TGZ Sep 9, 2020
@HoustonPutman
Copy link
Contributor

Two issues I see currently.

  • The package is named solr-packaging-<version>.tgz not solr-<version>.tgz. This should be easily fixed by: archiveBaseName = "solr"
  • The tar contains the output contents, not the output directory. The current solr tars have the contents all stored under solr-<version>/. The problem exists because toDir.outputs is the list of contents of the release directory, not the release directory itself. The same issue pops up in the docker PR, which I have made a workaround for.

@HoustonPutman
Copy link
Contributor

I think I have addressed both of the issues I raised.

Copy link
Contributor

@dweiss dweiss left a comment

Choose a reason for hiding this comment

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

Yes, correct. Remove excessive lines maybe?

Copy link
Contributor

@dweiss dweiss left a comment

Choose a reason for hiding this comment

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

Please take a look at the link I provided earlier - it contains a matcher on file name so only one from clause is needed.

@dweiss
Copy link
Contributor

dweiss commented Sep 9, 2020

from(..., {
filesMatching("**/*.sh", {
fileMode 0755
})
})

@HoustonPutman
Copy link
Contributor

from(..., {
filesMatching("**/*.sh", {
fileMode 0755
})
})

Sorry, forgot to mention this before. I tried that initially and it resulted in all files having the executable bit added.

  from(toDir.outputs, {
    filesMatching(["**/bin/*", "**/*.sh"], {
      fileMode 0755
    })
  })
drwxr-xr-x 1 houston houston    512 Sep  9 11:11 bin
-rwxr-xr-x 1 houston houston 946673 Sep  9 17:11 CHANGES.txt
drwxr-xr-x 1 houston houston    512 Sep  9 11:11 contrib
drwxr-xr-x 1 houston houston    512 Sep  9 11:11 dist
drwxr-xr-x 1 houston houston    512 Sep  9 11:11 example
drwxr-xr-x 1 houston houston    512 Sep  9 11:11 licenses
-rwxr-xr-x 1 houston houston  12646 Sep  9 17:11 LICENSE.txt
-rwxr-xr-x 1 houston houston 786774 Sep  9 17:11 LUCENE_CHANGES.txt
-rwxr-xr-x 1 houston houston  27951 Sep  9 17:11 NOTICE.txt
-rwxr-xr-x 1 houston houston   7470 Sep  9 17:11 README.md
drwxr-xr-x 1 houston houston    512 Sep  9 11:11 server

@madrob
Copy link
Contributor Author

madrob commented Sep 9, 2020

Doing more research on this, I suspect that we should be using the https://docs.gradle.org/current/userguide/distribution_plugin.html built in distribution plugin instead of trying to roll all of this ourselves. I'll spend some time trying to piece this together

@HoustonPutman
Copy link
Contributor

So it turns out that fileMode isn't an option for FileCopyDetails, so it was applying it to the whole Copy operation instead. Changing it to setMode fixed everything.

Hopefully this helps in your migration to that plugin Mike.

@madrob
Copy link
Contributor Author

madrob commented Sep 10, 2020

@HoustonPutman since I don't have a windows machine, can you check the behaviour of the the distribution plugin for me one more time? ./gradlew -p solr/packaging distTar should create the correct file. We probably will need to still set the file mode like you did, but I wanted to verify it once more before committing to it.

@madrob
Copy link
Contributor Author

madrob commented Sep 10, 2020

Most of the changes at this point are indentation, so the PR is much smaller than it appears.

@madrob madrob added the build label Sep 10, 2020
@dweiss
Copy link
Contributor

dweiss commented Sep 10, 2020

I am not keen on using the plugin. I like knowing what's going on behind the scenes - a bit of verboseness is good here, actually.

@dweiss
Copy link
Contributor

dweiss commented Sep 10, 2020

Could you please revert to using a task instead of the plugin? Including that executable bits block Houston added.

@dweiss
Copy link
Contributor

dweiss commented Sep 10, 2020

Perhaps I should clarify my reluctance to use the plugin - these plugins are built-in and ship with gradle. It's a moving target when you upgrade the build system - their behavior changes, your build silently does different things. I've been scalded by this before and I hate it. Versioned plugins are different in that you have some control over their upgrades.

@dweiss
Copy link
Contributor

dweiss commented Sep 10, 2020

Give me some time to digest it, @madrob I'll take a look at what the distribution plugin does behind the scenes and how often it changes.

@dweiss
Copy link
Contributor

dweiss commented Sep 10, 2020

So it turns out that fileMode isn't an option for FileCopyDetails, so it was applying it to the whole Copy operation instead. Changing it to setMode fixed everything.

Ah. Great catch! This is one of the biggest gotchas in gradle - unscoped variables sometimes reach out to unexpected places. Thanks for finding it.

@dweiss
Copy link
Contributor

dweiss commented Sep 10, 2020

I've added a file permissions block and verified what the distribution plugin does. I still have mixed feelings about it but I admit I am conservative about using third-party plugins (spent too much time debugging such stuff...).

Let it be though. +1 from me.

@HoustonPutman
Copy link
Contributor

I might be using it wrong, but I don't think the distTar task overwrites previously generated tars. I've tried changing the executable bit paths, and the tar that already exists is unnaffected.

If this is the case, we might want to switch back to the manual task. Though this seems like I'm doing something wrong, because this surely can't be the default behavior of the plugin.

@dweiss
Copy link
Contributor

dweiss commented Sep 10, 2020

I think those bits are not part of the task's inputs so it's not re-run. Try --rerun-tasks or cleanDistTar

@HoustonPutman
Copy link
Contributor

Ahh ok, thank for clearing that up. Whenever I cleaned it up beforehand, the task worked fine. I've also tested changing actual files and the task unsurprisingly works correctly.

Since we won't be adding executables in weird places too often, I think this should be good to go. +1

@dweiss
Copy link
Contributor

dweiss commented Sep 10, 2020 via email

@madrob
Copy link
Contributor Author

madrob commented Sep 10, 2020

Does this need a CHANGES entry? We haven't been doing that for other gradle build things, but wanted to confirm.

@dweiss
Copy link
Contributor

dweiss commented Sep 10, 2020

I don't know. It's on master only and pretty much everything falls under "gradle build" umbrella. Feel free to add it if you like though!

@madrob madrob merged commit 14e4edc into apache:master Sep 10, 2020
@madrob madrob deleted the solr-tgz branch September 10, 2020 15:55
thelabdude pushed a commit that referenced this pull request Sep 14, 2020
Create new targets for building solr binary release artifacts:

gradlew -p solr/packaging distTar distZip

Co-authored-by: Houston Putman <houston@apache.org>
Co-authored-by: Dawid Weiss <dawid.weiss@carrotsearch.com>
Co-authored-by: Mike Drob <mdrob@apache.org>
rishisankar pushed a commit to rishisankar/lucene-solr that referenced this pull request Sep 16, 2020
Create new targets for building solr binary release artifacts:

gradlew -p solr/packaging distTar distZip

Co-authored-by: Houston Putman <houston@apache.org>
Co-authored-by: Dawid Weiss <dawid.weiss@carrotsearch.com>
Co-authored-by: Mike Drob <mdrob@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants