global environment parameters

This commit is contained in:
Brad Rydzewski 2015-05-19 21:22:31 -07:00
parent b66bdd46b7
commit f3c06a8fc3
4 changed files with 10 additions and 11 deletions

View file

@ -20,7 +20,9 @@ type Context struct {
Keys *common.Keypair `json:"keys"`
Netrc *common.Netrc `json:"netrc"`
Yaml []byte `json:"yaml"`
Conf *common.Config `json:"-"`
Env []string `json:"env"`
Conf *common.Config `json:"-"`
infos []*dockerclient.ContainerInfo
client dockerclient.Client
}
@ -126,16 +128,6 @@ func execCompose(c *Context) (int, error) {
return 0, nil
}
func trace(s string) string {
cmd := fmt.Sprintf("$ %s\n", s)
encoded := base64.StdEncoding.EncodeToString([]byte(cmd))
return fmt.Sprintf("echo %s | base64 --decode\n", encoded)
}
func newline(s string) string {
return fmt.Sprintf("%s\n", s)
}
func runSteps(c *Context, steps map[string]*common.Step) (int, error) {
for _, step := range steps {
@ -151,6 +143,10 @@ func runSteps(c *Context, steps map[string]*common.Step) (int, error) {
conf := toContainerConfig(step)
conf.Cmd = toCommand(c, step)
// append global environment variables
conf.Env = append(conf.Env, c.Env)
info, err := run(c.client, conf, step.Pull)
if err != nil {
return 255, err

View file

@ -15,6 +15,7 @@ type Work struct {
Keys *common.Keypair `json:"keypair"`
Netrc *common.Netrc `json:"netrc"`
Yaml []byte `json:"yaml"`
Env []string `json:"env"`
}
// represents a worker that has connected

View file

@ -118,6 +118,7 @@ func (r *Runner) Run(w *queue.Work) error {
Netrc: w.Netrc,
Yaml: w.Yaml,
Build: task,
Env: w.Env,
}
in, err := json.Marshal(work)
if err != nil {

View file

@ -58,6 +58,7 @@ type work struct {
Keys *common.Keypair `json:"keys"`
Netrc *common.Netrc `json:"netrc"`
Yaml []byte `json:"yaml"`
Env []string `json:"env"`
}
type worker struct {