All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.avast.gradle.dockercompose.tasks.ComposePush.groovy Maven / Gradle / Ivy

The newest version!
package com.avast.gradle.dockercompose.tasks

import com.avast.gradle.dockercompose.ComposeExecutor
import groovy.transform.CompileStatic
import org.gradle.api.DefaultTask
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.TaskAction

@CompileStatic
abstract class ComposePush extends DefaultTask {

    @Internal
    abstract Property getIgnorePushFailure()

    @Internal
    abstract ListProperty getPushServices()

    @Internal
    abstract Property getComposeExecutor()

    ComposePush() {
        group = 'docker'
        description = 'Pushes images for services of docker-compose project'
    }

    @TaskAction
    void push() {
        String[] args = ['push']
        if (ignorePushFailure.get()) {
            args += '--ignore-push-failures'
        }
        args += (List) pushServices.get()
        composeExecutor.get().execute(args)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy