gradle-docker icon indicating copy to clipboard operation
gradle-docker copied to clipboard

Recommend don't create the dockerTag${project.version} and dockerPush${project.version} task by default, keep to add it by user self as 0.30.0 version.

Open yuanjinyong opened this issue 3 years ago • 8 comments

What happened?

In 0.31.0 version, the DockerExtension had chagne from

    public Set<String> getTags() {
        return tags
    }

to

    public Set<String> getTags() {
        return Sets.union(this.tags, ImmutableSet.of(project.getVersion().toString()))
    }

And this will create two tasks: dockerTag${project.version} and dockerPush${project.version}. But the project.version value maybe like 'x.y.x-SNAPSHOT' for nightly build, and the corresponding tag is nightly, if run dockerPush task, will also run dockerPush${project.version} cause to push a ${archivesBaseName}:x.y.x-SNAPSHOT tag.

project.tasks["dockerTag${project.version}"].enabled = false project.tasks["dockerPush${project.version}"].enabled = false

What did you want to happen?

Just keep the default value of tags same with previous version(<0.31.0). User can add it by self who want these tasks like following:

docker {
    tag project.version, "${dockerUrl}/${project.group}/${archivesBaseName}:${project.version}"
    tag 'latest', "${dockerUrl}/${project.group}/${archivesBaseName}"
    tag project.buildType, "${dockerUrl}/${project.group}/${archivesBaseName}:${project.buildType == 'release' ? project.version : 'nightly'}"
}

yuanjinyong avatar Jan 18 '22 16:01 yuanjinyong

+1

Same here! Since 0.30.0 also the project.version is tagged and pushed - what I don't want. Our version also includes a commit id but seems to be overwritten with project.version automatically.

mhuebner avatar Mar 14 '22 13:03 mhuebner

Agree with you! It can be confusing for inexperienced gradle users in my project. Moreover it's ugly for me as for gradle scripting perfectionist ._.

idkomarov avatar May 17 '22 07:05 idkomarov