Skip to content

Commit

Permalink
using action command if present
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurav Gahlot committed Nov 12, 2019
1 parent 23b5f9b commit 955b4a1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions worker/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ func pullActionImage(ctx context.Context, action *pb.WorkflowAction) error {
}
authStr := base64.URLEncoding.EncodeToString(encodedJSON)

_, err = cli.ImagePull(ctx, registry+"/"+action.GetImage(), types.ImagePullOptions{RegistryAuth: authStr})
out, err := cli.ImagePull(ctx, registry+"/"+action.GetImage(), types.ImagePullOptions{RegistryAuth: authStr})
if err != nil {
return errors.Wrap(err, "DOCKER PULL")
}
defer out.Close()
io.Copy(os.Stdout, out)
return nil
}

Expand All @@ -69,7 +71,10 @@ func createContainer(ctx context.Context, action *pb.WorkflowAction) (string, er
Image: registry + "/" + action.GetImage(),
AttachStdout: true,
AttachStderr: true,
Cmd: []string{action.Command},
}

if action.Command != "" {
config.Cmd = []string{action.Command}
}

resp, err := cli.ContainerCreate(ctx, config, nil, nil, action.GetName())
Expand Down

0 comments on commit 955b4a1

Please sign in to comment.