Skip to content

Expose default value for imageName in bootBuildImage task #28040

@scottfrederick

Description

@scottfrederick

When combining the Spring Boot Gradle plugin's bootBuildImage task with other Docker-related plugin tasks, it is convenient to be able to reference the default bootBuildImage property imageName. For example:

plugins {
	id 'org.springframework.boot' version '...'
	id 'com.bmuschko.docker-remote-api' version '7.1.0'
	...
}

tasks.register('tagImage', DockerTagImage) {
	dependsOn 'bootBuildImage'
	imageId = bootBuildImage.imageName
	repository = "example.com/${project.name}"
	tag = "latest"
}

Currently, bootBuildImage.imageName returns null if not explicitly set in the build configuration, which results in an error when the tagImage task is run:

A problem was found with the configuration of task ':tagImage' (type 'DockerTagImage').
  - Type 'DockerTagImage' property 'imageId' doesn't have a configured value.

    Reason: This property isn't marked as optional and no value has been configured.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions