cmd

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use: "executor",
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		if err := util.SetLogLevel(logLevel); err != nil {
			return err
		}
		if err := resolveSourceContext(); err != nil {
			return err
		}
		return checkDockerfilePath()
	},
	Run: func(cmd *cobra.Command, args []string) {
		if !checkContained() {
			if !force {
				logrus.Error("kaniko should only be run inside of a container, run with the --force flag if you are sure you want to continue.")
				os.Exit(1)
			}
			logrus.Warn("kaniko is being run outside of a container. This can have dangerous effects on your system")
		}
		if err := os.Chdir("/"); err != nil {
			logrus.Error(err)
			os.Exit(1)
		}
		image, err := executor.DoBuild(executor.KanikoBuildArgs{
			DockerfilePath: absouteDockerfilePath(),
			SrcContext:     srcContext,
			SnapshotMode:   snapshotMode,
			Args:           buildArgs,
			SingleSnapshot: singleSnapshot,
			Reproducible:   reproducible,
			Target:         target,
		})
		if err != nil {
			logrus.Error(err)
			os.Exit(1)
		}

		if err := executor.DoPush(image, destinations, tarPath); err != nil {
			logrus.Error(err)
			os.Exit(1)
		}

	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL