Skip to content

Commit

Permalink
Merge branch 'maven/access2' of github.com:open-component-model/ocm i…
Browse files Browse the repository at this point in the history
…nto maven/access2
  • Loading branch information
hilmarf committed Apr 23, 2024
2 parents 689ceb2 + a4ef886 commit e1a02dc
Show file tree
Hide file tree
Showing 86 changed files with 2,408 additions and 355 deletions.
4 changes: 2 additions & 2 deletions cmds/ocm/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ type CLIOptions struct {
}

var desc = `
The Open Component Model command line client support the work with OCM
The Open Component Model command line client supports the work with OCM
artifacts, like Component Archives, Common Transport Archive,
Component Repositories, and component versions.
Component Repositories, and Component Versions.
Additionally it provides some limited support for the docker daemon, OCI artifacts and
registries.
Expand Down
4 changes: 3 additions & 1 deletion cmds/ocm/app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ var _ = Describe("Test Environment", func() {
buf := bytes.NewBuffer(nil)
Expect(env.CatchOutput(buf).ExecuteModified(addTestCommands, "logtest")).To(Succeed())
Expect(log.String()).To(StringEqualTrimmedWithContext(`
V[2] warn realm ocm realm test
ERROR <nil> error realm ocm realm test
V[2] ctxwarn realm ocm realm test
ERROR <nil> ctxerror realm ocm realm test
`))
})
Expand Down Expand Up @@ -139,7 +141,7 @@ ERROR <nil> ctxerror realm ocm realm test
fmt.Printf("%s\n", string(data))
// {"level":"error","msg":"error","realm":"test","time":"2024-03-27 09:54:19"}
// {"level":"error","msg":"ctxerror","realm":"test","time":"2024-03-27 09:54:19"}
Expect(len(string(data))).To(Equal(155))
Expect(len(string(data))).To(Equal(312))
})

It("sets attr from file", func() {
Expand Down
109 changes: 97 additions & 12 deletions cmds/ocm/topics/oci/refs/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,21 @@ func New(ctx clictx.Context) *cobra.Command {
Use: "oci-references",
Short: "notation for OCI references",
Example: `
ghcr.io/mandelsoft/cnudie:1.0.0
+ctf+directory::./ocm/ctf//ocm.software/ocmcli/ocmcli-image:0.7.0@sha256:29c842be1ef1da67f6a1c07a3a3a8eb101bbcc4c80f174b87d147b341bca9625
oci::{"baseUrl": "ghcr.io"}//open-component-model/ocm/ocm.software/ocmcli/ocmcli-image:0.7.0@sha256:29c842be1ef1da67f6a1c07a3a3a8eb101bbcc4c80f174b87d147b341bca9625
oci::https://ghcr.io/open-component-model/ocm/ocm.software/ocmcli/ocmcli-image:0.7.0@sha256:29c842be1ef1da67f6a1c07a3a3a8eb101bbcc4c80f174b87d147b341bca9625
oci::https://ghcr.io//open-component-model/ocm/ocm.software/ocmcli/ocmcli-image:0.7.0@sha256:29c842be1ef1da67f6a1c07a3a3a8eb101bbcc4c80f174b87d147b341bca9625
oci::http://localhost:8080/ocm.software/ocmcli/ocmcli-image:0.7.0@sha256:29c842be1ef1da67f6a1c07a3a3a8eb101bbcc4c80f174b87d147b341bca9625
oci::http://localhost:8080//ocm.software/ocmcli/ocmcli-image:0.7.0@sha256:29c842be1ef1da67f6a1c07a3a3a8eb101bbcc4c80f174b87d147b341bca9625
ubuntu:24.04
ubuntu
tensorflow/tensorflow:2.15.0
tensorflow/tensorflow
`,
Long: `
The command line client supports a special notation scheme for specifying
Expand All @@ -29,26 +43,97 @@ images are possible:
<center>
<pre>[+][&lt;type>::][./][&lt;file path>//&lt;repository>[:&lt;tag>][@&lt;digest>]</pre>
or
<pre>[&lt;type>::][&lt;json repo spec>//]&lt;repository>[:&lt;tag>][@&lt;digest>]</pre>
or
<pre>[&lt;type>::][&lt;scheme>:://]&lt;domain>[:&lt;port>/]&lt;repository>[:&lt;tag>][@&lt;digest>]</pre>
or
</center>
or
<center>
<pre>[+][&lt;type>::][&lt;json repo spec>//]&lt;repository>[:&lt;tag>][@&lt;digest>]</pre>
</center>
Notice that if you specify the &lt;type> in the beginning of this
notation AND in the &lt;json repo spec>, the types have to match
(but there is no reason to specify the type in both places).
or
<center>
<pre>[+][&lt;type>::][&lt;scheme>://]&lt;domain>[:&lt;port>][/]/&lt;repository>[:&lt;tag>][@&lt;digest>]</pre>
</center>
Notice that this notation optionally also allows a double slash to
seperate &lt;domain>[:&lt;port>] and &lt;repository>. While it is
not necessary for unambiguous parsing here, it is supported for
consistency with the other notations.
or
<center>
<pre>[+][&lt;type>::][&lt;scheme>://]&lt;host>:&lt;port>/&lt;repository>[:&lt;tag>][@&lt;digest>]</pre>
</center>
Notice that &lt;port> is required in this notation. Without &lt;port>,
this notation would be ambiguous with the docker library notation
mentioned below.
or
<center>
<pre>[+][&lt;type>::][&lt;scheme>://]&lt;host>[:&lt;port>]//&lt;repository>[:&lt;tag>][@&lt;digest>]</pre>
</center>
Notice the double slash (//) before the &lt;repository>. This serves as
a clear separator between &lt;host>[:&lt;port>] and &lt;repository>.
Thus, with this notation, the port is optional and can therefore be
omitted without creating ambiguity with the docker library notation
mentioned below.
or
<center>
<pre>&lt;docker library>[:&lt;tag>][@&lt;digest>]</pre>
or
</center>
or
<center>
<pre>&lt;docker repository>/&lt;docker image>[:&lt;tag>][@&lt;digest>]</pre>
</center>
---
Besides dedicated artifacts it is also possible to denote registries
as a whole:
<center>
<pre>[+][&lt;type>::][&lt;scheme>:://]&lt;domain>[:&lt;port>]</pre>
or
<pre>[+][&lt;type>::]&lt;json repo spec></pre>
or
<pre>[+][&lt;type>::][./]&lt;file path></pre>
<pre>[+][&lt;type>::][./]&lt;file path></pre>
</center>
or
<center>
<pre>[+][&lt;type>::]&lt;json repo spec></pre>
</center>
Notice that if you specify the &lt;type> in the beginning of this
notation AND in the &lt;json repo spec>, the types have to match
(but there is no reason to specify the type in both places).
or
<center>
<pre>[+][&lt;type>::][&lt;scheme>://]&lt;domain>[:&lt;port>]</pre>
</center>
or
<center>
<pre>[+][&lt;type>::][&lt;scheme>://]&lt;host>[:&lt;port>]</pre>
</center>
Notice that &lt;port> is optional in this notation since this cannot be
an image reference and therefore cannot be ambiguous with the docker
library notation.
` + FileBasedUsage(),
}
}
Expand Down
69 changes: 58 additions & 11 deletions cmds/ocm/topics/ocm/refs/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,27 @@ func New(ctx clictx.Context) *cobra.Command {
Use: "ocm-references",
Short: "notation for OCM references",
Example: `
ghcr.io/mandelsoft/cnudie//github.com/mandelsoft/pause:1.0.0
Complete Component Reference Specifications (including all optional arguments):
ctf+tgz::./ctf
+ctf+directory::./ocm/ctf//ocm.software/ocmcli:0.7.0
oci::{"baseUrl":"ghcr.io","componentNameMapping":"urlPath","subPath":"open-component-model"}//ocm.software/ocmcli.0.7.0
oci::https://ghcr.io:443/open-component-model//ocm.software/ocmcli:0.7.0
oci::http://localhost:8080/local-component-repository//ocm.software/ocmcli:0.7.0
---
Short-Hand Component Reference Specifications (omitting optional arguments):
./ocm/ctf//ocm.software/ocmcli:0.7.0
ghcr.io/open-component-model//ocm.software/ocmcli:0.7.0
localhost:8080/local-component-repository//ocm.software/ocmcli:0.7.0 (defaulting to https)
http://localhost:8080/local-component-repository//ocm.software/ocmcli:0.7.0
`,
Long: `
The command line client supports a special notation scheme for specifying
Expand All @@ -27,24 +45,53 @@ references to any registry supported by the OCM toolset that can host OCM
components:
<center>
<pre>[+][&lt;type>::][./][&lt;file path>//&lt;component id>[:&lt;version>]</pre>
or
<pre>[+][&lt;type>::]&lt;domain>[:&lt;port>][/&lt;repository prefix>]//&lt;component id>[:&lt;version]</pre>
or
<pre>[&lt;type>::][&lt;json repo spec>//]&lt;component id>[:&lt;version>]</pre>
<pre>[+][&lt;type>::][./]&lt;file path>//&lt;component id>[:&lt;version>]</pre>
</center>
or
<center>
<pre>[+][&lt;type>::][&lt;json repo spec>//]&lt;component id>[:&lt;version>]</pre>
</center>
or
<center>
<pre>[+][&lt;type>::][&lt;scheme>://]&lt;domain>[:&lt;port>][/&lt;repository prefix>]//&lt;component id>[:&lt;version]</pre>
</center>
or
<center>
<pre>[+][&lt;type>::][&lt;scheme>://]&lt;host>[:&lt;port>][/&lt;repository prefix>]//&lt;component id>[:&lt;version]</pre>
</center>
---
Besides dedicated components it is also possible to denote repositories
as a whole:
<center>
<pre>[+][&lt;type>::][&lt;scheme>:://]&lt;domain>[:&lt;port>][/&lt;repository prefix>]</pre>
or
<pre>[+][&lt;type>::]&lt;json repo spec></pre>
or
<pre>[+][&lt;type>::][./]&lt;file path></pre>
</center>
or
<center>
<pre>[+][&lt;type>::]&lt;json repo spec></pre>
</center>
or
<center>
<pre>[+][&lt;type>::][&lt;scheme>://]&lt;domain>[:&lt;port>][/&lt;repository prefix>]</pre>
</center>
or
<center>
<pre>[+][&lt;type>::][&lt;scheme>://]&lt;host>[:&lt;port>][/&lt;repository prefix>]</pre>
</center>
` + topicocirefs.FileBasedUsage(),
}
}
2 changes: 1 addition & 1 deletion components/ocmcli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ PLATFORM_ARCH := $(shell go env GOARCH)
CMDSRCS=$(shell find $(REPO_ROOT)/cmds/$(CMD) -type f) Makefile
OCMSRCS=$(shell find $(REPO_ROOT)/pkg -type f) $(REPO_ROOT)/go.*

ATTRIBUTES = VERSION="$(VERSION)" NAME="$(NAME)" COMMIT="$(COMMIT)" IMAGE="$(IMAGE):$(VERSION)" PLATFORMS="$(IMAGE_PLATFORMS)" GEN="$(GEN)" MULTI=$(MULTI)
ATTRIBUTES = VERSION="$(VERSION)" NAME="$(NAME)" COMMIT="$(COMMIT)" IMAGE="$(IMAGE):$(VERSION)" PLATFORMS="$(PLATFORMS)" IMAGE_PLATFORMS="$(IMAGE_PLATFORMS)" GEN="$(GEN)" MULTI=$(MULTI)

ifeq ($(MULTI),true)
FLAGSUF = .multi
Expand Down
2 changes: 1 addition & 1 deletion components/ocmcli/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ helper:
input:
type: (( bool(values.MULTI) ? "dockermulti" :"docker" ))
repository: (( index(values.IMAGE, ":") >= 0 ? substr(values.IMAGE,0,index(values.IMAGE,":")) :values.IMAGE ))
variants: (( bool(values.MULTI) ? map[split(" ", values.PLATFORMS)|v|-> values.IMAGE "-" replace(v,"/","-")] :~~ ))
variants: (( bool(values.MULTI) ? map[split(" ", values.IMAGE_PLATFORMS)|v|-> values.IMAGE "-" replace(v,"/","-")] :~~ ))
path: (( !bool(values.MULTI) ? values.IMAGE :~~ ))


Expand Down
8 changes: 8 additions & 0 deletions docs/pluginreference/plugin_accessmethod_compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,36 @@ The following predefined option types can be used:
- <code>accessRegistry</code>: [*string*] registry base URL
- <code>accessRepository</code>: [*string*] repository URL
- <code>accessVersion</code>: [*string*] version for access specification
- <code>body</code>: [*string*] body of a http request
- <code>bucket</code>: [*string*] bucket name
- <code>comment</code>: [*string*] comment field value
- <code>commit</code>: [*string*] git commit id
- <code>digest</code>: [*string*] blob digest
- <code>globalAccess</code>: [*map[string]YAML*] access specification for global access
- <code>header</code>: [*string:string,string*] http headers
- <code>hint</code>: [*string*] (repository) hint for local artifacts
- <code>mediaType</code>: [*string*] media type for artifact blob representation
- <code>noredirect</code>: [*bool*] http redirect behavior
- <code>reference</code>: [*string*] reference name
- <code>region</code>: [*string*] region name
- <code>size</code>: [*int*] blob size
- <code>url</code>: [*string*] artifact or server url
- <code>verb</code>: [*string*] http request method

The following predefined value types are supported:


- <code>YAML</code>: JSON or YAML document string
- <code>[]byte</code>: byte value
- <code>[]string</code>: list of string values
- <code>bool</code>: boolean flag
- <code>int</code>: integer value
- <code>map[string]YAML</code>: JSON or YAML map
- <code>string</code>: string value
- <code>string:string,string</code>: string map defined by dedicated assignment of comma separated strings
- <code>string=YAML</code>: string map with arbitrary values defined by dedicated assignments
- <code>string=string</code>: string map defined by dedicated assignments
- <code>string=string,string</code>: string map defined by dedicated assignment of comma separated strings

### SEE ALSO

Expand Down
8 changes: 8 additions & 0 deletions docs/pluginreference/plugin_descriptor.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,28 +125,36 @@ The following predefined option types can be used:
- <code>accessRegistry</code>: [*string*] registry base URL
- <code>accessRepository</code>: [*string*] repository URL
- <code>accessVersion</code>: [*string*] version for access specification
- <code>body</code>: [*string*] body of a http request
- <code>bucket</code>: [*string*] bucket name
- <code>comment</code>: [*string*] comment field value
- <code>commit</code>: [*string*] git commit id
- <code>digest</code>: [*string*] blob digest
- <code>globalAccess</code>: [*map[string]YAML*] access specification for global access
- <code>header</code>: [*string:string,string*] http headers
- <code>hint</code>: [*string*] (repository) hint for local artifacts
- <code>mediaType</code>: [*string*] media type for artifact blob representation
- <code>noredirect</code>: [*bool*] http redirect behavior
- <code>reference</code>: [*string*] reference name
- <code>region</code>: [*string*] region name
- <code>size</code>: [*int*] blob size
- <code>url</code>: [*string*] artifact or server url
- <code>verb</code>: [*string*] http request method

The following predefined value types are supported:


- <code>YAML</code>: JSON or YAML document string
- <code>[]byte</code>: byte value
- <code>[]string</code>: list of string values
- <code>bool</code>: boolean flag
- <code>int</code>: integer value
- <code>map[string]YAML</code>: JSON or YAML map
- <code>string</code>: string value
- <code>string:string,string</code>: string map defined by dedicated assignment of comma separated strings
- <code>string=YAML</code>: string map with arbitrary values defined by dedicated assignments
- <code>string=string</code>: string map defined by dedicated assignments
- <code>string=string,string</code>: string map defined by dedicated assignment of comma separated strings

#### Uploader Descriptor

Expand Down
8 changes: 8 additions & 0 deletions docs/pluginreference/plugin_valueset_compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,36 @@ The following predefined option types can be used:
- <code>accessRegistry</code>: [*string*] registry base URL
- <code>accessRepository</code>: [*string*] repository URL
- <code>accessVersion</code>: [*string*] version for access specification
- <code>body</code>: [*string*] body of a http request
- <code>bucket</code>: [*string*] bucket name
- <code>comment</code>: [*string*] comment field value
- <code>commit</code>: [*string*] git commit id
- <code>digest</code>: [*string*] blob digest
- <code>globalAccess</code>: [*map[string]YAML*] access specification for global access
- <code>header</code>: [*string:string,string*] http headers
- <code>hint</code>: [*string*] (repository) hint for local artifacts
- <code>mediaType</code>: [*string*] media type for artifact blob representation
- <code>noredirect</code>: [*bool*] http redirect behavior
- <code>reference</code>: [*string*] reference name
- <code>region</code>: [*string*] region name
- <code>size</code>: [*int*] blob size
- <code>url</code>: [*string*] artifact or server url
- <code>verb</code>: [*string*] http request method

The following predefined value types are supported:


- <code>YAML</code>: JSON or YAML document string
- <code>[]byte</code>: byte value
- <code>[]string</code>: list of string values
- <code>bool</code>: boolean flag
- <code>int</code>: integer value
- <code>map[string]YAML</code>: JSON or YAML map
- <code>string</code>: string value
- <code>string:string,string</code>: string map defined by dedicated assignment of comma separated strings
- <code>string=YAML</code>: string map with arbitrary values defined by dedicated assignments
- <code>string=string</code>: string map defined by dedicated assignments
- <code>string=string,string</code>: string map defined by dedicated assignment of comma separated strings

### SEE ALSO

Expand Down
4 changes: 2 additions & 2 deletions docs/reference/ocm.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ ocm [<options>] <sub command> ...
### Description


The Open Component Model command line client support the work with OCM
The Open Component Model command line client supports the work with OCM
artifacts, like Component Archives, Common Transport Archive,
Component Repositories, and component versions.
Component Repositories, and Component Versions.

Additionally it provides some limited support for the docker daemon, OCI artifacts and
registries.
Expand Down
Loading

0 comments on commit e1a02dc

Please sign in to comment.