本文整理匯總了Golang中github.com/flynn/flynn/controller/types.Release.Meta方法的典型用法代碼示例。如果您正苦於以下問題:Golang Release.Meta方法的具體用法?Golang Release.Meta怎麽用?Golang Release.Meta使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/flynn/flynn/controller/types.Release
的用法示例。
在下文中一共展示了Release.Meta方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: runImport
//.........這裏部分代碼省略.........
if out, err := exec.Command("docker", "tag", "--force", dockerImage.config.Tag, tag).CombinedOutput(); err != nil {
return fmt.Errorf("error tagging docker image: %s: %q", err, out)
}
artifact, err := dockerPush(client, app.Name, tag)
if err != nil {
return fmt.Errorf("error pushing docker image: %s", err)
}
release.ArtifactIDs = []string{artifact.ID}
} else if imageArtifact != nil {
if imageArtifact.ID == "" {
if err := client.CreateArtifact(imageArtifact); err != nil {
return fmt.Errorf("error creating image artifact: %s", err)
}
}
release.ArtifactIDs = []string{imageArtifact.ID}
}
if release != nil {
for t, proc := range release.Processes {
for i, port := range proc.Ports {
if port.Service != nil && strings.HasPrefix(port.Service.Name, oldName) {
proc.Ports[i].Service.Name = strings.Replace(port.Service.Name, oldName, app.Name, 1)
}
}
release.Processes[t] = proc
}
if err := client.CreateRelease(release); err != nil {
return fmt.Errorf("error creating release: %s", err)
}
if err := client.SetAppRelease(app.ID, release.ID); err != nil {
return fmt.Errorf("error setting app release: %s", err)
}
}
if uploadSlug {
slugURI := fmt.Sprintf("http://blobstore.discoverd/%s/slug.tgz", random.UUID())
config := runConfig{
App: app.ID,
Release: release.ID,
DisableLog: true,
Args: []string{"curl", "--request", "PUT", "--upload-file", "-", slugURI},
Stdin: slug,
Stdout: ioutil.Discard,
Stderr: ioutil.Discard,
}
if bar != nil {
config.Stdin = bar.NewProxyReader(config.Stdin)
}
if err := runJob(client, config); err != nil {
return fmt.Errorf("error uploading slug: %s", err)
}
slugArtifact := &ct.Artifact{
Type: host.ArtifactTypeFile,
URI: slugURI,
}
if err := client.CreateArtifact(slugArtifact); err != nil {
return fmt.Errorf("error creating slug artifact: %s", err)
}
release.ID = ""
release.ArtifactIDs = append(release.ArtifactIDs, slugArtifact.ID)
if release.Meta == nil {
release.Meta = make(map[string]string, 1)
}
release.Meta["git"] = "true"
if err := client.CreateRelease(release); err != nil {
return fmt.Errorf("error creating release: %s", err)
}
if err := client.SetAppRelease(app.ID, release.ID); err != nil {
return fmt.Errorf("error setting app release: %s", err)
}
}
if formation != nil && release != nil {
formation.ReleaseID = release.ID
formation.AppID = app.ID
if err := client.PutFormation(formation); err != nil {
return fmt.Errorf("error creating formation: %s", err)
}
}
if args.Bool["--routes"] {
for _, route := range routes {
if err := client.CreateRoute(app.ID, &route); err != nil {
if e, ok := err.(hh.JSONError); ok && e.Code == hh.ConflictErrorCode {
// If the cluster domain matches then the default route
// exported will conflict with the one created automatically.
continue
}
return fmt.Errorf("error creating route: %s", err)
}
numRoutes++
}
}
fmt.Printf("Imported %s (added %d routes, provisioned %d resources)\n", app.Name, numRoutes, numResources)
return nil
}
示例2: runImport
//.........這裏部分代碼省略.........
slugBuilderImage, err := client.GetArtifact(slugBuilderID)
if err != nil {
return fmt.Errorf("unable to get slugbuilder image artifact: %s", err)
}
if slugBuilderImage.Type == ct.DeprecatedArtifactTypeDocker {
uploadLegacySlug = true
release.ArtifactIDs = []string{slugRunnerID}
return nil
}
// Use slugbuilder to convert the legacy slug to a
// Flynn squashfs image
slugImageID := random.UUID()
config := runConfig{
App: app.ID,
Release: gitreceiveRelease.ID,
ReleaseEnv: true,
Artifacts: []string{slugBuilderID},
DisableLog: true,
Args: []string{"/bin/convert-legacy-slug.sh"},
Stdin: legacySlug,
Stdout: ioutil.Discard,
Stderr: ioutil.Discard,
Env: map[string]string{"SLUG_IMAGE_ID": slugImageID},
}
if bar != nil {
config.Stdin = bar.NewProxyReader(config.Stdin)
}
if err := runJob(client, config); err != nil {
return fmt.Errorf("error uploading slug: %s", err)
}
release.ID = ""
release.ArtifactIDs = []string{slugRunnerID, slugImageID}
if release.Meta == nil {
release.Meta = make(map[string]string, 1)
}
release.Meta["git"] = "true"
return nil
}(); err != nil {
return err
}
} else if dockerImage.config.Tag != "" && dockerImage.archive != nil {
// load the docker image into the Docker daemon
cmd := exec.Command("docker", "load")
cmd.Stdin = dockerImage.archive
if out, err := cmd.CombinedOutput(); err != nil {
return fmt.Errorf("error running docker load: %s: %q", err, out)
}
// use the tag from the config (which will now be applied to
// the loaded image) to push the image to docker-receive
cluster, err := getCluster()
if err != nil {
return err
}
host, err := cluster.DockerPushHost()
if err != nil {
return err
}
tag := fmt.Sprintf("%s/%s:flynn-import-%s", host, app.Name, random.String(8))
if out, err := exec.Command("docker", "tag", dockerImage.config.Tag, tag).CombinedOutput(); err != nil {
return fmt.Errorf("error tagging docker image: %s: %q", err, out)
}
artifact, err := dockerPush(client, app.Name, tag)
if err != nil {