本文整理匯總了Golang中github.com/flynn/flynn/controller/types.App.System方法的典型用法代碼示例。如果您正苦於以下問題:Golang App.System方法的具體用法?Golang App.System怎麽用?Golang App.System使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/flynn/flynn/controller/types.App
的用法示例。
在下文中一共展示了App.System方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: deployApp
func deployApp(client *controller.Client, app *ct.App, uri string, log log15.Logger) error {
release, err := client.GetAppRelease(app.ID)
if err != nil {
log.Error("error getting release", "err", err)
return err
}
artifact, err := client.GetArtifact(release.ArtifactID)
if err != nil {
log.Error("error getting release artifact", "err", err)
return err
}
if !app.System() {
u, err := url.Parse(artifact.URI)
if err != nil {
return err
}
if u.Query().Get("name") != "flynn/slugrunner" {
return errDeploySkipped{"app not using slugrunner image"}
}
}
skipDeploy := artifact.URI == uri
// deploy the gitreceive / taffy apps if builder / runner images have changed
switch app.Name {
case "gitreceive":
proc, ok := release.Processes["app"]
if !ok {
e := "missing app process in gitreceive release"
log.Error(e)
return errors.New(e)
}
if updateSlugURIs(proc.Env) {
skipDeploy = false
}
release.Processes["app"] = proc
case "taffy":
if updateSlugURIs(release.Env) {
skipDeploy = false
}
}
if skipDeploy {
return errDeploySkipped{"app is already using latest images"}
}
artifact.ID = ""
artifact.URI = uri
if err := client.CreateArtifact(artifact); err != nil {
log.Error("error creating artifact", "err", err)
return err
}
release.ID = ""
release.ArtifactID = artifact.ID
if err := client.CreateRelease(release); err != nil {
log.Error("error creating new release", "err", err)
return err
}
if err := client.DeployAppRelease(app.ID, release.ID); err != nil {
log.Error("error deploying app", "err", err)
return err
}
return nil
}
示例2: deployApp
func deployApp(client controller.Client, app *ct.App, uri string, updateFn updater.UpdateReleaseFn, log log15.Logger) error {
release, err := client.GetAppRelease(app.ID)
if err != nil {
log.Error("error getting release", "err", err)
return err
}
artifact, err := client.GetArtifact(release.ImageArtifactID())
if err != nil {
log.Error("error getting release artifact", "err", err)
return err
}
if !app.System() {
u, err := url.Parse(artifact.URI)
if err != nil {
return err
}
if u.Query().Get("name") != "flynn/slugrunner" {
return errDeploySkipped{"app not using slugrunner image"}
}
}
skipDeploy := artifact.URI == uri
if updateImageIDs(release.Env) {
skipDeploy = false
}
if skipDeploy {
return errDeploySkipped{"app is already using latest images"}
}
artifact.ID = ""
artifact.URI = uri
if err := client.CreateArtifact(artifact); err != nil {
log.Error("error creating artifact", "err", err)
return err
}
release.ID = ""
release.SetImageArtifactID(artifact.ID)
if updateFn != nil {
updateFn(release)
}
if err := client.CreateRelease(release); err != nil {
log.Error("error creating new release", "err", err)
return err
}
timeoutCh := make(chan struct{})
time.AfterFunc(deployTimeout, func() { close(timeoutCh) })
if err := client.DeployAppRelease(app.ID, release.ID, timeoutCh); err != nil {
log.Error("error deploying app", "err", err)
return err
}
return nil
}
示例3: deployApp
func deployApp(client controller.Client, app *ct.App, uri string, updateFn updater.UpdateReleaseFn, log log15.Logger) error {
release, err := client.GetAppRelease(app.ID)
if err != nil {
log.Error("error getting release", "err", err)
return err
}
artifact, err := client.GetArtifact(release.ImageArtifactID())
if err != nil {
log.Error("error getting release artifact", "err", err)
return err
}
if !app.System() {
u, err := url.Parse(artifact.URI)
if err != nil {
return err
}
if u.Query().Get("name") != "flynn/slugrunner" {
return errDeploySkipped{"app not using slugrunner image"}
}
}
skipDeploy := artifact.URI == uri
if updateSlugURIs(release.Env) {
skipDeploy = false // deploy apps that depend on slugbuilder images if updated
}
if skipDeploy {
return errDeploySkipped{"app is already using latest images"}
}
artifact.ID = ""
artifact.URI = uri
if err := client.CreateArtifact(artifact); err != nil {
log.Error("error creating artifact", "err", err)
return err
}
release.ID = ""
release.SetImageArtifactID(artifact.ID)
if updateFn != nil {
updateFn(release)
}
if err := client.CreateRelease(release); err != nil {
log.Error("error creating new release", "err", err)
return err
}
if err := client.DeployAppRelease(app.ID, release.ID); err != nil {
log.Error("error deploying app", "err", err)
return err
}
return nil
}
示例4: deployApp
func deployApp(client controller.Client, app *ct.App, image *ct.Artifact, updateFn updater.UpdateReleaseFn, log log15.Logger) error {
release, err := client.GetAppRelease(app.ID)
if err != nil {
log.Error("error getting release", "err", err)
return err
}
if len(release.ArtifactIDs) == 0 {
return errDeploySkipped{"release has no artifacts"}
}
artifact, err := client.GetArtifact(release.ArtifactIDs[0])
if err != nil {
log.Error("error getting release artifact", "err", err)
return err
}
if !app.System() && release.IsGitDeploy() {
if artifact.Meta["flynn.component"] != "slugrunner" {
return errDeploySkipped{"app not using slugrunner image"}
}
}
skipDeploy := artifact.Manifest().ID() == image.Manifest().ID()
if updateImageIDs(release.Env) {
skipDeploy = false
}
if skipDeploy {
return errDeploySkipped{"app is already using latest images"}
}
if err := client.CreateArtifact(image); err != nil {
log.Error("error creating artifact", "err", err)
return err
}
release.ID = ""
release.ArtifactIDs[0] = image.ID
if updateFn != nil {
updateFn(release)
}
if err := client.CreateRelease(release); err != nil {
log.Error("error creating new release", "err", err)
return err
}
timeoutCh := make(chan struct{})
time.AfterFunc(deployTimeout, func() { close(timeoutCh) })
if err := client.DeployAppRelease(app.ID, release.ID, timeoutCh); err != nil {
log.Error("error deploying app", "err", err)
return err
}
return nil
}