Pull docker air gap zip without using docker-inspector.sh
@@ -61,25 +61,21 @@ task copyApplicationProperties(type: Copy) {
into configAirGapPath
}
-task downloadDockerInspectorScript() {
- doLast {
- def dir = new File(dockerAirGapPath)
- dir.mkdir()
- def dockerInspectorScript = new File(dockerAirGapPath, 'blackduck-docker-inspector.sh')
- final def dockerInspectorScriptUrl = 'https://blackducksoftware.github.io/blackduck-docker-inspector/blackduck-docker-inspector.sh'
- fetchFile(dockerInspectorScript, dockerInspectorScriptUrl)
- dockerInspectorScript.setExecutable(true)
- }
-}
-
task downloadDockerInspector() {
- dependsOn downloadDockerInspectorScript
doLast {
- exec {
- workingDir "${dockerAirGapPath}"
- environment 'DOCKER_INSPECTOR_CURL_OPTS', '--insecure'
- commandLine 'bash', "${dockerAirGapPath}/blackduck-docker-inspector.sh", '--pullairgapzip'
- }
+ final String dockerInspectorArtifactoryBaseUrl = 'https://test-repo.blackducksoftware.com/artifactory/bds-integrations-release/com/synopsys/integration/blackduck-docker-inspector'
+ final String dockerInspectorMavenMetadataUrl = "${dockerInspectorArtifactoryBaseUrl}/maven-metadata.xml"
+ final File dockerInspectorMetadataFile = new File(dockerAirGapPath, 'maven-metadata.xml')
+ dockerInspectorMetadataFile.delete()
+ fetchFile(dockerInspectorMetadataFile, dockerInspectorMavenMetadataUrl)
+ final String mavenMetadataString = dockerInspectorMetadataFile.getText('UTF-8')
+ final Node metadata = new XmlParser().parseText(mavenMetadataString)
+ final String dockerInspectorLatestVersion = metadata.versioning.latest.text()
+ println "dockerInspectorLatestVersion: ${dockerInspectorLatestVersion}"
+ final String dockerInspectorAirGapZipUrl = "${dockerInspectorArtifactoryBaseUrl}/${dockerInspectorLatestVersion}/blackduck-docker-inspector-${dockerInspectorLatestVersion}-air-gap.zip"
+ println "dockerInspectorAirGapZipUrl: ${dockerInspectorAirGapZipUrl}"
+ final File dockerInspectorAirGapZipFile = new File(dockerAirGapPath, "blackduck-docker-inspector-${dockerInspectorLatestVersion}-air-gap.zip")
+ fetchFile(dockerInspectorAirGapZipFile, dockerInspectorAirGapZipUrl)
exec {
workingDir "${dockerAirGapPath}"
commandLine 'unzip', '-n', 'blackduck-docker-inspector-*-air-gap.zip'
