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

Add a command for building the artifacts inside Docker #9609

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tsg
Copy link
Contributor

@tsg tsg commented May 18, 2018

This adds:

  • A Dockerfile.artifacts with the dependencies required to run the
    rake artifact:all command inside Docker
  • A ./ci/docker_build_artifacts.sh script that makes use of this image
  • A gradle task that simply executes that script

This adds:

* A Dockerfile.artifacts with the dependencies required to run the
  `rake artifact:all` command inside Docker
* A `./ci/docker_build_artifacts.sh` script that makes use of this image
* A gradle task that simply executes that script
@tsg tsg added the discuss label May 18, 2018
@tsg
Copy link
Contributor Author

tsg commented May 18, 2018

I opened this PR to have a place to discuss it and to have the Dockefile pushed somewhere, but TBH I find the value of this somewhat dubious myself:

  • Gradle already has some tasks that build artifacts natively, but not the deb and rpm. Perhaps native gradle tasks, avoiding rake altogether is the better way to go.
  • Doing this inside docker, at least with this volume binding approach, is slow (known issue with rake and Docker). It takes up to half an hour on my machine.
  • The rake artifact:all target downloads gradle & jruby and others. These could be instead installed in the docker image (and therefore cached between builds), but I didn't want to risk breaking the release-manager.
  • I wished I could have used the logstash base image, but the JVM from it still segfaults for me (another issue with rake, I guess).

I'm opened to suggestions or just dropping this PR until we figure out something better.

@tsg tsg requested review from andrewvc and yaauie May 18, 2018 08:19
@original-brownbear
Copy link
Member

@tsg

deb and rpm. Perhaps native gradle tasks, avoiding rake altogether is the better way to go.

I'm not aware of any portable way of building rpms and debs that we could use here. The rake tasks for rpm and deb use external dependencies and those we'd still have when building via Gradle directly.
=> imo having a Dockerized version of this is kinda nice :)

Copy link
Contributor

@andrewvc andrewvc left a comment

Choose a reason for hiding this comment

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

I love this PR, but I'm worried about dealing with, and updating, two different base images.

Could we give the gradle thing a shot, and fall back to this strategy if that fails?

docker run --rm \
-v $(pwd):/logstash:delegated \
ls-artifacts \
sh -c "cd logstash && rake artifact:all"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the reason this breaks on docker is that we don't have a gradle task for it. If we had ./gradlew artifactAll invoke the rake task it would probably not segfault. Here's an example gradle task that invokes rake https://github.com/elastic/logstash/blob/master/build.gradle#L176

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, that does the trick, I'll update the PR.

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

Successfully merging this pull request may close these issues.

4 participants