@ -37,6 +37,7 @@ import org.springframework.util.Assert;
* @author Scott Frederick
* @author Scott Frederick
* @author Andrey Shlykov
* @author Andrey Shlykov
* @author Jeroen Meijer
* @author Jeroen Meijer
* @author Rafael Ceccone
* @since 2.3 .0
* @since 2.3 .0
* /
* /
public class BuildRequest {
public class BuildRequest {
@ -71,6 +72,8 @@ public class BuildRequest {
private final String network ;
private final String network ;
private final List < ImageReference > tags ;
BuildRequest ( ImageReference name , Function < Owner , TarArchive > applicationContent ) {
BuildRequest ( ImageReference name , Function < Owner , TarArchive > applicationContent ) {
Assert . notNull ( name , "Name must not be null" ) ;
Assert . notNull ( name , "Name must not be null" ) ;
Assert . notNull ( applicationContent , "ApplicationContent must not be null" ) ;
Assert . notNull ( applicationContent , "ApplicationContent must not be null" ) ;
@ -87,12 +90,13 @@ public class BuildRequest {
this . buildpacks = Collections . emptyList ( ) ;
this . buildpacks = Collections . emptyList ( ) ;
this . bindings = Collections . emptyList ( ) ;
this . bindings = Collections . emptyList ( ) ;
this . network = null ;
this . network = null ;
this . tags = Collections . emptyList ( ) ;
}
}
BuildRequest ( ImageReference name , Function < Owner , TarArchive > applicationContent , ImageReference builder ,
BuildRequest ( ImageReference name , Function < Owner , TarArchive > applicationContent , ImageReference builder ,
ImageReference runImage , Creator creator , Map < String , String > env , boolean cleanCache ,
ImageReference runImage , Creator creator , Map < String , String > env , boolean cleanCache ,
boolean verboseLogging , PullPolicy pullPolicy , boolean publish , List < BuildpackReference > buildpacks ,
boolean verboseLogging , PullPolicy pullPolicy , boolean publish , List < BuildpackReference > buildpacks ,
List < Binding > bindings , String network ) {
List < Binding > bindings , String network , List < ImageReference > tags ) {
this . name = name ;
this . name = name ;
this . applicationContent = applicationContent ;
this . applicationContent = applicationContent ;
this . builder = builder ;
this . builder = builder ;
@ -106,6 +110,7 @@ public class BuildRequest {
this . buildpacks = buildpacks ;
this . buildpacks = buildpacks ;
this . bindings = bindings ;
this . bindings = bindings ;
this . network = network ;
this . network = network ;
this . tags = tags ;
}
}
/ * *
/ * *
@ -117,7 +122,7 @@ public class BuildRequest {
Assert . notNull ( builder , "Builder must not be null" ) ;
Assert . notNull ( builder , "Builder must not be null" ) ;
return new BuildRequest ( this . name , this . applicationContent , builder . inTaggedOrDigestForm ( ) , this . runImage ,
return new BuildRequest ( this . name , this . applicationContent , builder . inTaggedOrDigestForm ( ) , this . runImage ,
this . creator , this . env , this . cleanCache , this . verboseLogging , this . pullPolicy , this . publish ,
this . creator , this . env , this . cleanCache , this . verboseLogging , this . pullPolicy , this . publish ,
this . buildpacks , this . bindings , this . network );
this . buildpacks , this . bindings , this . network , this . tags );
}
}
/ * *
/ * *
@ -128,7 +133,7 @@ public class BuildRequest {
public BuildRequest withRunImage ( ImageReference runImageName ) {
public BuildRequest withRunImage ( ImageReference runImageName ) {
return new BuildRequest ( this . name , this . applicationContent , this . builder , runImageName . inTaggedOrDigestForm ( ) ,
return new BuildRequest ( this . name , this . applicationContent , this . builder , runImageName . inTaggedOrDigestForm ( ) ,
this . creator , this . env , this . cleanCache , this . verboseLogging , this . pullPolicy , this . publish ,
this . creator , this . env , this . cleanCache , this . verboseLogging , this . pullPolicy , this . publish ,
this . buildpacks , this . bindings , this . network );
this . buildpacks , this . bindings , this . network , this . tags );
}
}
/ * *
/ * *
@ -140,7 +145,7 @@ public class BuildRequest {
Assert . notNull ( creator , "Creator must not be null" ) ;
Assert . notNull ( creator , "Creator must not be null" ) ;
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , creator , this . env ,
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , creator , this . env ,
this . cleanCache , this . verboseLogging , this . pullPolicy , this . publish , this . buildpacks , this . bindings ,
this . cleanCache , this . verboseLogging , this . pullPolicy , this . publish , this . buildpacks , this . bindings ,
this . network );
this . network , this . tags );
}
}
/ * *
/ * *
@ -156,7 +161,7 @@ public class BuildRequest {
env . put ( name , value ) ;
env . put ( name , value ) ;
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator ,
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator ,
Collections . unmodifiableMap ( env ) , this . cleanCache , this . verboseLogging , this . pullPolicy , this . publish ,
Collections . unmodifiableMap ( env ) , this . cleanCache , this . verboseLogging , this . pullPolicy , this . publish ,
this . buildpacks , this . bindings , this . network );
this . buildpacks , this . bindings , this . network , this . tags );
}
}
/ * *
/ * *
@ -170,7 +175,7 @@ public class BuildRequest {
updatedEnv . putAll ( env ) ;
updatedEnv . putAll ( env ) ;
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator ,
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator ,
Collections . unmodifiableMap ( updatedEnv ) , this . cleanCache , this . verboseLogging , this . pullPolicy ,
Collections . unmodifiableMap ( updatedEnv ) , this . cleanCache , this . verboseLogging , this . pullPolicy ,
this . publish , this . buildpacks , this . bindings , this . network );
this . publish , this . buildpacks , this . bindings , this . network , this . tags );
}
}
/ * *
/ * *
@ -181,7 +186,7 @@ public class BuildRequest {
public BuildRequest withCleanCache ( boolean cleanCache ) {
public BuildRequest withCleanCache ( boolean cleanCache ) {
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator , this . env ,
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator , this . env ,
cleanCache , this . verboseLogging , this . pullPolicy , this . publish , this . buildpacks , this . bindings ,
cleanCache , this . verboseLogging , this . pullPolicy , this . publish , this . buildpacks , this . bindings ,
this . network );
this . network , this . tags );
}
}
/ * *
/ * *
@ -192,7 +197,7 @@ public class BuildRequest {
public BuildRequest withVerboseLogging ( boolean verboseLogging ) {
public BuildRequest withVerboseLogging ( boolean verboseLogging ) {
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator , this . env ,
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator , this . env ,
this . cleanCache , verboseLogging , this . pullPolicy , this . publish , this . buildpacks , this . bindings ,
this . cleanCache , verboseLogging , this . pullPolicy , this . publish , this . buildpacks , this . bindings ,
this . network );
this . network , this . tags );
}
}
/ * *
/ * *
@ -203,7 +208,7 @@ public class BuildRequest {
public BuildRequest withPullPolicy ( PullPolicy pullPolicy ) {
public BuildRequest withPullPolicy ( PullPolicy pullPolicy ) {
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator , this . env ,
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator , this . env ,
this . cleanCache , this . verboseLogging , pullPolicy , this . publish , this . buildpacks , this . bindings ,
this . cleanCache , this . verboseLogging , pullPolicy , this . publish , this . buildpacks , this . bindings ,
this . network );
this . network , this . tags );
}
}
/ * *
/ * *
@ -214,7 +219,7 @@ public class BuildRequest {
public BuildRequest withPublish ( boolean publish ) {
public BuildRequest withPublish ( boolean publish ) {
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator , this . env ,
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator , this . env ,
this . cleanCache , this . verboseLogging , this . pullPolicy , publish , this . buildpacks , this . bindings ,
this . cleanCache , this . verboseLogging , this . pullPolicy , publish , this . buildpacks , this . bindings ,
this . network );
this . network , this . tags );
}
}
/ * *
/ * *
@ -238,7 +243,7 @@ public class BuildRequest {
Assert . notNull ( buildpacks , "Buildpacks must not be null" ) ;
Assert . notNull ( buildpacks , "Buildpacks must not be null" ) ;
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator , this . env ,
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator , this . env ,
this . cleanCache , this . verboseLogging , this . pullPolicy , this . publish , buildpacks , this . bindings ,
this . cleanCache , this . verboseLogging , this . pullPolicy , this . publish , buildpacks , this . bindings ,
this . network );
this . network , this . tags );
}
}
/ * *
/ * *
@ -262,7 +267,7 @@ public class BuildRequest {
Assert . notNull ( bindings , "Bindings must not be null" ) ;
Assert . notNull ( bindings , "Bindings must not be null" ) ;
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator , this . env ,
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator , this . env ,
this . cleanCache , this . verboseLogging , this . pullPolicy , this . publish , this . buildpacks , bindings ,
this . cleanCache , this . verboseLogging , this . pullPolicy , this . publish , this . buildpacks , bindings ,
this . network );
this . network , this . tags );
}
}
/ * *
/ * *
@ -274,7 +279,29 @@ public class BuildRequest {
public BuildRequest withNetwork ( String network ) {
public BuildRequest withNetwork ( String network ) {
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator , this . env ,
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator , this . env ,
this . cleanCache , this . verboseLogging , this . pullPolicy , this . publish , this . buildpacks , this . bindings ,
this . cleanCache , this . verboseLogging , this . pullPolicy , this . publish , this . buildpacks , this . bindings ,
network ) ;
network , this . tags ) ;
}
/ * *
* Return a new { @link BuildRequest } with updated tags .
* @param tags a collection of tags to be created for the built image
* @return an updated build request
* /
public BuildRequest withTags ( ImageReference . . . tags ) {
Assert . notEmpty ( tags , "Tags must not be empty" ) ;
return withTags ( Arrays . asList ( tags ) ) ;
}
/ * *
* Return a new { @link BuildRequest } with updated tags .
* @param tags a collection of tags to be created for the built image
* @return an updated build request
* /
public BuildRequest withTags ( List < ImageReference > tags ) {
Assert . notNull ( tags , "Tags must not be null" ) ;
return new BuildRequest ( this . name , this . applicationContent , this . builder , this . runImage , this . creator , this . env ,
this . cleanCache , this . verboseLogging , this . pullPolicy , this . publish , this . buildpacks , this . bindings ,
this . network , tags ) ;
}
}
/ * *
/ * *
@ -386,6 +413,14 @@ public class BuildRequest {
return this . network ;
return this . network ;
}
}
/ * *
* Return the collection of tags that should be created .
* @return the tags
* /
public List < ImageReference > getTags ( ) {
return this . tags ;
}
/ * *
/ * *
* Factory method to create a new { @link BuildRequest } from a JAR file .
* Factory method to create a new { @link BuildRequest } from a JAR file .
* @param jarFile the source jar file
* @param jarFile the source jar file