Skip to content

Commit

Permalink
use --arch for ops pkg push cmd (with sanitisation for amd64) (#1618)
Browse files Browse the repository at this point in the history
* add arch to ops pkg push cmd with sanitisation for amd64

* clean up extra lines in PR

* change to use pkgFlags
  • Loading branch information
radiosilence authored Jun 5, 2024
1 parent 92fb613 commit 074c720
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/cmd_pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,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, pkgFlags.Parch())
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

0 comments on commit 074c720

Please sign in to comment.