upload/pulp: import commit into repository
Function for importing a commit artifact (that's already been uploaded) into a given repository. Note that the "repo" argument to the NewOstreeImportAll() function refers to the name of the repository directory inside the archive, which for the commits we produce in osbuild is always "repo".
This commit is contained in:
parent
4c002f3d54
commit
57f1bb8bf4
1 changed files with 15 additions and 0 deletions
|
|
@ -111,3 +111,18 @@ func (cl *Client) CreateOSTreeRepository(name, description string) (string, erro
|
|||
|
||||
return result.GetPulpHref(), nil
|
||||
}
|
||||
|
||||
// ImportCommit imports a commit that has already been uploaded to a given
|
||||
// repository. The commitHref must reference a commit tarball artifact. This
|
||||
// task is asynchronous. The returned value is the href for the import task.
|
||||
func (cl *Client) ImportCommit(commitHref, repoHref string) (string, error) {
|
||||
req := cl.client.RepositoriesOstreeAPI.RepositoriesOstreeOstreeImportAll(cl.ctx, repoHref)
|
||||
importOptions := *pulpclient.NewOstreeImportAll(commitHref, "repo") // our commit archives always use the repo name "repo"
|
||||
|
||||
result, resp, err := req.OstreeImportAll(importOptions).Execute()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("ostree commit import failed: %s (%s)", err.Error(), readBody(resp))
|
||||
}
|
||||
|
||||
return result.Task, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue