|
|
@@ -132,6 +132,8 @@ type Target struct {
|
|
|
}
|
|
|
|
|
|
type ApplicationConfig struct {
|
|
|
+ WaitForJob bool
|
|
|
+
|
|
|
Build struct {
|
|
|
Method string
|
|
|
Context string
|
|
|
@@ -315,6 +317,26 @@ func (d *Driver) applyApplication(resource *models.Resource, client *api.Client,
|
|
|
return nil, err
|
|
|
}
|
|
|
|
|
|
+ if d.source.Name == "job" && appConfig.WaitForJob {
|
|
|
+ color.New(color.FgYellow).Printf("Waiting for job '%s' to finish\n", resource.Name)
|
|
|
+
|
|
|
+ prevProject := config.Project
|
|
|
+ prevCluster := config.Cluster
|
|
|
+ name = resource.Name
|
|
|
+ namespace = d.target.Namespace
|
|
|
+ config.Project = d.target.Project
|
|
|
+ config.Cluster = d.target.Cluster
|
|
|
+
|
|
|
+ err = waitForJob(nil, client, []string{})
|
|
|
+
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ config.Project = prevProject
|
|
|
+ config.Cluster = prevCluster
|
|
|
+ }
|
|
|
+
|
|
|
return resource, err
|
|
|
}
|
|
|
|
|
|
@@ -623,6 +645,11 @@ func (d *Driver) getApplicationConfig(resource *models.Resource) (*ApplicationCo
|
|
|
return nil, err
|
|
|
}
|
|
|
|
|
|
+ if _, ok := resource.Config["waitForJob"]; !ok && d.source.Name == "job" {
|
|
|
+ // default to true and wait for the job to finish
|
|
|
+ config.WaitForJob = true
|
|
|
+ }
|
|
|
+
|
|
|
return config, nil
|
|
|
}
|
|
|
|