Skip to content

Commit

Permalink
Merge pull request #505 from carvel-dev/fix-resume-on-0-33
Browse files Browse the repository at this point in the history
Fix resume on 0.33.x
  • Loading branch information
joaopapereira authored Mar 28, 2023
2 parents b2f0eec + b8060df commit 5b2c4f4
Show file tree
Hide file tree
Showing 16 changed files with 203 additions and 159 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gh-test-external-registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v1
with:
go-version: "1.19.5"
go-version: "1.19.6"
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v1
with:
go-version: "1.19.5"
go-version: "1.19.6"
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gh-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v1
with:
go-version: "1.19.5"
go-version: "1.19.6"
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
Expand All @@ -37,7 +37,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v1
with:
go-version: "1.19.5"
go-version: "1.19.6"
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v1
uses: actions/setup-go@v3
with:
go-version: "1.19.5"
- uses: actions/checkout@v2
go-version: "1.19.6"
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3
with:
version: v1.45.2
version: v1.50.1
args: -v
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19.5
go-version: 1.19.6
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@5e15885530fb01d81d1f24e8a6f54ebbd0fed7eb
if: startsWith(github.ref, 'refs/tags/')
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trivy-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
with:
repo: carvel-dev/imgpkg
tool: imgpkg
goVersion: 1.19.5
goVersion: 1.19.6
secrets:
githubToken: ${{ secrets.GITHUB_TOKEN }}
slackWebhookURL: ${{ secrets.SLACK_WEBHOOK_URL }}
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ linters:
enable:
- goheader
- revive
- deadcode
- unused
- staticcheck
- typecheck
- structcheck
- govet
disable-all: true
# all available settings of specific linters
Expand Down
2 changes: 2 additions & 0 deletions .wokeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# out of our control
vendor/
1 change: 1 addition & 0 deletions pkg/imgpkg/imagedesc/described_compressed_layer.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2020 VMware, Inc.
// SPDX-License-Identifier: Apache-2.0

// Package imagedesc defines the description of image, indexes and layers used by go-containerregistry
package imagedesc

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/imgpkg/imagedigest/imagedigest.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2020 VMware, Inc.
// SPDX-License-Identifier: Apache-2.0

// Package imagedigest utility packages to abstract the retrieval of Digests
package imagedigest

import (
Expand Down
22 changes: 17 additions & 5 deletions pkg/imgpkg/imagetar/tar_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io"
"io/ioutil"

"github.com/google/go-containerregistry/pkg/name"
v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/vmware-tanzu/carvel-imgpkg/pkg/imgpkg/imagedesc"
"github.com/vmware-tanzu/carvel-imgpkg/pkg/imgpkg/imageutils/verify"
Expand Down Expand Up @@ -49,7 +50,7 @@ func (r TarReader) PresentLayers() ([]v1.Layer, error) {
result = append(result, layers...)
} else if image.Index != nil {
idx := *image.Index
layers, err := r.presentLayersForIndex(idx)
layers, err := r.presentLayersForIndex(image.Ref(), idx)
if err != nil {
return nil, fmt.Errorf("Processing Index %s: %s", image.OrigRef, err)
}
Expand Down Expand Up @@ -96,11 +97,11 @@ func (r TarReader) presentLayersForImage(img v1.Image) ([]v1.Layer, error) {
return result, nil
}

func (r TarReader) presentLayersForIndex(idx v1.ImageIndex) ([]v1.Layer, error) {
func (r TarReader) presentLayersForIndex(indexRef string, idx v1.ImageIndex) ([]v1.Layer, error) {
var result []v1.Layer
dIdx, correct := idx.(*imagedesc.DescribedImageIndex)
dIdx, correct := idx.(imagedesc.DescribedImageIndex)
if !correct {
panic("Internal inconsistency: unexpected index type")
panic(fmt.Sprintf("Internal inconsistency: unexpected index type with ref: %s", indexRef))
}
for _, image := range dIdx.Images() {
layersPresent, err := r.presentLayersForImage(image)
Expand All @@ -109,8 +110,19 @@ func (r TarReader) presentLayersForIndex(idx v1.ImageIndex) ([]v1.Layer, error)
}
result = append(result, layersPresent...)
}

idxRef, err := name.ParseReference(indexRef)
if err != nil {
return nil, err
}

for _, idx := range dIdx.Indexes() {
layersPresent, err := r.presentLayersForIndex(idx)
digest, err := idx.Digest()
if err != nil {
return nil, err
}
idxDigest := idxRef.Context().Digest(digest.String())
layersPresent, err := r.presentLayersForIndex(idxDigest.String(), idx)
if err != nil {
return nil, err
}
Expand Down
1 change: 1 addition & 0 deletions pkg/imgpkg/internal/util/level_logger.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2020 VMware, Inc.
// SPDX-License-Identifier: Apache-2.0

// Package util contains internal utility tools used in imgpkg
package util

// LogLevel specifies logging level (i.e. DEBUG, WARN)
Expand Down
1 change: 1 addition & 0 deletions pkg/imgpkg/registry/auth/credentialprovider/keyring.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2022 VMware, Inc.
// SPDX-License-Identifier: Apache-2.0

// Package credentialprovider contains helper functions used in auth package
package credentialprovider

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/imgpkg/registry/auth/custom_keychain.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2020 VMware, Inc.
// SPDX-License-Identifier: Apache-2.0

// Package auth provides different keychains used in imgpkg
package auth

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/imgpkg/v1/describe.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2022 VMware, Inc.
// SPDX-License-Identifier: Apache-2.0

// Package v1 contains the public API version 1 used by other tools to interact with imgpkg
package v1

import (
Expand Down
Loading

0 comments on commit 5b2c4f4

Please sign in to comment.