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

Drivers: Use go-getter #288

Merged
merged 1 commit into from
Oct 26, 2015
Merged

Drivers: Use go-getter #288

merged 1 commit into from
Oct 26, 2015

Conversation

catsby
Copy link
Member

@catsby catsby commented Oct 15, 2015

🚧

Converts the Java task driver to use github.com/hashicorp/go-getter instead of the in-line http.Get.

Working on Qemu and others next

  • Java
  • Qemu
  • exec
  • raw_exec
  • Docs

@catsby catsby force-pushed the f-go-getter branch 2 times, most recently from b097d19 to 9489f45 Compare October 19, 2015 15:02
command, ok := task.Config["command"]
if !ok || command == "" {
return nil, fmt.Errorf("missing command for exec driver")
source, sok := task.Config["artifact_source"]
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem like the right behavior. What if my artifact is a tar.gz containing all my assets.Then I would want to download it and then untar and run it.

Copy link
Member Author

Choose a reason for hiding this comment

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

My understanding was we were targeting isolated binaries, similar to the Java jars or the Qemu images.

Downloading and extracting zip/tars wouldn't require too much more, but we may want to think more on that. We would need to expand it further to both support an artifact that's a package (zip/tar) and a command that invokes an arbitrary thing inside of it. Not hard necessarily, but worth discussion if that's what we want to support in this first pass

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm OK with leaving archives for a later PR. We have a lot of code for this in other projects but not something easy to reuse atm.

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 @dadgar has a good point, though. artifact_source and command should be discrete options. In other words, command should always be specified, and additionally artifact_source should be specified if and only if Nomad needs to fetch something. I think the overloaded behavior in artifact_source will be problematic if we need some intermediate step like "extract" to happen before we can run the command.

Name: "sleep",
Config: map[string]string{
"artifact_source": "https://dl.dropboxusercontent.com/u/47675/jar_thing/hi_linux_amd64",
"command": "hi_linux_amd64",
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be ./hi_linux_amd64?

Copy link
Contributor

Choose a reason for hiding this comment

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

Was explained in chat that this is filepath.Joined with the alloc dir.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, we just reference the binary directly and we'll construct the right path

}

// re-assign the command to be the local execution path
command = filepath.Join(allocdir.TaskLocal, command)

Choose a reason for hiding this comment

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

I just had a play with this branch in and some issues with this line. When starting our services we need to source a script to setup some environment variables however when using a command such as source /path/to/script && binary the command gets to turned into local/source /path/to/script && binary and will fail.

Would it be possible to instead change the working directory to the local directory?

return nil, fmt.Errorf("Error copying Qemu image from source: %s", ioErr)
vmPath := filepath.Join(destDir, vmID)
if err := getter.GetFile(vmPath, source); err != nil {
return nil, fmt.Errorf("Error downloading source for Java driver: %s", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Java copy paste :)

@dadgar
Copy link
Contributor

dadgar commented Oct 23, 2015

LGTM. Left small style comments!

Updates Qemu, Java drivers to use go-getter to fetch binaries
Adds remote artifact support for Exec, Raw Exec drivers
catsby added a commit that referenced this pull request Oct 26, 2015
Drivers: Use go-getter for artifact retrieval, add artifact support to Exec, Raw Exec drivers
@catsby catsby merged commit eccc117 into master Oct 26, 2015
@catsby catsby deleted the f-go-getter branch October 26, 2015 15:00
@github-actions
Copy link

github-actions bot commented May 7, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants