|
|
@@ -113,6 +113,34 @@ buildpacks using the --builder and --attach-buildpacks flags:
|
|
|
)
|
|
|
appCmd.AddCommand(appBuildCommand)
|
|
|
|
|
|
+ appPushCommand := &cobra.Command{
|
|
|
+ Use: "push [application]",
|
|
|
+ Args: cobra.MinimumNArgs(1),
|
|
|
+ Short: "Pushes your application to a remote registry.",
|
|
|
+ Long: fmt.Sprintf(`
|
|
|
+ %s
|
|
|
+
|
|
|
+Pushes the specified app to your default Porter registry. If no tag is specified, the latest
|
|
|
+commit SHA from the current branch will be used as the tag.
|
|
|
+
|
|
|
+You can specify a tag using the --tag flag:
|
|
|
+
|
|
|
+ %s
|
|
|
+`,
|
|
|
+ color.New(color.FgBlue, color.Bold).Sprintf("Help for \"porter app push\":"),
|
|
|
+ color.New(color.FgGreen, color.Bold).Sprintf("porter app push example-app --tag v1.0.0"),
|
|
|
+ ),
|
|
|
+ RunE: func(cmd *cobra.Command, args []string) error {
|
|
|
+ return checkLoginAndRunWithConfig(cmd, cliConf, args, appPush)
|
|
|
+ },
|
|
|
+ }
|
|
|
+ appPushCommand.PersistentFlags().String(
|
|
|
+ flags.App_ImageTag,
|
|
|
+ "",
|
|
|
+ "set the image tag to use for the push",
|
|
|
+ )
|
|
|
+ appCmd.AddCommand(appPushCommand)
|
|
|
+
|
|
|
// appRunCmd represents the "porter app run" subcommand
|
|
|
appRunCmd := &cobra.Command{
|
|
|
Use: "run [application] -- COMMAND [args...]",
|
|
|
@@ -304,6 +332,31 @@ func appBuild(ctx context.Context, _ *types.GetAuthenticatedUserResponse, client
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
+func appPush(ctx context.Context, _ *types.GetAuthenticatedUserResponse, client api.Client, cliConfig config.CLIConfig, _ config.FeatureFlags, cmd *cobra.Command, args []string) error {
|
|
|
+ appName := args[0]
|
|
|
+ if appName == "" {
|
|
|
+ return fmt.Errorf("app name must be specified")
|
|
|
+ }
|
|
|
+
|
|
|
+ tag, err := cmd.Flags().GetString(flags.App_ImageTag)
|
|
|
+ if err != nil {
|
|
|
+ return fmt.Errorf("error getting tag: %w", err)
|
|
|
+ }
|
|
|
+
|
|
|
+ err = v2.AppPush(ctx, v2.AppPushInput{
|
|
|
+ CLIConfig: cliConfig,
|
|
|
+ Client: client,
|
|
|
+ AppName: appName,
|
|
|
+ DeploymentTargetName: deploymentTargetName,
|
|
|
+ ImageTag: tag,
|
|
|
+ })
|
|
|
+ if err != nil {
|
|
|
+ return fmt.Errorf("failed to push image for app: %w", err)
|
|
|
+ }
|
|
|
+
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
func appManifests(ctx context.Context, _ *types.GetAuthenticatedUserResponse, client api.Client, cliConfig config.CLIConfig, _ config.FeatureFlags, _ *cobra.Command, args []string) error {
|
|
|
appName := args[0]
|
|
|
if appName == "" {
|