Skip to content

Commit

Permalink
refactor: remove internal/runkit
Browse files Browse the repository at this point in the history
Put everything under exported runkit package

Signed-off-by: Yves Brissaud <[email protected]>
  • Loading branch information
eunomie committed Oct 10, 2024
1 parent 2adfd76 commit 306d155
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions runkit/decorate.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/google/go-containerregistry/pkg/v1/types"

"github.com/eunomie/docker-runx/internal/registry"
"github.com/eunomie/docker-runx/internal/runkit"
)

func Decorate(ctx context.Context, src, dest string, runxConfig, runxDoc []byte) error {
Expand All @@ -23,7 +22,7 @@ func Decorate(ctx context.Context, src, dest string, runxConfig, runxDoc []byte)
remoteOpts = registry.WithOptions(ctx, nil)
ref, _ = name.ParseReference(src)
destRef, _ = name.ParseReference(dest)
runxImage, runxDesc, err = runkit.Image(runxConfig, runxDoc)
runxImage, runxDesc, err = Image(runxConfig, runxDoc)
)

if err != nil {
Expand Down Expand Up @@ -78,7 +77,7 @@ func Decorate(ctx context.Context, src, dest string, runxConfig, runxDoc []byte)
// remove existing runx manifest
manifests, _ := index.IndexManifest()
for _, manifest := range manifests.Manifests {
if _, ok := manifest.Annotations[runkit.RunxManifestType]; ok {
if _, ok := manifest.Annotations[RunxManifestType]; ok {
index = mutate.RemoveManifests(index, match.Digests(manifest.Digest))
}
}
Expand Down
File renamed without changes.
7 changes: 3 additions & 4 deletions runkit/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"gopkg.in/yaml.v3"

"github.com/eunomie/docker-runx/internal/registry"
"github.com/eunomie/docker-runx/internal/runkit"
)

type Files struct {
Expand Down Expand Up @@ -60,7 +59,7 @@ func Get(ctx context.Context, src string) (*RunKit, error) {
found := false
manifests, _ := index.IndexManifest()
for _, m := range manifests.Manifests {
if a, ok := m.Annotations[runkit.RunxAnnotation]; ok && a == runkit.RunxManifestType {
if a, ok := m.Annotations[RunxAnnotation]; ok && a == RunxManifestType {
manifest = m
found = true
break
Expand All @@ -85,7 +84,7 @@ func Get(ctx context.Context, src string) (*RunKit, error) {
if err != nil {
continue
}
if mt == runkit.RunxConfigType {
if mt == RunxConfigType {
dataReader, err := l.Uncompressed()
if err != nil {
return nil, fmt.Errorf("could not read runx config %s: %w", src, err)
Expand All @@ -94,7 +93,7 @@ func Get(ctx context.Context, src string) (*RunKit, error) {
if err != nil {
return nil, fmt.Errorf("could not read runx config %s: %w", src, err)
}
} else if mt == runkit.RunxDocType {
} else if mt == RunxDocType {
dataReader, err := l.Uncompressed()
if err != nil {
return nil, fmt.Errorf("could not read runx config %s: %w", src, err)
Expand Down

0 comments on commit 306d155

Please sign in to comment.