コード例 #1
0
func vrFromOutput(pipelineName string, putted event.FinishPut) db.VersionedResource {
	metadata := make([]db.MetadataField, len(putted.CreatedMetadata))
	for i, md := range putted.CreatedMetadata {
		metadata[i] = db.MetadataField{
			Name:  md.Name,
			Value: md.Value,
		}
	}

	return db.VersionedResource{
		Resource:     putted.Plan.Resource,
		PipelineName: pipelineName,
		Type:         putted.Plan.Type,
		Source:       db.Source(putted.Plan.Source),
		Version:      db.Version(putted.CreatedVersion),
		Metadata:     metadata,
	}
}
コード例 #2
0
func vrFromInput(pipelineName string, got event.FinishGet) db.VersionedResource {
	metadata := make([]db.MetadataField, len(got.FetchedMetadata))
	for i, md := range got.FetchedMetadata {
		metadata[i] = db.MetadataField{
			Name:  md.Name,
			Value: md.Value,
		}
	}

	return db.VersionedResource{
		Resource:     got.Plan.Resource,
		PipelineName: pipelineName,
		Type:         got.Plan.Type,
		Source:       db.Source(got.Plan.Source),
		Version:      db.Version(got.FetchedVersion),
		Metadata:     metadata,
	}
}
コード例 #3
0
func (delegate *delegate) saveImplicitOutput(logger lager.Logger, plan atc.GetPlan, info exec.VersionInfo) {
	metadata := make([]db.MetadataField, len(info.Metadata))
	for i, md := range info.Metadata {
		metadata[i] = db.MetadataField{
			Name:  md.Name,
			Value: md.Value,
		}
	}

	_, err := delegate.db.SaveBuildOutput(delegate.buildID, db.VersionedResource{
		PipelineName: plan.Pipeline,
		Resource:     plan.Resource,
		Type:         plan.Type,
		Source:       db.Source(plan.Source),
		Version:      db.Version(info.Version),
		Metadata:     metadata,
	}, false)
	if err != nil {
		logger.Error("failed-to-save", err)
		return
	}

	logger.Info("saved", lager.Data{"resource": plan.Resource})
}