Add convenience flag for outputting dependencies only.
diff --git a/pkg/cmd/local_build.go b/pkg/cmd/local_build.go
index a720f3b..2e42194 100644
--- a/pkg/cmd/local_build.go
+++ b/pkg/cmd/local_build.go
@@ -57,6 +57,7 @@
}
cmd.Flags().Bool("base-image", false, "Build base image used as a starting point for any integration.")
+ cmd.Flags().Bool("dependencies-only", false, "Only output the integration dependencies. The integration-directory flag must be set.")
cmd.Flags().String("container-registry", "", "Registry that holds intermediate images. This flag should only be used in conjunction with the base-image flag.")
cmd.Flags().String("image", "", "Full path to integration image including registry.")
cmd.Flags().String("integration-directory", "", "Directory to hold local integration files.")
@@ -71,6 +72,7 @@
type localBuildCmdOptions struct {
*RootCmdOptions
BaseImage bool `mapstructure:"base-image"`
+ DependenciesOnly bool `mapstructure:"dependencies-only"`
ContainerRegistry string `mapstructure:"container-registry"`
Image string `mapstructure:"image"`
IntegrationDirectory string `mapstructure:"integration-directory"`
@@ -121,6 +123,11 @@
return errors.New("base image construction does not use integration files")
}
+ // The integration directory must be set when only outputting dependencies.
+ if command.DependenciesOnly && command.IntegrationDirectory == "" {
+ return errors.New("to output dependencies the integration directory flag must be set")
+ }
+
return nil
}
@@ -166,16 +173,18 @@
return err
}
- hasIntegrationDir := command.IntegrationDirectory != ""
-
- // Manage integration properties which may come from files or CLI.
- propertyFiles, err := updateIntegrationProperties(command.Properties, command.PropertyFiles, false)
- if err != nil {
- return err
+ propertyFiles := []string{}
+ if !command.DependenciesOnly {
+ // Manage integration properties which may come from files or CLI.
+ propertyFiles, err = updateIntegrationProperties(command.Properties, command.PropertyFiles, false)
+ if err != nil {
+ return err
+ }
}
dependenciesList = dependencies
propertyFilesList = propertyFiles
+ hasIntegrationDir := command.IntegrationDirectory != ""
if hasIntegrationDir {
// Create dependencies subdirectory.
localDependenciesDirectory := getCustomDependenciesDir(command.IntegrationDirectory)
@@ -186,6 +195,11 @@
return err
}
+ // Once dependencies have been copied to local folder, we can exit.
+ if command.DependenciesOnly {
+ return nil
+ }
+
// Create dependencies subdirectory.
localPropertiesDirectory := getCustomPropertiesDir(command.IntegrationDirectory)