-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Allow downloading many artifacts and support unarchiving #921
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a5896d0
Parse artifacts and options
dadgar a154419
Switch from string to artifact struct
dadgar 2d9a83d
Go-getter options are generic and validation of checksums
dadgar afc9b6a
update the getter
dadgar bdc7fde
Download artifacts and remove old code for drivers
dadgar 4c1be8e
Get tests to pass
dadgar dc6531c
Test task runner downloading artifacts
dadgar 317915b
validate that java/qemu have artifacts and better artifact validation
dadgar 2db5b29
Make user specified tasks executable
dadgar a71540a
evict and replace when the artifacts of a task change
dadgar a70820d
Respond to comments and fix test
dadgar 996c2df
Add artifact to init
dadgar edab031
artifact docs
dadgar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ import ( | |
"log" | ||
"os" | ||
"os/exec" | ||
"path/filepath" | ||
"runtime" | ||
"strings" | ||
"sync" | ||
|
@@ -151,11 +150,10 @@ func (e *UniversalExecutor) LaunchCmd(command *ExecCommand, ctx *ExecutorContext | |
e.cmd.Env = ctx.TaskEnv.EnvList() | ||
e.cmd.Path = ctx.TaskEnv.ReplaceEnv(command.Cmd) | ||
e.cmd.Args = append([]string{e.cmd.Path}, ctx.TaskEnv.ParseAndReplace(command.Args)...) | ||
if filepath.Base(command.Cmd) == command.Cmd { | ||
if lp, err := exec.LookPath(command.Cmd); err != nil { | ||
} else { | ||
e.cmd.Path = lp | ||
} | ||
|
||
// Ensure that the binary being started is executable. | ||
if err := e.makeExecutable(e.cmd.Path); err != nil { | ||
return nil, err | ||
} | ||
|
||
// starting the process | ||
|
@@ -280,3 +278,24 @@ func (e *UniversalExecutor) configureTaskDir() error { | |
e.cmd.Dir = taskDir | ||
return nil | ||
} | ||
|
||
// makeExecutablePosix makes the given file executable for root,group,others. | ||
func (e *UniversalExecutor) makeExecutablePosix(binPath string) error { | ||
fi, err := os.Stat(binPath) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would this work if the binPath is not absolute? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah it would be relative to Nomads cwd tho |
||
if err != nil { | ||
if os.IsNotExist(err) { | ||
return fmt.Errorf("binary %q does not exist", binPath) | ||
} | ||
return fmt.Errorf("specified binary is invalid: %v", err) | ||
} | ||
|
||
// If it is not executable, make it so. | ||
perm := fi.Mode().Perm() | ||
req := os.FileMode(0555) | ||
if perm&req != req { | ||
if err := os.Chmod(binPath, perm|req); err != nil { | ||
return fmt.Errorf("error making %q executable: %s", binPath, err) | ||
} | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment?