code: func (b *Builder) WriteManifests(manifests map[string]string, tufRepository string) error {
  	for src, name := range manifests {
  		dst := filepath.Join("build", "manifests", name)
  		b.log.Debug("writing manifest", "src", src, "dst", dst)
  
  		manifest, err := ioutil.ReadFile(src)
  		if err != nil {
  			return err
  		}
  		var replaceErr error
  		manifest = imageArtifactPattern.ReplaceAllFunc(manifest, func(raw []byte) []byte {
  			name := string(raw[16 : len(raw)-1])
  			artifact, ok := b.artifacts[name]
  			if !ok {
  				replaceErr = fmt.Errorf("unknown image %q", name)
  				return nil
  			}
  			artifact.Meta = map[string]string{
  				"flynn.component":    name,
  				"flynn.system-image": "true",
  			}
  			data, err := json.Marshal(artifact)
  			if err != nil {
  				replaceErr = err
  				return nil
  			}
  			return data
  		})
  		if replaceErr != nil {
  			return replaceErr
  		}
  		if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil {
  			return err
  		}
  		if err := ioutil.WriteFile(dst, manifest, 0644); err != nil {
  			return err
  		}
  	}
  	return nil
  }
docs: // WriteManifests interpolates a set of manifests and writes them to the
  // build/manifests directory