Skip to content

Commit

Permalink
incorporate review
Browse files Browse the repository at this point in the history
  • Loading branch information
mandelsoft committed Jul 23, 2024
1 parent 0b4414f commit 6632def
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 36 deletions.
10 changes: 6 additions & 4 deletions cmds/ocm/topics/ocm/pubsub/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ func New(ctx clictx.Context) *cobra.Command {
Short: "List of all supported publish/subscribe implementations",

Long: `
OCM repositories can be configured to generate change events for
publish/subscribe systems, if there is a persistence provider
for the dedicated kind of OCM repository (for example OCI registry
based OCM repositories)
An OCM repository can be configured to propagate change events via a
publish/subscribe system, if there is a persistence provider for the dedicated
repository type. If available any known publish/subscribe system can
be configured with <CMD>ocm set pubsub</CMD> and shown with
<CMD>ocm get pubsub</CMD>. Hereby, the pub/sub system
is described by a typed specification.
` + pubsub.PubSubUsage(attr.TypeScheme, attr.ProviderRegistry, true),
}
Expand Down
11 changes: 8 additions & 3 deletions docs/reference/ocm_credential-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,18 @@ The following credential consumer types are used/supported:
- <code>key</code>: secret key use to access the credential server


- <code>Github</code>: GitHub credential matcher
- <code>Github</code>: Redis PubSub credential matcher

This matcher is a hostpath matcher with additional attributes:

- *<code>channel</code>* (required if set in pattern): the channel name
- *<code>database</code>* the database number

This matcher is a hostpath matcher.

Credential consumers of the consumer type Github evaluate the following credential properties:

- <code>token</code>: GitHub personal access token
- <code>username</code>: Redis username
- <code>password</code>: Redis password


- <code>HashiCorpVault</code>: HashiCorp Vault credential matcher
Expand Down
11 changes: 8 additions & 3 deletions docs/reference/ocm_get_credentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,18 @@ Matchers exist for the following usage contexts or consumer types:
- <code>key</code>: secret key use to access the credential server


- <code>Github</code>: GitHub credential matcher
- <code>Github</code>: Redis PubSub credential matcher

This matcher is a hostpath matcher with additional attributes:

- *<code>channel</code>* (required if set in pattern): the channel name
- *<code>database</code>* the database number

This matcher is a hostpath matcher.

Credential consumers of the consumer type Github evaluate the following credential properties:

- <code>token</code>: GitHub personal access token
- <code>username</code>: Redis username
- <code>password</code>: Redis password


- <code>HashiCorpVault</code>: HashiCorp Vault credential matcher
Expand Down
32 changes: 23 additions & 9 deletions docs/reference/ocm_ocm-pubsub.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@
### Description


OCM repositories can be configured to generate change events for
publish/subscribe systems, if there is a persistence provider
for the dedicated kind of OCM repository (for example OCI registry
based OCM repositories)


An OCM repository can be configured to propagate change events via a
publish/subscribe system, if there is a persistence provider for the dedicated
repository type. If available any know publish/subscribe system can
repository type. If available any known publish/subscribe system can
be configured with [ocm set pubsub](ocm_set_pubsub.md) and shown with
[ocm get pubsub](ocm_get_pubsub.md).. Hereby, the pub/sub system
[ocm get pubsub](ocm_get_pubsub.md). Hereby, the pub/sub system
is described by a typed specification.


The following list describes the supported publish/subscribe system types, their
specificaton versions and formats:
specification versions, and formats:

- PubSub type <code>compound</code>

Expand All @@ -33,6 +28,25 @@ specificaton versions and formats:
A list of nested sub-level specifications the events should be
forwarded to.


- PubSub type <code>redis</code>

a redis pubsub sytsem.

The following versions are supported:
- Version <code>v1</code>

It is describe by the following field:

- **<code>serverAddr</code>** *Address of redis server*
- **<code>channel</code>** *pubsub channel*
- **<code>database</code>** *database number*

Publishing using the redis pubsub API. For every change a string message
with the format <component>:<version> is published. If multiple repositories
should be used, each repository should be configured with a different
channel.

There are persistence providers for the following repository types:
- <code>OCIRegistry</code>

Expand Down
14 changes: 7 additions & 7 deletions examples/lib/tour/01-getting-started/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,32 +164,32 @@ differ, because the code always describes the latest version):

```
resources of the latest version:
version: 0.11.0
version: 0.12.0
provider: ocm.software
1: name: ocmcli
extra identity: "architecture"="amd64","os"="linux"
resource type: executable
access: Local blob sha256:28c39f8c1623d50398e916494582ebdeaf608dd8e27d112d01625bb903b95ecf[]
access: Local blob sha256:4a3e2f2069f428e237ca7cd21d9f525ac527cde92f4ae0f797697727d5e059f9[]
2: name: ocmcli
extra identity: "architecture"="arm64","os"="linux"
resource type: executable
access: Local blob sha256:c9f1eb5ba391e0cfe1c84e34d8b7e9923b061e5917c12c73e21f6a4d300813d8[]
access: Local blob sha256:b99a50553fdf100ec449dbfd3e822de8d5051e83070d37a3046703003ccba1db[]
3: name: ocmcli
extra identity: "architecture"="arm64","os"="darwin"
resource type: executable
access: Local blob sha256:8dafc347d7129d3ff3b4f54cc9d82d8852980dc38e778c96aa82b16d1ddb4288[]
access: Local blob sha256:01f913684ca0b01ac0c93e5cee98e6d3a29e908b88761a0c869b39ae8971b538[]
4: name: ocmcli
extra identity: "architecture"="amd64","os"="darwin"
resource type: executable
access: Local blob sha256:611d693ec021a2c6001d515c3d896ac769beab39de4f859d9a7bc0bcdba10f3e[]
access: Local blob sha256:ad5391320eb2662f84dbae676fb0963eb3925b0f76d966a71a89795bbac529a8[]
5: name: ocmcli
extra identity: "architecture"="amd64","os"="windows"
resource type: executable
access: Local blob sha256:884d76b98fe37c0fdb0a9d1f3707eb98e6bfc0385658ba4f6890b2de75fb331e[]
access: Local blob sha256:71ed95abd178112489f32cddeea377d2703ad6213f54a3486741f48483cd4391[]
6: name: ocmcli-image
extra identity:
resource type: ociImage
access: OCI artifact ghcr.io/open-component-model/ocm/ocm.software/ocmcli/ocmcli-image:0.11.0
access: OCI artifact ghcr.io/open-component-model/ocm/ocm.software/ocmcli/ocmcli-image:0.12.0
```

Resources have some metadata, like their identity and a resource type.
Expand Down
2 changes: 2 additions & 0 deletions pkg/contexts/ocm/pubsub/providers/ocireg/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ func (p *Provider) SetPubSubSpec(repo cpi.Repository, spec pubsub.PubSubSpec) er
}

blob := blobaccess.ForData(PubSubLayerMimeTye, data)
defer blob.Close()

layers := m.GetDescriptor().Layers
for i := 0; i < len(layers); i++ {
l := layers[i]
Expand Down
2 changes: 1 addition & 1 deletion pkg/contexts/ocm/pubsub/types/compound/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (s *Spec) Unwrap(ctx cpi.Context) []pubsub.PubSubSpec {
}

func (s *Spec) Describe(_ cpi.Context) string {
return fmt.Sprintf("compound pub/sub specification with %d emtries", len(s.Specifications))
return fmt.Sprintf("compound pub/sub specification with %d entries", len(s.Specifications))
}

func (s *Spec) Effective() pubsub.PubSubSpec {
Expand Down
2 changes: 1 addition & 1 deletion pkg/contexts/ocm/pubsub/types/redis/identity/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"

"github.com/mandelsoft/goutils/errors"

"github.com/open-component-model/ocm/pkg/contexts/credentials/cpi"
"github.com/open-component-model/ocm/pkg/contexts/credentials/identity/hostpath"
"github.com/open-component-model/ocm/pkg/listformat"
Expand Down
9 changes: 1 addition & 8 deletions pkg/contexts/ocm/pubsub/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,8 @@ func Notify(repo cpi.Repository, nv common.NameVersion) error {

func PubSubUsage(scheme TypeScheme, providers ProviderRegistry, cli bool) string {
s := `
An OCM repository can be configured to propagate change events via a
publish/subscribe system, if there is a persistence provider for the dedicated
repository type. If available any know publish/subscribe system can
be configured with <CMD>ocm set pubsub</CMD> and shown with
<CMD>ocm get pubsub</CMD>.. Hereby, the pub/sub system
is described by a typed specification.
The following list describes the supported publish/subscribe system types, their
specificaton versions and formats:
specification versions, and formats:
`
if len(scheme.KnownTypes()) == 0 {
s += "There are currently no known pub/sub types!"
Expand Down

0 comments on commit 6632def

Please sign in to comment.