func shouldDownloadFile(localFilePath string, artifactoryFileDetails *utils.FileDetails, user string, password string) bool { if !utils.IsFileExists(localFilePath) { return true } localFileDetails := utils.GetFileDetails(localFilePath) if localFileDetails.Md5 != artifactoryFileDetails.Md5 || localFileDetails.Sha1 != artifactoryFileDetails.Sha1 { return true } return false }
func tryChecksumDeploy(filePath, targetPath string, flags *utils.Flags) (*http.Response, *utils.FileDetails) { details := utils.GetFileDetails(filePath) headers := make(map[string]string) headers["X-Checksum-Deploy"] = "true" headers["X-Checksum-Sha1"] = details.Sha1 headers["X-Checksum-Md5"] = details.Md5 if flags.DryRun { return nil, details } resp, _ := utils.SendPut(targetPath, nil, headers, flags.ArtDetails.User, flags.ArtDetails.Password) return resp, details }