Tanzu Changes

This commit is contained in:
pratik
2025-10-20 23:25:13 -05:00
parent d81e80f273
commit b7405c644b
4 changed files with 371 additions and 27 deletions

View File

@@ -42,6 +42,8 @@ task downloadCfCli {
def resourcesDir = file("$projectDir/src/main/resources/cf-cli")
resourcesDir.mkdirs()
// Download for all platforms (useful for local development on different OSes)
// For production Tanzu deployment, only Linux binary will be used
def downloads = [
[os: 'linux', url: "https://packages.cloudfoundry.org/stable?release=linux64-binary&version=${cfCliVersion}&source=github-rel", ext: 'tgz', executable: 'cf'],
[os: 'macos', url: "https://packages.cloudfoundry.org/stable?release=macosx64-binary&version=${cfCliVersion}&source=github-rel", ext: 'tgz', executable: 'cf'],
@@ -81,5 +83,42 @@ task downloadCfCli {
}
}
// Task to download only Linux CF CLI (for production Tanzu builds)
task downloadCfCliLinuxOnly {
group = 'build'
description = 'Downloads CF CLI binary for Linux only (production builds)'
doLast {
def cfCliVersion = '8.7.10'
def resourcesDir = file("$projectDir/src/main/resources/cf-cli")
resourcesDir.mkdirs()
def download = [os: 'linux', url: "https://packages.cloudfoundry.org/stable?release=linux64-binary&version=${cfCliVersion}&source=github-rel", ext: 'tgz', executable: 'cf']
def osDir = file("${resourcesDir}/${download.os}")
osDir.mkdirs()
def archiveFile = file("${osDir}/cf-cli.${download.ext}")
if (!archiveFile.exists()) {
println "Downloading CF CLI for Linux..."
ant.get(src: download.url, dest: archiveFile, verbose: true)
println "Extracting CF CLI for Linux..."
copy {
from tarTree(resources.gzip(archiveFile))
into osDir
}
archiveFile.delete()
println "CF CLI for Linux downloaded and extracted successfully"
} else {
println "CF CLI for Linux already exists, skipping download"
}
}
}
// Ensure CF CLI is downloaded before building
// Use downloadCfCli for local development (all platforms)
// Use downloadCfCliLinuxOnly for production Tanzu builds (Linux only)
processResources.dependsOn downloadCfCli