From 80a9f324414f13c25008ee5bfd429d296630856f Mon Sep 17 00:00:00 2001 From: Mustafa Gezen Date: Thu, 14 Jul 2022 18:58:49 +0200 Subject: [PATCH] Yumrepofs should translate i386 to i686 --- peridot/yumrepofs/v1/blob.go | 3 +++ peridot/yumrepofs/v1/metadata.go | 12 ++++++++++++ peridot/yumrepofs/v1/rpm.go | 3 +++ rules_byc/internal/container/container.bzl | 7 +++---- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/peridot/yumrepofs/v1/blob.go b/peridot/yumrepofs/v1/blob.go index 2a0b944d..a6165db8 100644 --- a/peridot/yumrepofs/v1/blob.go +++ b/peridot/yumrepofs/v1/blob.go @@ -62,6 +62,9 @@ func (s *Server) GetBlob(ctx context.Context, req *yumrepofspb.GetBlobRequest) ( if err := req.ValidateAll(); err != nil { return nil, err } + if req.Arch == "i386" { + req.Arch = "i686" + } if strings.HasSuffix(req.Blob, ".sqlite.gz") { s3Req, _ := s.s3.GetObjectRequest(&s3.GetObjectInput{ diff --git a/peridot/yumrepofs/v1/metadata.go b/peridot/yumrepofs/v1/metadata.go index 90f846da..5174afbf 100644 --- a/peridot/yumrepofs/v1/metadata.go +++ b/peridot/yumrepofs/v1/metadata.go @@ -44,6 +44,9 @@ func (s *Server) GetRepoMd(_ context.Context, req *yumrepofspb.GetRepoMdRequest) if err := req.ValidateAll(); err != nil { return nil, err } + if req.Arch == "i386" { + req.Arch = "i686" + } latestRevision, err := s.db.GetLatestActiveRepositoryRevisionByProjectIdAndNameAndArch(req.ProjectId, req.RepoName, req.Arch) if err != nil { @@ -66,6 +69,9 @@ func (s *Server) GetRepoMdSignature(_ context.Context, req *yumrepofspb.GetRepoM if err := req.ValidateAll(); err != nil { return nil, err } + if req.Arch == "i386" { + req.Arch = "i686" + } latestRevision, err := s.db.GetLatestActiveRepositoryRevisionByProjectIdAndNameAndArch(req.ProjectId, req.RepoName, req.Arch) if err != nil { @@ -88,6 +94,9 @@ func (s *Server) GetPublicKey(_ context.Context, req *yumrepofspb.GetPublicKeyRe if err := req.ValidateAll(); err != nil { return nil, err } + if req.Arch == "i386" { + req.Arch = "i686" + } key, err := s.db.GetDefaultKeyForProject(req.ProjectId) if err != nil { @@ -104,6 +113,9 @@ func (s *Server) GetUrlMappings(_ context.Context, req *yumrepofspb.GetUrlMappin if err := req.ValidateAll(); err != nil { return nil, err } + if req.Arch == "i386" { + req.Arch = "i686" + } latestRevision, err := s.db.GetLatestActiveRepositoryRevisionByProjectIdAndNameAndArch(req.ProjectId, req.RepoName, req.Arch) if err != nil { diff --git a/peridot/yumrepofs/v1/rpm.go b/peridot/yumrepofs/v1/rpm.go index d4bb7e02..de995c7e 100644 --- a/peridot/yumrepofs/v1/rpm.go +++ b/peridot/yumrepofs/v1/rpm.go @@ -51,6 +51,9 @@ func (s *Server) GetRpm(ctx context.Context, req *yumrepofspb.GetRpmRequest) (*y if err := req.ValidateAll(); err != nil { return nil, err } + if req.Arch == "i386" { + req.Arch = "i686" + } fileName := fmt.Sprintf("%s/%s.rpm", req.ParentTaskId, strings.TrimSuffix(req.FileName, ".rpm")) if len(req.ParentTaskId) == 1 { diff --git a/rules_byc/internal/container/container.bzl b/rules_byc/internal/container/container.bzl index f9a2de8e..e30e85e3 100644 --- a/rules_byc/internal/container/container.bzl +++ b/rules_byc/internal/container/container.bzl @@ -1,5 +1,5 @@ load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") -load("@io_bazel_rules_docker//container:container.bzl", "container_image", "container_push", "container_layer") +load("@io_bazel_rules_docker//container:container.bzl", "container_image", "container_layer", "container_push") load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image") REGISTRY_VARIANT = "aws" @@ -63,10 +63,10 @@ def container(image_name, files, tars_to_layer = [], base = "//bases/bazel/go", if len(server_files) > 0: nodejs_image( - name = "%s_image_node" %image_name, + name = "%s_image_node" % image_name, entry_point = server_entrypoint, data = server_files, - base = ":%s_image" % image_name + base = ":%s_image" % image_name, ) container_push( @@ -88,4 +88,3 @@ def container(image_name, files, tars_to_layer = [], base = "//bases/bazel/go", }) if should_use_aws_format and not disable_conditional else tag, visibility = ["//visibility:public"], ) -