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

Add deprecation warning for sget CLI and packages #2019

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/cosign/cli/policy_init.go
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
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
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
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
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