aci-builder/bin-run/builder.go
func (b *Builder) writeManifest() error {
	upperId, err := b.upperTreeStoreId()
	if err != nil {
		return err
	}

	attrMerger, err := merger.NewAttributesMerger(b.stage1Rootfs+PATH_DGR+PATH_BUILDER, PATH_ATTRIBUTES)
	if err != nil {
		logs.WithE(err).Warn("Failed to prepare attributes")
	}
	attributes, err := attrMerger.Merge()
	if err != nil {
		return errs.WithE(err, "Failed to merge attributes")
	}
	logs.WithFields(b.fields).WithField("attributes", attributes).Debug("Merged attributes for manifest templating")

	content, err := ioutil.ReadFile(b.aciTargetPath + common.PathManifestYmlTmpl)
	if err != nil {
		return errs.WithEF(err, b.fields.WithField("file", b.aciTargetPath+common.PathManifestYmlTmpl), "Failed to read manifest template")
	}

	aciManifest, err := common.ProcessManifestTemplate(string(content), attributes, true)
	if err != nil {
		return errs.WithEF(err, b.fields.WithField("content", string(content)), "Failed to process manifest template")
	}
	target := b.pod.Root + PATH_OVERLAY + "/" + upperId + PATH_UPPER + common.PathManifest

	dgrVersion, ok := manifestApp(b.pod).App.Environment.Get(common.EnvDgrVersion)
	if !ok {
		return errs.WithF(b.fields, "Cannot find dgr version")
	}

	if aciManifest.NameAndVersion.Version() == "" {
		aciManifest.NameAndVersion = *common.NewACFullnameWithVersion(aciManifest.NameAndVersion, common.GenerateVersion(b.aciTargetPath))
	}

	if err := b.fillDependenciesFromBuilder(aciManifest); err != nil {
		return err
	}

	if err := common.WriteAciManifest(aciManifest, target, aciManifest.NameAndVersion.Name(), dgrVersion); err != nil {
		return errs.WithEF(err, b.fields.WithField("file", target), "Failed to write manifest")
	}
	return nil
}
func (b *Builder) writeManifest() error {
	upperId, err := b.upperTreeStoreId()
	if err != nil {
		return err
	}

	attrMerger, err := merger.NewAttributesMerger(b.stage1Rootfs+PATH_DGR+PATH_BUILDER, PATH_ATTRIBUTES)
	if err != nil {
		logs.WithE(err).Warn("Failed to prepare attributes")
	}
	attributes, err := attrMerger.Merge()
	if err != nil {
		return errs.WithE(err, "Failed to merge attributes")
	}
	logs.WithFields(b.fields).WithField("attributes", attributes).Debug("Merged attributes for manifest templating")

	content, err := ioutil.ReadFile(b.aciTargetPath + common.PathManifestYmlTmpl)
	if err != nil {
		return errs.WithEF(err, b.fields.WithField("file", b.aciTargetPath+common.PathManifestYmlTmpl), "Failed to read manifest template")
	}

	aciManifest, err := common.ProcessManifestTemplate(string(content), attributes, true)
	if err != nil {
		return errs.WithEF(err, b.fields.WithField("content", string(content)), "Failed to process manifest template")
	}
	target := b.pod.Root + PATH_OVERLAY + "/" + upperId + PATH_UPPER + common.PathManifest

	dgrVersion, ok := manifestApp(b.pod).App.Environment.Get(common.EnvDgrVersion)
	if !ok {
		return errs.WithF(b.fields, "Cannot find dgr version")
	}

	if aciManifest.NameAndVersion.Version() == "" {
		aciManifest.NameAndVersion = *common.NewACFullnameWithVersion(aciManifest.NameAndVersion, common.GenerateVersion(b.aciTargetPath))
	}

	if err := b.fillDependenciesFromBuilder(aciManifest); err != nil {
		return err
	}

	if err := common.WriteAciManifest(aciManifest, target, aciManifest.NameAndVersion.Name(), dgrVersion); err != nil {
		return errs.WithEF(err, b.fields.WithField("file", target), "Failed to write manifest")
	}
	return nil
}
func ( b * Builder ) writeManifest ( ) error { upperId , err := b . upperTreeStoreId ( ) if err != nil { return err } attrMerger , err := merger . NewAttributesMerger ( b . stage1Rootfs + PATH_DGR + PATH_BUILDER , PATH_ATTRIBUTES ) if err != nil { logs . WithE ( err ) . Warn ( " " ) } attributes , err := attrMerger . Merge ( ) if err != nil { return errs . WithE ( err , " " ) } logs . WithFields ( b . fields ) . WithField ( " " , attributes ) . Debug ( " " ) content , err := ioutil . ReadFile ( b . aciTargetPath + common . PathManifestYmlTmpl ) if err != nil { return errs . WithEF ( err , b . fields . WithField ( " " , b . aciTargetPath + common . PathManifestYmlTmpl ) , " " ) } aciManifest , err := common . ProcessManifestTemplate ( string ( content ) , attributes , true ) if err != nil { return errs . WithEF ( err , b . fields . WithField ( " " , string ( content ) ) , " " ) } target := b . pod . Root + PATH_OVERLAY + " " + upperId + PATH_UPPER + common . PathManifest dgrVersion , ok := manifestApp ( b . pod ) . App . Environment . Get ( common . EnvDgrVersion ) if ! ok { return errs . WithF ( b . fields , " " ) } if aciManifest . NameAndVersion . Version ( ) == " " { aciManifest . NameAndVersion = * common . NewACFullnameWithVersion ( aciManifest . NameAndVersion , common . GenerateVersion ( b . aciTargetPath ) ) } if err := b . fillDependenciesFromBuilder ( aciManifest ) ; err != nil { return err } if err := common . WriteAciManifest ( aciManifest , target , aciManifest . NameAndVersion . Name ( ) , dgrVersion ) ; err != nil { return errs . WithEF ( err , b . fields . WithField ( " " , target ) , " " ) } return nil }
////////////////////////////////////////////
//////////////////////////////////////////