mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-18 10:39:18 +02:00
Kaniko version
This commit is contained in:
@@ -18,7 +18,6 @@ VERSION_MINOR ?= 11
|
||||
VERSION_BUILD ?= 0
|
||||
|
||||
VERSION ?= v$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_BUILD)
|
||||
VERSION_PACKAGE = $(REPOPATH/pkg/version)
|
||||
|
||||
SHELL := /bin/bash
|
||||
GOOS ?= $(shell go env GOOS)
|
||||
@@ -28,6 +27,7 @@ PROJECT := kaniko
|
||||
REGISTRY?=gcr.io/kaniko-project
|
||||
|
||||
REPOPATH ?= $(ORG)/$(PROJECT)
|
||||
VERSION_PACKAGE = $(REPOPATH)/pkg/version
|
||||
|
||||
GO_FILES := $(shell find . -type f -name '*.go' -not -path "./vendor/*")
|
||||
GO_LDFLAGS := '-extldflags "-static"
|
||||
|
||||
+17
-15
@@ -54,21 +54,23 @@ func init() {
|
||||
var RootCmd = &cobra.Command{
|
||||
Use: "executor",
|
||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||
if err := util.ConfigureLogging(logLevel); err != nil {
|
||||
return err
|
||||
}
|
||||
if !opts.NoPush && len(opts.Destinations) == 0 {
|
||||
return errors.New("You must provide --destination, or use --no-push")
|
||||
}
|
||||
if err := cacheFlagsValid(); err != nil {
|
||||
return errors.Wrap(err, "cache flags invalid")
|
||||
}
|
||||
if err := resolveSourceContext(); err != nil {
|
||||
return errors.Wrap(err, "error resolving source context")
|
||||
}
|
||||
if err := resolveDockerfilePath(); err != nil {
|
||||
return errors.Wrap(err, "error resolving dockerfile path")
|
||||
}
|
||||
if cmd.Use == "executor" {
|
||||
if err := util.ConfigureLogging(logLevel); err != nil {
|
||||
return err
|
||||
}
|
||||
if !opts.NoPush && len(opts.Destinations) == 0 {
|
||||
return errors.New("You must provide --destination, or use --no-push")
|
||||
}
|
||||
if err := cacheFlagsValid(); err != nil {
|
||||
return errors.Wrap(err, "cache flags invalid")
|
||||
}
|
||||
if err := resolveSourceContext(); err != nil {
|
||||
return errors.Wrap(err, "error resolving source context")
|
||||
}
|
||||
if err := resolveDockerfilePath(); err != nil {
|
||||
return errors.Wrap(err, "error resolving dockerfile path")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
},
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/version"
|
||||
)
|
||||
|
||||
func init() {
|
||||
RootCmd.AddCommand(versionCmd)
|
||||
}
|
||||
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print the version number of kaniko",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Print("Kaniko version : ", version.Version())
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user