Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use --arch for ops pkg push cmd (with sanitisation for amd64) #1618

Merged
merged 4 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cmd/cmd_pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ func pushCommandHandler(cmd *cobra.Command, args []string) {
}

private, _ := flags.GetBool("private")
arch, _ := flags.GetString("arch")
ns, name, version := api.GetNSPkgnameAndVersion(pkgIdentifier)
pkgList, err := api.GetLocalPackageList()
if err != nil {
Expand Down Expand Up @@ -623,7 +624,7 @@ func pushCommandHandler(cmd *cobra.Command, args []string) {
}
defer os.RemoveAll(archiveName)

req, err := api.BuildRequestForArchiveUpload(ns, name, foundPkg, archiveName, private)
req, err := api.BuildRequestForArchiveUpload(ns, name, foundPkg, archiveName, private, arch)
eyberg marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
log.Fatal(err)
}
Expand Down
3 changes: 2 additions & 1 deletion lepton/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ func GetLocalPackageList() ([]Package, error) {

localPackages, err := os.ReadDir(localPackagesDir)
if err != nil {
return nil, err
log.Infof("could not find local packages directory for arch: %s\n", arches[i])
continue
}
username := GetLocalUsername()
for _, pkg := range localPackages {
Expand Down
6 changes: 5 additions & 1 deletion lepton/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,21 @@ import (
)

// BuildRequestForArchiveUpload builds the request to upload a package with the provided metadata
func BuildRequestForArchiveUpload(namespace, name string, pkg Package, archiveLocation string, private bool) (*http.Request, error) {
func BuildRequestForArchiveUpload(namespace, name string, pkg Package, archiveLocation string, private bool, arch string) (*http.Request, error) {
privateStr := "off"
if private {
privateStr = "on"
}
if arch == "amd64" || arch == "" {
arch = "x86_64"
}
params := map[string]string{
"name": name,
"description": pkg.Description,
"language": pkg.Language,
"runtime": pkg.Runtime,
"version": pkg.Version,
"arch": arch,
"namespace": namespace,
"private": privateStr,
}
Expand Down