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

bump: tag and release ORAS CLI v1.1.0-rc.2 #1076

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ef6e022
bump: tag and release ORAS CLI v1.1.0-rc.1 (#1016)
qweeah Jul 11, 2023
5194c2e
chore: fix lint warning (#1001)
kranurag7 Jul 11, 2023
46780e7
chore: fix the links in project readme (#1012)
amands98 Jul 12, 2023
ed3fbcc
chore: update container build prepare job output in Github Actions (#…
qweeah Jul 12, 2023
21d0b71
test: add unit test for error scenario in `internal/credential/store.…
enraiha0307 Jul 12, 2023
3092656
chore: use golangci lint (#986)
kranurag7 Jul 13, 2023
a1d0764
fix: correct e2e specs and CI check configuration (#1023)
qweeah Jul 18, 2023
4b9ffea
workflow: add github stale action (#1024)
sajayantony Jul 20, 2023
9260209
fix: move stale into .github/workflows (#1031)
sajayantony Jul 22, 2023
41cb0c8
build(deps): bump github.com/onsi/gomega from 1.27.8 to 1.27.10 in /t…
dependabot[bot] Jul 25, 2023
0b6651a
chore: improving error log for `oras push` and `oras attach` when the…
1Shubham7 Jul 27, 2023
e6b9a44
chore: exempt stale if milestone is set (#1036)
qweeah Jul 27, 2023
dcc112b
chore: add triage labels (#1055)
FeynmanZhou Aug 8, 2023
ceb56f8
chore: make error returned by `oras tag` more readable (#1058)
qweeah Aug 9, 2023
91db018
revert: "feat: add flag to skip deleting obsolete referrers index" (#…
qweeah Aug 9, 2023
fda8425
feat: disable referrers index GC by default (#1059)
qweeah Aug 9, 2023
0e2e0f3
build(deps): bump golang.org/x/term from 0.10.0 to 0.11.0 (#1051)
dependabot[bot] Aug 10, 2023
30abae3
feat: pack OCI image spec v1.1 manifests (#1054)
qweeah Aug 18, 2023
742b044
bump: use new packing function in oras-go (#1070)
qweeah Aug 22, 2023
6319416
feat: support warning in remote targets (#1057)
qweeah Aug 23, 2023
49f58ab
chore: align naming of pack option to oras-go (#1073)
qweeah Aug 24, 2023
08a1a9f
bump: update golang to 1.21 (#1074)
qweeah Aug 24, 2023
b848c93
build(deps): bump github.com/onsi/ginkgo/v2 from 2.11.0 to 2.12.0 in …
dependabot[bot] Aug 24, 2023
443242e
bump: tag and release ORAS CLI v1.1.0-rc.2
qweeah Aug 24, 2023
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
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

name: Bug Report
description: File a bug report
labels: [bug]
labels: [bug, triage]
body:
- type: markdown
id: preface
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

name: Feature Request
description: File a feature request
labels: [enhancement]
labels: [enhancement, triage]
body:
- type: markdown
id: preface
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.20']
go-version: ['1.21']
fail-fast: true
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
security-events: write
strategy:
matrix:
go-version: ['1.20']
go-version: ['1.21']
fail-fast: false
steps:
- name: Checkout repository
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright The ORAS Authors.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: golangci-lint

on:
pull_request:
paths-ignore:
- 'docs/**'

permissions:
contents: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.21']
fail-fast: true
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
check-latest: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
3 changes: 1 addition & 2 deletions .github/workflows/release-ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ jobs:
if [[ "${VERSION}" == "${BRANCH_NAME}" ]]; then
VERSION=$(git rev-parse --short HEAD)
fi
echo ::set-output name=version::${VERSION}
echo ::set-output name=ref::ghcr.io/${{ github.repository }}:${VERSION}
echo "ref=ghcr.io/${{ github.repository }}:${VERSION}" >> $GITHUB_OUTPUT
- name: docker login
uses: docker/login-action@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: setup go environment
uses: actions/setup-go@v3
with:
go-version: '1.20.5'
go-version: '1.21.0'
- name: run goreleaser
uses: goreleaser/goreleaser-action@v2
with:
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright The ORAS Authors.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: "Close stale issues and PRs"
on:
schedule:
- cron: "30 1 * * *"

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v8
with:
stale-issue-message: "This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days."
stale-pr-message: "This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 30 days."
close-issue-message: "This issue was closed because it has been stalled for 30 days with no activity."
close-pr-message: "This PR was closed because it has been stalled for 30 days with no activity."
days-before-issue-stale: 60
days-before-pr-stale: 45
days-before-issue-close: 30
days-before-pr-close: 30
exempt-all-milestones: true
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Contributing

Please refer to the [ORAS Contributing guide](https://oras.land/docs/contributing).
Please refer to the [ORAS Contributing guide](https://oras.land/docs/community/contributing_guide).
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.20.5-alpine as builder
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.21.0-alpine as builder
ARG TARGETPLATFORM
RUN apk add git make
ENV ORASPKG /oras
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ teste2e-covdata: ## test e2e coverage
export GOCOVERDIR=$(CURDIR)/test/e2e/.cover; \
rm -rf $$GOCOVERDIR; \
mkdir -p $$GOCOVERDIR; \
$(MAKE) teste2e; \
$(GO_EXE) tool covdata textfmt -i=$$GOCOVERDIR -o "$(CURDIR)/test/e2e/coverage.txt"
$(MAKE) teste2e && $(GO_EXE) tool covdata textfmt -i=$$GOCOVERDIR -o "$(CURDIR)/test/e2e/coverage.txt"

.PHONY: help
help: ## Display this help
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
## Docs

Documentation for the ORAS CLI is located on
the project website: [oras.land/cli](https://oras.land/docs/category/cli)
the project website: [oras.land/cli](https://oras.land/docs/category/oras-commands)

## Development Environment Setup

Refer to the [development guide](https://oras.land/docs/CLI/developer_guide) to get started [contributing to ORAS](https://oras.land/docs/contributing).
Refer to the [development guide](https://oras.land/docs/community/developer_guide) to get started [contributing to ORAS](https://oras.land/docs/community/contributing_guide).

## Code of Conduct

Expand Down
5 changes: 3 additions & 2 deletions cmd/oras/internal/display/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (p *tagManifestStatusForRepo) PushReference(ctx context.Context, expected o
if p.printHint != nil {
p.printHint.Do(func() {
ref := p.refPrefix + "@" + expected.Digest.String()
Print("Tagging", ref)
_ = Print("Tagging", ref)
})
}
if err := p.Repository.PushReference(ctx, expected, content, reference); err != nil {
Expand All @@ -136,9 +136,10 @@ func (p *tagManifestStatusForTarget) Tag(ctx context.Context, desc ocispec.Descr
if p.printHint != nil {
p.printHint.Do(func() {
ref := p.refPrefix + "@" + desc.Digest.String()
Print("Tagging", ref)
_ = Print("Tagging", ref)
})
}

if err := p.Target.Tag(ctx, desc, reference); err != nil {
return err
}
Expand Down
8 changes: 0 additions & 8 deletions cmd/oras/internal/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ limitations under the License.
package errors

import (
"errors"
"fmt"

"oras.land/oras-go/v2/registry"
"oras.land/oras-go/v2/registry/remote"
)

// NewErrInvalidReference creates a new error based on the reference string.
Expand All @@ -32,9 +30,3 @@ func NewErrInvalidReference(ref registry.Reference) error {
func NewErrInvalidReferenceStr(ref string) error {
return fmt.Errorf("%s: invalid image reference, expecting <name:tag|name@digest>", ref)
}

// IsReferrersIndexDelete checks if err is a referrers index delete error.
func IsReferrersIndexDelete(err error) bool {
var re *remote.ReferrersError
return errors.As(err, &re) && re.IsReferrersIndexDelete()
}
2 changes: 1 addition & 1 deletion cmd/oras/internal/option/applier.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type FlagApplier interface {
// NOTE: The option argument need to be a pointer to the options, so its value
// becomes addressable.
func ApplyFlags(optsPtr interface{}, target *pflag.FlagSet) {
rangeFields(optsPtr, func(fa FlagApplier) error {
_ = rangeFields(optsPtr, func(fa FlagApplier) error {
fa.ApplyFlags(target)
return nil
})
Expand Down
8 changes: 7 additions & 1 deletion cmd/oras/internal/option/packer.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,13 @@ func (opts *Packer) LoadManifestAnnotations() (annotations map[string]map[string
}
if opts.AnnotationFilePath != "" {
if err = decodeJSON(opts.AnnotationFilePath, &annotations); err != nil {
return nil, err
errStr := err.Error()
docLink := " Please refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations."
if !strings.HasSuffix(errStr, ".") {
docLink = "."+docLink
}
return nil, fmt.Errorf("failed to load annotations from %s: %w" +
docLink, opts.AnnotationFilePath, err)
}
}
if len(opts.ManifestAnnotations) != 0 {
Expand Down
16 changes: 10 additions & 6 deletions cmd/oras/internal/option/packer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ func TestPacker_LoadManifestAnnotations_err(t *testing.T) {

func TestPacker_LoadManifestAnnotations_annotationFile(t *testing.T) {
testFile := filepath.Join(t.TempDir(), "testAnnotationFile")
os.WriteFile(testFile, []byte(testContent), fs.ModePerm)
err := os.WriteFile(testFile, []byte(testContent), fs.ModePerm)
if err != nil {
t.Fatalf("Error writing %s: %v", testFile, err)
}
opts := Packer{AnnotationFilePath: testFile}

anno, err := opts.LoadManifestAnnotations()
Expand Down Expand Up @@ -120,11 +123,12 @@ func TestPacker_LoadManifestAnnotations_annotationFlag(t *testing.T) {
t.Fatalf("unexpected error: failed when looking for '$manifest' in annotations")
}
if !reflect.DeepEqual(annotations,
map[string]map[string]string{"$manifest": {
"Key0": "",
"Key1": "Val",
"Key2": "${env:USERNAME}",
},
map[string]map[string]string{
"$manifest": {
"Key0": "",
"Key1": "Val",
"Key2": "${env:USERNAME}",
},
}) {
t.Fatalf("unexpected error: %v", errors.New("content not match"))
}
Expand Down
42 changes: 0 additions & 42 deletions cmd/oras/internal/option/referrers.go

This file was deleted.

45 changes: 35 additions & 10 deletions cmd/oras/internal/option/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ import (
"os"
"strconv"
"strings"
"sync"

credentials "github.com/oras-project/oras-credentials-go"
"github.com/sirupsen/logrus"
"github.com/spf13/pflag"
"oras.land/oras-go/v2/registry/remote"
"oras.land/oras-go/v2/registry/remote/auth"
Expand All @@ -53,6 +55,7 @@ type Remote struct {
distributionSpec distributionSpec
headerFlags []string
headers http.Header
warned map[string]*sync.Map
}

// EnableDistributionSpecFlag set distribution specification flag as applicable.
Expand Down Expand Up @@ -247,33 +250,55 @@ func (opts *Remote) Credential() auth.Credential {
return credential.Credential(opts.Username, opts.Password)
}

func (opts *Remote) handleWarning(registry string, logger logrus.FieldLogger) func(warning remote.Warning) {
if opts.warned == nil {
opts.warned = make(map[string]*sync.Map)
}
warned := opts.warned[registry]
if warned == nil {
warned = &sync.Map{}
opts.warned[registry] = warned
}
logger = logger.WithField("registry", registry)
return func(warning remote.Warning) {
if _, loaded := warned.LoadOrStore(warning.WarningValue, struct{}{}); !loaded {
logger.Warn(warning.Text)
}
}
}

// NewRegistry assembles a oras remote registry.
func (opts *Remote) NewRegistry(hostname string, common Common) (reg *remote.Registry, err error) {
reg, err = remote.NewRegistry(hostname)
func (opts *Remote) NewRegistry(registry string, common Common, logger logrus.FieldLogger) (reg *remote.Registry, err error) {
reg, err = remote.NewRegistry(registry)
if err != nil {
return nil, err
}
hostname = reg.Reference.Registry
reg.PlainHTTP = opts.isPlainHttp(hostname)
if reg.Client, err = opts.authClient(hostname, common.Debug); err != nil {
registry = reg.Reference.Registry
reg.PlainHTTP = opts.isPlainHttp(registry)
reg.HandleWarning = opts.handleWarning(registry, logger)
if reg.Client, err = opts.authClient(registry, common.Debug); err != nil {
return nil, err
}
return
}

// NewRepository assembles a oras remote repository.
func (opts *Remote) NewRepository(reference string, common Common) (repo *remote.Repository, err error) {
func (opts *Remote) NewRepository(reference string, common Common, logger logrus.FieldLogger) (repo *remote.Repository, err error) {
repo, err = remote.NewRepository(reference)
if err != nil {
return nil, err
}
hostname := repo.Reference.Registry
repo.PlainHTTP = opts.isPlainHttp(hostname)
if repo.Client, err = opts.authClient(hostname, common.Debug); err != nil {
registry := repo.Reference.Registry
repo.PlainHTTP = opts.isPlainHttp(registry)
repo.HandleWarning = opts.handleWarning(registry, logger)
if repo.Client, err = opts.authClient(registry, common.Debug); err != nil {
return nil, err
}
repo.SkipReferrersGC = true
if opts.distributionSpec.referrersAPI != nil {
repo.SetReferrersCapability(*opts.distributionSpec.referrersAPI)
if err := repo.SetReferrersCapability(*opts.distributionSpec.referrersAPI); err != nil {
return nil, err
}
}
return
}
Expand Down
Loading
Loading