Skip to content

Add deprecation warning for sget CLI and packages #2019

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

Merged
merged 2 commits into from
Sep 6, 2022
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
2 changes: 1 addition & 1 deletion cmd/cosign/cli/policy_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import (

"github.com/sigstore/cosign/pkg/cosign"
cremote "github.com/sigstore/cosign/pkg/cosign/remote"
"github.com/sigstore/cosign/pkg/sget"
"github.com/sigstore/cosign/pkg/sget" //nolint:staticcheck
sigs "github.com/sigstore/cosign/pkg/signature"
signatureoptions "github.com/sigstore/sigstore/pkg/signature/options"
"github.com/sigstore/sigstore/pkg/tuf"
Expand Down
6 changes: 4 additions & 2 deletions cmd/sget/cli/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Deprecated: This package is deprecated and will be removed in a future release.
package cli

import (
Expand All @@ -24,8 +25,8 @@ import (
"github.com/spf13/cobra"
"sigs.k8s.io/release-utils/version"

"github.com/sigstore/cosign/cmd/sget/cli/options"
"github.com/sigstore/cosign/pkg/sget"
"github.com/sigstore/cosign/cmd/sget/cli/options" //nolint:staticcheck
"github.com/sigstore/cosign/pkg/sget" //nolint:staticcheck
)

var (
Expand All @@ -36,6 +37,7 @@ func New() *cobra.Command {
cmd := &cobra.Command{
Use: "sget <image reference>",
Short: "sget [--key <key reference>] <image reference>",
Long: `sget is DEPRECATED in the cosign repo -- see https://github.com/sigstore/sget for the new tool.`,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return errors.New("a single image reference is required")
Expand Down
1 change: 1 addition & 0 deletions cmd/sget/cli/options/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Deprecated: This package is deprecated and will be removed in a future release.
package options

import (
Expand Down
14 changes: 13 additions & 1 deletion cmd/sget/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import (
"log"
"os"
"strings"
"time"

"github.com/sigstore/cosign/cmd/sget/cli"
"github.com/sigstore/cosign/cmd/sget/cli" //nolint:staticcheck

// Register the provider-specific plugins
_ "github.com/sigstore/sigstore/pkg/signature/kms/aws"
Expand All @@ -30,7 +31,18 @@ import (
_ "github.com/sigstore/sigstore/pkg/signature/kms/hashivault"
)

const deprecationWarning = `
-------- NOTICE --------
The sget tool in the cosign repo is deprecated, and will be removed in a future release.

If you're interested in fetching content from an OCI registry or from an arbitrary URLs, please see: https://github.com/sigstore/sget.
------------------------
`

func main() {
log.Print(deprecationWarning)
time.Sleep(3 * time.Second)

// Fix up flags to POSIX standard flags.
for i, arg := range os.Args {
if (strings.HasPrefix(arg, "-") && len(arg) == 2) || (strings.HasPrefix(arg, "--") && len(arg) >= 4) {
Expand Down
1 change: 1 addition & 0 deletions pkg/sget/sget.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Deprecated: This package is deprecated and will be removed in a future release.
package sget

import (
Expand Down