debian-forge-composer/cmd/osbuild-upload-pulp-ostree/main.go
Achilleas Koutsou 9a2f6fc33e cmd: update the final message in osbuild-upload-pulp-ostree
Since the UploadAndDistributeCommit() function now waits for all tasks
to finish, update the wording of the final message to indicate that the
commit is available.
2023-10-18 21:14:46 +02:00

34 lines
970 B
Go

package main
import (
"flag"
"fmt"
"os"
"github.com/osbuild/osbuild-composer/internal/upload/pulp"
)
func check(err error) {
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(1)
}
}
func main() {
var filename, apiURL, repository, basePath, credsFile string
flag.StringVar(&filename, "archive", "", "ostree archive to upload")
flag.StringVar(&apiURL, "url", "", "server URL")
flag.StringVar(&repository, "repository", "", "repository name")
flag.StringVar(&basePath, "base-path", "", "base path for distribution (if the repository does not already exist)")
flag.StringVar(&credsFile, "credentials", "", `file containing credentials (format: {"username": "...", "password": "..."})`)
flag.Parse()
client, err := pulp.NewClientFromFile(apiURL, credsFile)
check(err)
repoURL, err := client.UploadAndDistributeCommit(filename, repository, basePath)
check(err)
fmt.Printf("The commit is available in the repository at %s\n", repoURL)
}