Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace docker with oras #904

Merged
merged 4 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
12 changes: 3 additions & 9 deletions .github/workflows/lint_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ jobs:
with:
go-version-file: '${{ github.workspace }}/go.mod'
- name: Test
run: |
PATH=$PATH:$(go env GOPATH)/bin make build install-requirements test
run: make build install-requirements test

go-lint:
name: Lint Golang
Expand All @@ -41,11 +40,6 @@ jobs:
with:
go-version-file: '${{ github.workspace }}/go.mod'
- name: Install goimports
run: |
go install golang.org/x/tools/cmd/goimports@latest
- name: Setup lint
run: |
make -f hack/Makefile golangci-lint
run: go install golang.org/x/tools/cmd/goimports@latest
- name: Lint
run: |
PATH=$PATH:$(go env GOPATH)/bin make check
run: make check
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ format:
@$(REPO_ROOT)/hack/format.sh $(EFFECTIVE_DIRECTORIES)

.PHONY: check
check:
@$(REPO_ROOT)/hack/check.sh --golangci-lint-config=./.golangci.yaml $(EFFECTIVE_DIRECTORIES)
hilmarf marked this conversation as resolved.
Show resolved Hide resolved
check: ## Run golangci-lint.
make -f hack/Makefile golangci-lint
golangci-lint run --timeout 10m --config .github/config/golangci.yaml $(EFFECTIVE_DIRECTORIES)

.PHONY: check-and-fix
check-and-fix:
Expand Down
12 changes: 6 additions & 6 deletions api/credentials/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,25 +109,25 @@ func GuessConsumerType(ctxp ContextProvider, spec string) string {
}
}
if fix == "" {
min := -1
minVal := -1
mandelsoft marked this conversation as resolved.
Show resolved Hide resolved
for _, i := range matchers.List() {
idx := strings.Index(i.Type, ".")
if idx > 0 {
d := levenshtein.DistanceForStrings([]rune(lspec), []rune(strings.ToLower(i.Type[:idx])), levenshtein.DefaultOptions)
if d < 5 && fix == "" || min > d {
if d < 5 && fix == "" || minVal > d {
fix = i.Type
min = d
minVal = d
}
}
}
}
if fix == "" {
min := -1
minVal := -1
for _, i := range matchers.List() {
d := levenshtein.DistanceForStrings([]rune(lspec), []rune(strings.ToLower(i.Type)), levenshtein.DefaultOptions)
if d < 5 && fix == "" || min > d {
if d < 5 && fix == "" || minVal > d {
fix = i.Type
min = d
minVal = d
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion api/oci/cpi/support/artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func (a *ArtifactAccessImpl) ManifestAccess(v cpi.ArtifactAccess) internal.Manif
return nil
}
}

return NewManifestForArtifact(v, a)
}

Expand Down Expand Up @@ -177,7 +178,7 @@ func (a *ArtifactAccessImpl) GetBlob(digest digest.Digest) (cpi.BlobAccess, erro
if d != nil {
size, data, err := a.container.GetBlobData(digest)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to get blob data for artifact access with digest %s: %w", digest.String(), err)
}
err = AdjustSize(d, size)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion api/oci/extensions/repositories/docker/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (a *artBlobCache) Unref() error {
func (a *artBlobCache) GetBlobData(digest digest.Digest) (int64, blobaccess.DataAccess, error) {
blob, err := a.access.GetBlob(digest)
if err != nil {
return -1, nil, err
return -1, nil, fmt.Errorf("error getting blob for docker repo %s: %w", digest, err)
}
return blob.Size(), blob, err
}
Expand Down
109 changes: 0 additions & 109 deletions api/oci/extensions/repositories/ocireg/blobs.go

This file was deleted.

Loading