use of org.jfrog.build.client.DeployDetails in project build-info by JFrogDev.
the class SpecsHelper method uploadArtifactsBySpec.
/**
* Uploads and returns List of artifacts according to a provided by the user upload fileSpec
*
* @param uploadSpec The required spec represented as String
* @param workspace File object that represents the workspace
* @param buildProperties Upload properties
* @param client ArtifactoryBuildInfoClient which will do the actual upload
* @return Set of DeployDetails that was calculated from the given params
* @throws IOException Thrown if any error occurs while reading the file, calculating the
* checksums or in case of any file system exception
* @throws NoSuchAlgorithmException Thrown if any of the given algorithms aren't supported
*/
public List<Artifact> uploadArtifactsBySpec(String uploadSpec, File workspace, Multimap<String, String> buildProperties, ArtifactoryBuildInfoClient client) throws IOException, NoSuchAlgorithmException {
Spec spec = this.getDownloadUploadSpec(uploadSpec, new UploadSpecValidator());
Set<DeployDetails> artifactsToDeploy = getDeployDetails(spec, workspace, buildProperties);
deploy(client, artifactsToDeploy);
return convertDeployDetailsToArtifacts(artifactsToDeploy);
}
use of org.jfrog.build.client.DeployDetails in project build-info by JFrogDev.
the class DownloadTest method testDownloadFilesProvider.
/**
* Create and upload files to Artifactory.
* The test files are created according to the data provided in testFilesMap
*/
@DataProvider
private Object[][] testDownloadFilesProvider() throws IOException, NoSuchAlgorithmException {
Map<String, Integer> testFilesMap = new HashMap<String, Integer>() {
{
put("file1", MIN_SIZE_FOR_CONCURRENT_DOWNLOAD);
put("file2", MIN_SIZE_FOR_CONCURRENT_DOWNLOAD - 1);
}
};
Object[][] tests = new Object[testFilesMap.size()][4];
try {
int i = 0;
for (Map.Entry<String, Integer> entry : testFilesMap.entrySet()) {
String fileName = entry.getKey();
int fileSize = entry.getValue();
// Create file and calculate checksum
File file = createRandomFile(tempWorkspace.getPath() + File.pathSeparatorChar + fileName, fileSize);
Map<String, String> checksum = FileChecksumCalculator.calculateChecksums(file, SHA1_ALGORITHM_NAME, MD5_ALGORITHM_NAME);
DeployDetails deployDetails = new DeployDetails.Builder().file(file).artifactPath(TEST_REPO_PATH + "/" + fileName).targetRepository(localRepo).md5(checksum.get(MD5_ALGORITHM_NAME)).sha1(checksum.get(SHA1_ALGORITHM_NAME)).explode(false).build();
// Upload artifact
buildInfoClient.deployArtifact(deployDetails);
long createdFileSize = deployDetails.getFile().length();
tests[i] = new Object[] { checksum, fileName, createdFileSize };
i++;
}
} finally {
FileUtils.deleteDirectory(tempWorkspace);
}
return tests;
}
use of org.jfrog.build.client.DeployDetails in project build-info by JFrogDev.
the class GradleBuildInfoExtractor method calculateArtifacts.
private List<Artifact> calculateArtifacts(Iterable<GradleDeployDetails> deployDetails) throws Exception {
List<Artifact> artifacts = newArrayList(transform(deployDetails, new Function<GradleDeployDetails, Artifact>() {
public Artifact apply(GradleDeployDetails from) {
PublishArtifactInfo publishArtifact = from.getPublishArtifact();
DeployDetails deployDetails = from.getDeployDetails();
String artifactPath = deployDetails.getArtifactPath();
int index = artifactPath.lastIndexOf('/');
return new ArtifactBuilder(artifactPath.substring(index + 1)).type(getTypeString(publishArtifact.getType(), publishArtifact.getClassifier(), publishArtifact.getExtension())).md5(deployDetails.getMd5()).sha1(deployDetails.getSha1()).build();
}
}));
return artifacts;
}
use of org.jfrog.build.client.DeployDetails in project build-info by JFrogDev.
the class DeployTask method deployArtifacts.
private void deployArtifacts(Set<GradleDeployDetails> allDeployDetails, ArtifactoryBuildInfoClient client, IncludeExcludePatterns patterns) throws IOException {
for (GradleDeployDetails detail : allDeployDetails) {
DeployDetails deployDetails = detail.getDeployDetails();
String artifactPath = deployDetails.getArtifactPath();
if (PatternMatcher.pathConflicts(artifactPath, patterns)) {
log.log(LogLevel.LIFECYCLE, "Skipping the deployment of '" + artifactPath + "' due to the defined include-exclude patterns.");
continue;
}
client.deployArtifact(deployDetails);
}
}
Aggregations