cloudapi: save and return compose request details

The original compose request contains useful details that are not
preserved when it is converted to a manifest. Things like the
distribution, arch, image type, blueprint or customizations are useful
when examining builds later.

This saves the original request json using the job id and a new
directory (ComposeRequest) under the artifacts directory. The original
request, if present, is then added to the compose/<id>/metadata response
alongside the package list.

Related: RHEL-60120
This commit is contained in:
Brian C. Lane 2024-10-25 15:26:45 -07:00 committed by Tomáš Hozza
parent 199a3d31f8
commit d8e9a86921
2 changed files with 58 additions and 0 deletions

View file

@ -676,6 +676,9 @@ func (s *Server) DeleteArtifacts(id uuid.UUID) error {
return fmt.Errorf("Cannot delete artifacts before job is finished: %s", id)
}
// Remove the ComposeRequest but ignore any errors
_ = os.Remove(path.Join(s.config.ArtifactsDir, "ComposeRequest", id.String()+".json"))
return os.RemoveAll(path.Join(s.config.ArtifactsDir, id.String()))
}