Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32677 from tonistiigi/builder-remote-context-4
Implement long running interactive session and sending build context incrementally
- Loading branch information
Showing
112 changed files
with
8,677 additions
and
239 deletions.
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package session | ||
|
||
import ( | ||
"net/http" | ||
|
||
"golang.org/x/net/context" | ||
) | ||
|
||
// Backend abstracts an session receiver from an http request. | ||
type Backend interface { | ||
HandleHTTPRequest(ctx context.Context, w http.ResponseWriter, r *http.Request) error | ||
} |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package session | ||
|
||
import "github.com/docker/docker/api/server/router" | ||
|
||
// sessionRouter is a router to talk with the session controller | ||
type sessionRouter struct { | ||
backend Backend | ||
routes []router.Route | ||
} | ||
|
||
// NewRouter initializes a new session router | ||
func NewRouter(b Backend) router.Router { | ||
r := &sessionRouter{ | ||
backend: b, | ||
} | ||
r.initRoutes() | ||
return r | ||
} | ||
|
||
// Routes returns the available routers to the session controller | ||
func (r *sessionRouter) Routes() []router.Route { | ||
return r.routes | ||
} | ||
|
||
func (r *sessionRouter) initRoutes() { | ||
r.routes = []router.Route{ | ||
router.Experimental(router.NewPostRoute("/session", r.startSession)), | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package session | ||
|
||
import ( | ||
"net/http" | ||
|
||
apierrors "github.com/docker/docker/api/errors" | ||
"golang.org/x/net/context" | ||
) | ||
|
||
func (sr *sessionRouter) startSession(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { | ||
err := sr.backend.HandleHTTPRequest(ctx, w, r) | ||
if err != nil { | ||
return apierrors.NewBadRequestError(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
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.