From 2de9ec8476df8def3f1c0d9f38681d3b835d3489 Mon Sep 17 00:00:00 2001 From: 1Shubham7 Date: Wed, 19 Jul 2023 11:43:41 +0530 Subject: [PATCH 01/10] wrapped the returned error with filepath and adding link Signed-off-by: Shubham Singh --- cmd/oras/internal/option/packer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/oras/internal/option/packer.go b/cmd/oras/internal/option/packer.go index d32fa62de..1f8f0c0fc 100644 --- a/cmd/oras/internal/option/packer.go +++ b/cmd/oras/internal/option/packer.go @@ -99,7 +99,8 @@ func (opts *Packer) LoadManifestAnnotations() (annotations map[string]map[string } if opts.AnnotationFilePath != "" { if err = decodeJSON(opts.AnnotationFilePath, &annotations); err != nil { - return nil, err + return nil, fmt.Errorf("error loading manifest annotations from file %s: %w, + Refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations ", opts.AnnotationFilePath, err) } } if len(opts.ManifestAnnotations) != 0 { From 2a28f92b039a3eb51882212583e46311c0af74d5 Mon Sep 17 00:00:00 2001 From: 1Shubham7 Date: Thu, 20 Jul 2023 06:57:15 +0530 Subject: [PATCH 02/10] adding the changes as per billy's review Signed-off-by: Shubham Singh --- cmd/oras/internal/option/packer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/oras/internal/option/packer.go b/cmd/oras/internal/option/packer.go index 1f8f0c0fc..af28ba3a3 100644 --- a/cmd/oras/internal/option/packer.go +++ b/cmd/oras/internal/option/packer.go @@ -100,8 +100,9 @@ func (opts *Packer) LoadManifestAnnotations() (annotations map[string]map[string if opts.AnnotationFilePath != "" { if err = decodeJSON(opts.AnnotationFilePath, &annotations); err != nil { return nil, fmt.Errorf("error loading manifest annotations from file %s: %w, - Refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations ", opts.AnnotationFilePath, err) + refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations", opts.AnnotationFilePath, err) } + } if len(opts.ManifestAnnotations) != 0 { annotations = make(map[string]map[string]string) From b816bf360d4842e6fa4054249c9b60ddfc718da8 Mon Sep 17 00:00:00 2001 From: Sajay Antony Date: Thu, 20 Jul 2023 04:49:31 -0700 Subject: [PATCH 03/10] workflow: add github stale action (#1024) Signed-off-by: Sajay Antony Signed-off-by: Shubham Singh --- .github/stale.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 000000000..8d0b9f879 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,32 @@ +# 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 From c0f90ad8a5914c7a40cd409ed8b10211253590b6 Mon Sep 17 00:00:00 2001 From: Shubham Singh Date: Sat, 22 Jul 2023 12:47:39 +0530 Subject: [PATCH 04/10] 'newline in string' error resolve Signed-off-by: Shubham Singh --- cmd/oras/internal/option/packer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/oras/internal/option/packer.go b/cmd/oras/internal/option/packer.go index af28ba3a3..d42c478c2 100644 --- a/cmd/oras/internal/option/packer.go +++ b/cmd/oras/internal/option/packer.go @@ -99,8 +99,8 @@ func (opts *Packer) LoadManifestAnnotations() (annotations map[string]map[string } if opts.AnnotationFilePath != "" { if err = decodeJSON(opts.AnnotationFilePath, &annotations); err != nil { - return nil, fmt.Errorf("error loading manifest annotations from file %s: %w, - refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations", opts.AnnotationFilePath, err) + return nil, fmt.Errorf("error loading manifest annotations from file %s: %w, " + + "refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations", opts.AnnotationFilePath, err) } } From addd92fe93b977cdf2a31c991ad13ff1f5f8b4c5 Mon Sep 17 00:00:00 2001 From: Shubham Singh <116020663+1Shubham7@users.noreply.github.com> Date: Sun, 23 Jul 2023 22:32:12 +0530 Subject: [PATCH 05/10] to prevent ".," Signed-off-by: Shubham Singh <116020663+1Shubham7@users.noreply.github.com> --- cmd/oras/internal/option/packer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/oras/internal/option/packer.go b/cmd/oras/internal/option/packer.go index d42c478c2..2bc6954f4 100644 --- a/cmd/oras/internal/option/packer.go +++ b/cmd/oras/internal/option/packer.go @@ -99,7 +99,7 @@ func (opts *Packer) LoadManifestAnnotations() (annotations map[string]map[string } if opts.AnnotationFilePath != "" { if err = decodeJSON(opts.AnnotationFilePath, &annotations); err != nil { - return nil, fmt.Errorf("error loading manifest annotations from file %s: %w, " + + return nil, fmt.Errorf("error loading manifest annotations from file %s: %w " + "refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations", opts.AnnotationFilePath, err) } From ee4ebedfd74ac6783d6233ffbf89b8dd08dfa63d Mon Sep 17 00:00:00 2001 From: Shubham Singh <116020663+1Shubham7@users.noreply.github.com> Date: Mon, 24 Jul 2023 10:09:18 +0530 Subject: [PATCH 06/10] accepting changes from @qweaeh Co-authored-by: Billy Zha Signed-off-by: Shubham Singh <116020663+1Shubham7@users.noreply.github.com> --- cmd/oras/internal/option/packer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/oras/internal/option/packer.go b/cmd/oras/internal/option/packer.go index 2bc6954f4..cf3a7cdf2 100644 --- a/cmd/oras/internal/option/packer.go +++ b/cmd/oras/internal/option/packer.go @@ -99,8 +99,8 @@ func (opts *Packer) LoadManifestAnnotations() (annotations map[string]map[string } if opts.AnnotationFilePath != "" { if err = decodeJSON(opts.AnnotationFilePath, &annotations); err != nil { - return nil, fmt.Errorf("error loading manifest annotations from file %s: %w " + - "refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations", opts.AnnotationFilePath, err) + return nil, fmt.Errorf("failed to load annotations from %s: %w " + + "Please refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations", opts.AnnotationFilePath, err) } } From 90310662df6e5f18f4a6a03d6e64aeac5eddc2db Mon Sep 17 00:00:00 2001 From: Shubham Singh <116020663+1Shubham7@users.noreply.github.com> Date: Mon, 24 Jul 2023 21:14:16 +0530 Subject: [PATCH 07/10] addressing the issue of "." Signed-off-by: Shubham Singh <116020663+1Shubham7@users.noreply.github.com> --- cmd/oras/internal/option/packer.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/oras/internal/option/packer.go b/cmd/oras/internal/option/packer.go index cf3a7cdf2..3ffc7d310 100644 --- a/cmd/oras/internal/option/packer.go +++ b/cmd/oras/internal/option/packer.go @@ -99,7 +99,12 @@ func (opts *Packer) LoadManifestAnnotations() (annotations map[string]map[string } if opts.AnnotationFilePath != "" { if err = decodeJSON(opts.AnnotationFilePath, &annotations); err != nil { - return nil, fmt.Errorf("failed to load annotations from %s: %w " + + errStr := err.Error() + if !strings.HasSuffix(errStr, ".") { + return nil, fmt.Errorf("failed to load annotations from %s: %w" + + ". Please refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations", opts.AnnotationFilePath, err) + } + return nil, fmt.Errorf("failed to load annotations from %s: %w" + "Please refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations", opts.AnnotationFilePath, err) } From d2f64c2465355dd4944996650833a9c435809724 Mon Sep 17 00:00:00 2001 From: Shubham Singh <116020663+1Shubham7@users.noreply.github.com> Date: Mon, 24 Jul 2023 21:55:40 +0530 Subject: [PATCH 08/10] accepting the changes from @qweaeh Co-authored-by: Billy Zha Signed-off-by: Shubham Singh <116020663+1Shubham7@users.noreply.github.com> --- cmd/oras/internal/option/packer.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/oras/internal/option/packer.go b/cmd/oras/internal/option/packer.go index 3ffc7d310..aaaffe1c4 100644 --- a/cmd/oras/internal/option/packer.go +++ b/cmd/oras/internal/option/packer.go @@ -100,12 +100,11 @@ func (opts *Packer) LoadManifestAnnotations() (annotations map[string]map[string if opts.AnnotationFilePath != "" { if err = decodeJSON(opts.AnnotationFilePath, &annotations); err != nil { errStr := err.Error() + docLink := "Please refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations." if !strings.HasSuffix(errStr, ".") { - return nil, fmt.Errorf("failed to load annotations from %s: %w" + - ". Please refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations", opts.AnnotationFilePath, err) + docLink = ". "+docLink } - return nil, fmt.Errorf("failed to load annotations from %s: %w" + - "Please refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations", opts.AnnotationFilePath, err) + return nil, fmt.Errorf("failed to load annotations from %s: %w%s", err, docLink) } } From 07bfd6e398bdb5e62a275bf32f5a23ce4e1ac7ec Mon Sep 17 00:00:00 2001 From: Shubham Singh <116020663+1Shubham7@users.noreply.github.com> Date: Mon, 24 Jul 2023 22:19:17 +0530 Subject: [PATCH 09/10] issue solved - checks for "." and adds "." if not present Signed-off-by: Shubham Singh <116020663+1Shubham7@users.noreply.github.com> --- cmd/oras/internal/option/packer.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/oras/internal/option/packer.go b/cmd/oras/internal/option/packer.go index aaaffe1c4..4de2d69b7 100644 --- a/cmd/oras/internal/option/packer.go +++ b/cmd/oras/internal/option/packer.go @@ -100,11 +100,12 @@ func (opts *Packer) LoadManifestAnnotations() (annotations map[string]map[string if opts.AnnotationFilePath != "" { if err = decodeJSON(opts.AnnotationFilePath, &annotations); err != nil { errStr := err.Error() - docLink := "Please refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations." + docLink := " Please refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations." if !strings.HasSuffix(errStr, ".") { - docLink = ". "+docLink + docLink = "."+docLink } - return nil, fmt.Errorf("failed to load annotations from %s: %w%s", err, docLink) + return nil, fmt.Errorf("failed to load annotations from %s: %w" + + docLink, opts.AnnotationFilePath, err) } } From 0df604fecdc2233e4d1403f0596750f22995ef38 Mon Sep 17 00:00:00 2001 From: Shubham Singh <116020663+1Shubham7@users.noreply.github.com> Date: Mon, 24 Jul 2023 22:20:03 +0530 Subject: [PATCH 10/10] removed extra gap Signed-off-by: Shubham Singh <116020663+1Shubham7@users.noreply.github.com> --- cmd/oras/internal/option/packer.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/oras/internal/option/packer.go b/cmd/oras/internal/option/packer.go index 4de2d69b7..ad633dd65 100644 --- a/cmd/oras/internal/option/packer.go +++ b/cmd/oras/internal/option/packer.go @@ -107,7 +107,6 @@ func (opts *Packer) LoadManifestAnnotations() (annotations map[string]map[string return nil, fmt.Errorf("failed to load annotations from %s: %w" + docLink, opts.AnnotationFilePath, err) } - } if len(opts.ManifestAnnotations) != 0 { annotations = make(map[string]map[string]string)