diff --git a/.goreleaser.yml b/.goreleaser.yml index 759318a72..b636ecaf3 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -16,19 +16,6 @@ builds: - arm64 - ppc64le - s390x - - id: unpack - main: ./cmd/unpack/main.go # Update this path to the actual location of your unpack source - binary: bin/unpack - asmflags: "{{ .Env.GO_BUILD_ASMFLAGS }}" - gcflags: "{{ .Env.GO_BUILD_GCFLAGS }}" - ldflags: "{{ .Env.GO_BUILD_LDFLAGS }}" - goos: - - linux - goarch: - - amd64 - - arm64 - - ppc64le - - s390x dockers: - image_templates: - "{{ .Env.IMAGE_REPO }}:{{ .Env.IMAGE_TAG }}-amd64" diff --git a/Dockerfile b/Dockerfile index dfc7284f3..03c737e3f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,8 @@ # Note: This dockerfile does not build the binaries # required and is intended to be built only with the # 'make build' or 'make release' targets. -# Stage 1: -FROM gcr.io/distroless/static:debug-nonroot AS builder - -# Stage 2: FROM gcr.io/distroless/static:nonroot -# Grab the cp binary so we can cp the unpack -# binary to a shared volume in the bundle image (rukpak library needs it) -COPY --from=builder /busybox/cp /cp - WORKDIR / COPY manager manager diff --git a/Makefile b/Makefile index 53b8c5607..9adce0d55 100644 --- a/Makefile +++ b/Makefile @@ -152,7 +152,7 @@ build-push-e2e-catalog: ## Build the testdata catalog used for e2e tests and pus test-e2e: KIND_CLUSTER_NAME := operator-controller-e2e test-e2e: KUSTOMIZE_BUILD_DIR := config/e2e test-e2e: GO_BUILD_FLAGS := -cover -test-e2e: run image-registry build-push-e2e-catalog kind-load-test-artifacts registry-load-bundles e2e e2e-coverage #HELP Run e2e test suite on local kind cluster +test-e2e: run image-registry build-push-e2e-catalog kind-load-test-artifacts registry-load-bundles e2e e2e-coverage kind-clean #HELP Run e2e test suite on local kind cluster .PHONY: extension-developer-e2e extension-developer-e2e: KIND_CLUSTER_NAME := operator-controller-ext-dev-e2e #EXHELP Run extension-developer e2e on local kind cluster diff --git a/cmd/unpack/main.go b/cmd/unpack/main.go deleted file mode 100644 index 618bfc4ae..000000000 --- a/cmd/unpack/main.go +++ /dev/null @@ -1,122 +0,0 @@ -package main - -import ( - "archive/tar" - "bytes" - "compress/gzip" - "encoding/json" - "fmt" - "io" - "io/fs" - "log" - "os" - "path/filepath" - - "github.com/spf13/cobra" - "k8s.io/apimachinery/pkg/util/sets" - - "github.com/operator-framework/operator-controller/internal/version" -) - -func main() { - var bundleDir string - var operatorControllerVersion bool - - skipRootPaths := sets.NewString( - "/dev", - "/etc", - "/proc", - "/product_name", - "/product_uuid", - "/sys", - "/bin", - ) - cmd := &cobra.Command{ - Use: "unpack", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, _ []string) error { - if operatorControllerVersion { - log.Println(version.String()) - os.Exit(0) - } - var err error - bundleDir, err = filepath.Abs(bundleDir) - if err != nil { - log.Fatalf("get absolute path of bundle directory %q: %v", bundleDir, err) - } - - bundleFS := os.DirFS(bundleDir) - buf := &bytes.Buffer{} - gzw := gzip.NewWriter(buf) - tw := tar.NewWriter(gzw) - if err := fs.WalkDir(bundleFS, ".", func(path string, d fs.DirEntry, err error) error { - if err != nil { - return err - } - - if d.Type()&os.ModeSymlink != 0 { - return nil - } - if bundleDir == "/" { - // If bundleDir is the filesystem root, skip some known unrelated directories - fullPath := filepath.Join(bundleDir, path) - if skipRootPaths.Has(fullPath) { - return filepath.SkipDir - } - } - info, err := d.Info() - if err != nil { - return fmt.Errorf("get file info for %q: %v", path, err) - } - - h, err := tar.FileInfoHeader(info, "") - if err != nil { - return fmt.Errorf("build tar file info header for %q: %v", path, err) - } - h.Uid = 0 - h.Gid = 0 - h.Uname = "" - h.Gname = "" - h.Name = path - - if err := tw.WriteHeader(h); err != nil { - return fmt.Errorf("write tar header for %q: %v", path, err) - } - if d.IsDir() { - return nil - } - f, err := bundleFS.Open(path) - if err != nil { - return fmt.Errorf("open file %q: %v", path, err) - } - if _, err := io.Copy(tw, f); err != nil { - return fmt.Errorf("write tar data for %q: %v", path, err) - } - return nil - }); err != nil { - log.Fatalf("generate tar.gz for bundle dir %q: %v", bundleDir, err) - } - if err := tw.Close(); err != nil { - log.Fatal(err) - } - if err := gzw.Close(); err != nil { - log.Fatal(err) - } - - bundleMap := map[string]interface{}{ - "content": buf.Bytes(), - } - enc := json.NewEncoder(os.Stdout) - if err := enc.Encode(bundleMap); err != nil { - log.Fatalf("encode bundle map as JSON: %v", err) - } - return nil - }, - } - cmd.Flags().StringVar(&bundleDir, "bundle-dir", "", "directory in which the bundle can be found") - cmd.Flags().BoolVar(&operatorControllerVersion, "version", false, "displays operator-controller version information") - - if err := cmd.Execute(); err != nil { - log.Fatal(err) - } -} diff --git a/testdata/bundles/registry-v1/package-with-webhooks.v1.0.0/Dockerfile b/testdata/bundles/registry-v1/package-with-webhooks.v1.0.0/Dockerfile index aa3d0c6d1..58aed6359 100644 --- a/testdata/bundles/registry-v1/package-with-webhooks.v1.0.0/Dockerfile +++ b/testdata/bundles/registry-v1/package-with-webhooks.v1.0.0/Dockerfile @@ -12,4 +12,4 @@ LABEL operators.operatorframework.io.metrics.project_layout=unknown # Copy files to locations specified by labels. COPY manifests /manifests/ -COPY metadata /metadata/ \ No newline at end of file +COPY metadata /metadata/