2019-04-24 17:22:13 +02:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/coredns/deployment/kubernetes/migration"
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
// NewReleasedCmd represents the released command
|
|
|
|
func NewReleasedCmd() *cobra.Command {
|
|
|
|
releasedCmd := &cobra.Command{
|
|
|
|
Use: "released",
|
2019-05-01 16:43:24 +02:00
|
|
|
Short: "Determines whether your Docker Image SHA of a CoreDNS release is valid or not",
|
2019-04-24 17:22:13 +02:00
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
2019-05-01 16:43:24 +02:00
|
|
|
image, _ := cmd.Flags().GetString("dockerImageSHA")
|
2019-04-24 17:22:13 +02:00
|
|
|
result := migration.Released(image)
|
|
|
|
|
|
|
|
if result {
|
2019-05-01 16:43:24 +02:00
|
|
|
fmt.Println("The docker image SHA is valid")
|
2019-04-24 17:22:13 +02:00
|
|
|
} else {
|
2019-05-01 16:43:24 +02:00
|
|
|
fmt.Println("The docker image SHA is invalid")
|
2019-04-24 17:22:13 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2019-05-01 16:43:24 +02:00
|
|
|
releasedCmd.Flags().String("dockerImageSHA", "", "Required: The docker image SHA you want to check. ")
|
|
|
|
releasedCmd.MarkFlagRequired("dockerImageSHA")
|
2019-04-24 17:22:13 +02:00
|
|
|
|
|
|
|
return releasedCmd
|
|
|
|
}
|