in vhdbuilder/release-notes/autonotes/main.go [142:185]
func getReleaseNotes(sku, path string, fl *flags) error {
// working directory, need one per sku because the file name is
// always "release-notes.txt" so they all overwrite each other.
tmpdir, err := os.MkdirTemp("", "releasenotes")
if err != nil {
return fmt.Errorf("failed to create temp working directory: %w", err)
}
defer os.RemoveAll(tmpdir)
artifactsDirOut := filepath.Join(fl.path, path)
if err := os.MkdirAll(filepath.Dir(artifactsDirOut), 0644); err != nil {
return fmt.Errorf("failed to create parent directory %s with error: %s", artifactsDirOut, err)
}
if err := os.MkdirAll(artifactsDirOut, 0644); err != nil {
return fmt.Errorf("failed to create parent directory %s with error: %s", artifactsDirOut, err)
}
artifacts := []buildArtifact{
{
name: fmt.Sprintf("vhd-release-notes-%s", sku),
tempName: "release-notes.txt",
outName: fmt.Sprintf("%s.txt", fl.date),
latestName: "latest.txt",
},
{
name: fmt.Sprintf("vhd-image-bom-%s", sku),
tempName: "image-bom.json",
outName: fmt.Sprintf("%s-image-list.json", fl.date),
latestName: "latest-image-list.json",
},
}
for _, artifact := range artifacts {
if err := artifact.process(fl, artifactsDirOut, tmpdir); err != nil {
fmt.Printf("processing artifact %s for sku %s", artifact.name, sku)
return fmt.Errorf("failed to process VHD build artifact %s: %w", artifact.name, err)
}
}
return nil
}