DEV Community

Query Filter
Query Filter

Posted on

docker16

// 1. Define the TAR task explicitly
task buildAnsibleTar(type: Tar) {
    archiveFileName = "ansible.tar.gz"
    destinationDirectory = file("$buildDir/distributions")
    compression = Compression.GZIP

    // Include the RPM from the buildRpm task
    from(tasks.named('buildRpm'))

    // Explicitly include your ansible folder from the project root
    from("${projectDir}/ansible") {
        into('ansible')
    }
}

// 2. Hook it into the lifecycle correctly
tasks.named('buildRpm') { 
    dependsOn tasks.named('jar') 
}

buildAnsibleTar.dependsOn tasks.named('buildRpm')

// Use 'assemble' instead of 'build' to avoid circular dependency
tasks.named('assemble') {
    dependsOn buildAnsibleTar
}

// Ensure the publishing step waits for the archive
tasks.named('publish') {
    dependsOn buildAnsibleTar
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)