mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Merge pull request #62 from iron-io/henriquechehad-routes-create-image-verification
Routes creation: image verification
This commit is contained in:
@@ -16,6 +16,7 @@ var (
|
||||
ErrAppsNotFound = errors.New("App not found")
|
||||
ErrAppsNothingToUpdate = errors.New("Nothing to update")
|
||||
ErrAppsMissingNew = errors.New("Missing new application")
|
||||
ErrUsableImage = errors.New("Image not found")
|
||||
)
|
||||
|
||||
type App struct {
|
||||
|
||||
@@ -64,6 +64,20 @@ func (r *Runner) Run(ctx context.Context, cfg *Config) (drivers.RunResult, error
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (r Runner) EnsureUsableImage(cfg *Config) error {
|
||||
ctask := &containerTask{
|
||||
cfg: cfg,
|
||||
auth: &agent.ConfigAuth{},
|
||||
}
|
||||
|
||||
err := r.driver.EnsureUsableImage(cfg.Ctx, ctask)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
func selectDriver(driver string, env *common.Environment, conf *driverscommon.Config) (drivers.Driver, error) {
|
||||
switch driver {
|
||||
case "docker":
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
dockercli "github.com/fsouza/go-dockerclient"
|
||||
"github.com/iron-io/titan/runner/tasker"
|
||||
"github.com/iron-io/titan/runner/drivers"
|
||||
)
|
||||
|
||||
type containerTask struct {
|
||||
@@ -37,6 +38,7 @@ func (t *containerTask) Volumes() [][2]string { return [][2]string
|
||||
func (t *containerTask) WorkDir() string { return "" }
|
||||
|
||||
func (t *containerTask) Close() {}
|
||||
func (t *containerTask) WriteStat(drivers.Stat) {}
|
||||
|
||||
func (t *containerTask) DockerAuth() []dockercli.AuthConfiguration {
|
||||
return t.auth.Auth(t.Image())
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/iron-io/functions/api/models"
|
||||
"github.com/iron-io/functions/api/runner"
|
||||
titancommon "github.com/iron-io/titan/common"
|
||||
)
|
||||
|
||||
@@ -37,6 +38,16 @@ func handleRouteCreate(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
err = Api.Runner.EnsureUsableImage(&runner.Config{
|
||||
Ctx: ctx,
|
||||
Route: wroute.Route,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, simpleError(models.ErrUsableImage))
|
||||
return
|
||||
}
|
||||
|
||||
app, err := Api.Datastore.GetApp(wroute.Route.AppName)
|
||||
if err != nil {
|
||||
log.WithError(err).Error(models.ErrAppsGet)
|
||||
|
||||
2
glide.lock
generated
2
glide.lock
generated
@@ -100,7 +100,7 @@ imports:
|
||||
subpackages:
|
||||
- registry
|
||||
- name: github.com/iron-io/titan
|
||||
version: e309e9971583fd1b9894b250a28cb194d90e8ac5
|
||||
version: ae84854491055da1c2f3baa7c32193409f07f14f
|
||||
repo: https://github.com/iron-io/titan.git
|
||||
vcs: git
|
||||
subpackages:
|
||||
|
||||
Reference in New Issue
Block a user