-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description Restructure the ocm core library according to the intended new package structure and module name (`ocm.software/ocm`). In a first step we keep the lib and the CLI inthe same repository as before. The actual first migration step has been be done based on the original main branch just by calling `migrate.sh --paths --module` from the repository root folder. It can be repeated for new main versions. Afterwards it is possible to call - `make build` - `make generate` - `make test` - `make generate-deepcopy` - `go fmt ./{api,cmds}/...` - `make check` These commands should succeed. This is the current state. Everything else is not yet done. So far, packages are moved and renamed to their intended location in the package structure. The used relative paths should be adapted and tests and component builds are running. To adapt projects using this library a migration script is provided. It can be run in in the root folder of using repositories by calling `migrate.sh --script migrate.mig`. Optionally, particular package folders can be given as additional arguments. (see also mig.md) ## What type of PR is this? (check all applicable) - [ ] 🍕 Feature - [x] 🎇 Restructuring - [ ] 🐛 Bug Fix - [ ] 📝 Documentation Update - [ ] 🎨 Style - [ ] 🧑💻 Code Refactor - [ ] 🔥 Performance Improvements - [ ] ✅ Test - [ ] 🤖 Build - [ ] 🔁 CI - [ ] 📦 Chore (Release) - [ ] ⏩ Revert ## Related Tickets & Documents
- Loading branch information
1 parent
8472909
commit 4a1aa4f
Showing
2,865 changed files
with
88,281 additions
and
90,869 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||
Upstream-Name: ocm | ||
Upstream-Contact: [email protected] | ||
Source: https://github.com/open-component-model/ocm | ||
Source: https://ocm.software/ocm | ||
Disclaimer: The code in this project may include calls to APIs ("API Calls") of | ||
SAP or third-party products or services developed outside of this project | ||
("External Products"). | ||
|
@@ -28,6 +28,6 @@ Files: ** | |
Copyright: 2024 SAP SE or an SAP affiliate company and Open Component Model contributors | ||
License: Apache-2.0 | ||
|
||
Files: pkg/contexts/ocm/blobhandler/handlers/generic/npm/publish.go | ||
Files: api/ocm/extensions/blobhandler/handlers/generic/npm/publish.go | ||
Copyright: Copyright 2021 - cloverstd | ||
License: MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package clictx | ||
|
||
import ( | ||
"context" | ||
"io" | ||
|
||
"github.com/mandelsoft/vfs/pkg/vfs" | ||
|
||
"ocm.software/ocm/api/cli/internal" | ||
"ocm.software/ocm/api/datacontext" | ||
"ocm.software/ocm/api/ocm" | ||
) | ||
|
||
func WithContext(ctx context.Context) internal.Builder { | ||
return internal.Builder{}.WithContext(ctx) | ||
} | ||
|
||
func WithSharedAttributes(ctx datacontext.AttributesContext) internal.Builder { | ||
return internal.Builder{}.WithSharedAttributes(ctx) | ||
} | ||
|
||
func WithOCM(ctx ocm.Context) internal.Builder { | ||
return internal.Builder{}.WithOCM(ctx) | ||
} | ||
|
||
func WithFileSystem(fs vfs.FileSystem) internal.Builder { | ||
return internal.Builder{}.WithFileSystem(fs) | ||
} | ||
|
||
func WithOutput(w io.Writer) internal.Builder { | ||
return internal.Builder{}.WithOutput(w) | ||
} | ||
|
||
func WithErrorOutput(w io.Writer) internal.Builder { | ||
return internal.Builder{}.WithErrorOutput(w) | ||
} | ||
|
||
func WithInput(r io.Reader) internal.Builder { | ||
return internal.Builder{}.WithInput(r) | ||
} | ||
|
||
func New(mode ...datacontext.BuilderMode) internal.Context { | ||
return internal.Builder{}.New(mode...) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package config_test | ||
|
||
import ( | ||
"encoding/json" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
|
||
clictx "ocm.software/ocm/api/cli" | ||
"ocm.software/ocm/api/cli/config" | ||
"ocm.software/ocm/api/oci/extensions/repositories/ocireg" | ||
ocmocireg "ocm.software/ocm/api/ocm/extensions/repositories/ocireg" | ||
) | ||
|
||
var DefaultContext = clictx.New() | ||
|
||
func normalize(i interface{}) ([]byte, error) { | ||
data, err := json.Marshal(i) | ||
if err != nil { | ||
return nil, err | ||
} | ||
var generic map[string]interface{} | ||
err = json.Unmarshal(data, &generic) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return json.Marshal(generic) | ||
} | ||
|
||
var _ = Describe("command config", func() { | ||
ocispec := ocireg.NewRepositorySpec("ghcr.io") | ||
|
||
ocidata, err := normalize(ocispec) | ||
Expect(err).To(Succeed()) | ||
|
||
ocmspec := ocmocireg.NewRepositorySpec("gcr.io", nil) | ||
ocmdata, err := normalize(ocmspec) | ||
Expect(err).To(Succeed()) | ||
|
||
specdata := "{\"ociRepositories\":{\"oci\":" + string(ocidata) + "},\"ocmRepositories\":{\"ocm\":" + string(ocmdata) + "},\"type\":\"" + config.OCMCmdConfigType + "\"}" | ||
|
||
Context("serialize", func() { | ||
It("serializes config", func() { | ||
cfg := config.New() | ||
err := cfg.AddOCIRepository("oci", ocispec) | ||
Expect(err).To(Succeed()) | ||
err = cfg.AddOCMRepository("ocm", ocmspec) | ||
Expect(err).To(Succeed()) | ||
|
||
data, err := normalize(cfg) | ||
|
||
Expect(err).To(Succeed()) | ||
Expect(data).To(Equal([]byte(specdata))) | ||
|
||
cfg2 := config.New() | ||
err = json.Unmarshal(data, cfg2) | ||
Expect(err).To(Succeed()) | ||
Expect(cfg2).To(Equal(cfg)) | ||
}) | ||
}) | ||
}) |
File renamed without changes.
Oops, something went wrong.