From 76808e30df2b3f9ad7a7cceaebda4e7a39459727 Mon Sep 17 00:00:00 2001 From: Mengqi Yu Date: Mon, 15 Aug 2022 12:13:22 -0700 Subject: [PATCH] fix CI --- .github/workflows/go.yml | 18 +++++++++++++++--- pkg/oci/storage.go | 6 ++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index aa3a5d2709..0fefc6c0c1 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -27,6 +27,9 @@ on: - "**.md" push: +env: + GOPATH: ${{ github.workspace }}/go + jobs: build-test-linux: name: Build-test-kpt-CLI @@ -47,8 +50,11 @@ jobs: go-version: 1.18 id: go - name: Check out code into the Go module directory - uses: actions/checkout@v1 + uses: actions/checkout@v3 + with: + path: ${{ env.GOPATH }}/src/github.com/GoogleContainerTools/kpt - name: Build, Test, Lint + working-directory: ${{ env.GOPATH }}/src/github.com/GoogleContainerTools/kpt run: | git config --global user.email you@example.com git config --global user.name Your Name @@ -66,8 +72,11 @@ jobs: go-version: 1.18 id: go - name: Check out code into the Go module directory - uses: actions/checkout@v1 + uses: actions/checkout@v3 + with: + path: ${{ env.GOPATH }}/src/github.com/GoogleContainerTools/kpt - name: Build + working-directory: ${{ env.GOPATH }}/src/github.com/GoogleContainerTools/kpt run: | make build @@ -80,7 +89,10 @@ jobs: go-version: 1.18 id: go - name: Check out code into the Go module directory - uses: actions/checkout@v1 + uses: actions/checkout@v3 + with: + path: ${{ env.GOPATH }}/src/github.com/GoogleContainerTools/kpt - name: Build + working-directory: ${{ env.GOPATH }}/src/github.com/GoogleContainerTools/kpt run: | make build diff --git a/pkg/oci/storage.go b/pkg/oci/storage.go index bdb6f8df11..3af6e32d0a 100644 --- a/pkg/oci/storage.go +++ b/pkg/oci/storage.go @@ -137,7 +137,7 @@ func (r *Storage) ToRemoteImage(ctx context.Context, imageName imageName) (v1.Im return nil, err } // TODO: Can we use a digest to save a lookup? - //imageRef = imageRef.Context().Digest(digest) + // imageRef = imageRef.Context().Digest(digest) ociImage, err := remote.Image(imageRef, options...) if err != nil { @@ -163,9 +163,7 @@ func withCacheFile(cacheFilePath string, fetcher func() (io.ReadCloser, error)) f, err := os.Open(cacheFilePath) if err != nil { - if errors.Is(err, fs.ErrNotExist) { - f = nil - } else { + if !errors.Is(err, fs.ErrNotExist) { return nil, fmt.Errorf("error opening cache file %q: %w", cacheFilePath, err) } } else {