Просмотр исходного кода

option to pull before running standalone build cmd

Ian Edwards 2 лет назад
Родитель
Сommit
ae0dc0995e
2 измененных файлов с 10 добавлено и 6 удалено
  1. 1 0
      cli/cmd/commands/app.go
  2. 9 6
      cli/cmd/v2/app_build.go

+ 1 - 0
cli/cmd/commands/app.go

@@ -151,6 +151,7 @@ buildpacks using the --builder and --attach-buildpacks flags:
 		"",
 		"set the image tag to use for the build",
 	)
+	appBuildCommand.PersistentFlags().BoolVar(&pullImageBeforeBuild, "pull-before-build", false, "attempt to pull image from registry before building")
 	appCmd.AddCommand(appBuildCommand)
 
 	appPushCommand := &cobra.Command{

+ 9 - 6
cli/cmd/v2/app_build.go

@@ -37,6 +37,8 @@ type AppBuildInput struct {
 	ImageTag string
 	// PatchOperations is the set of patch operations to apply to the app build
 	PatchOperations []v2.PatchOperation
+	// PullBeforeBuild is a flag to pull the base image before building
+	PullBeforeBuild bool
 }
 
 // AppBuild builds an app using a combination of the provided flag values and build settings from the latest app revision
@@ -95,12 +97,13 @@ func AppBuild(ctx context.Context, inp AppBuildInput) error {
 	}
 
 	buildInput, err := buildInputFromBuildSettings(buildInputFromBuildSettingsInput{
-		projectID: cliConf.Project,
-		appName:   inp.AppName,
-		commitSHA: tagForBuild,
-		image:     buildSettings.Image,
-		build:     buildSettings.Build,
-		buildEnv:  buildEnvVariables,
+		projectID:            cliConf.Project,
+		appName:              inp.AppName,
+		commitSHA:            tagForBuild,
+		image:                buildSettings.Image,
+		build:                buildSettings.Build,
+		buildEnv:             buildEnvVariables,
+		pullImageBeforeBuild: inp.PullBeforeBuild,
 	})
 	if err != nil {
 		return fmt.Errorf("error creating build input from build settings: %w", err)