public static BuildTargetResult InitPublish(BuildTargetContext c) { AzurePublisherTool = new AzurePublisher(); DebRepoPublisherTool = new DebRepoPublisher(Dirs.Packages); CliVersion = c.BuildContext.Get <BuildVersion>("BuildVersion").SimpleVersion; CliNuGetVersion = c.BuildContext.Get <BuildVersion>("BuildVersion").NuGetVersion; SharedFrameworkNugetVersion = c.BuildContext.Get <string>("SharedFrameworkNugetVersion"); Channel = c.BuildContext.Get <string>("Channel"); return(c.Success()); }
public static BuildTargetResult InitPublish(BuildTargetContext c) { AzurePublisherTool = new AzurePublisher(); DebRepoPublisherTool = new DebRepoPublisher(Dirs.Packages); CliVersion = c.BuildContext.Get<BuildVersion>("BuildVersion").SimpleVersion; CliNuGetVersion = c.BuildContext.Get<BuildVersion>("BuildVersion").NuGetVersion; SharedFrameworkNugetVersion = c.BuildContext.Get<string>("SharedFrameworkNugetVersion"); Channel = c.BuildContext.Get<string>("Channel"); return c.Success(); }
public static BuildTargetResult PublishSdkDebToDebianRepo(BuildTargetContext c) { var version = CliNuGetVersion; var packageName = CliMonikers.GetSdkDebianPackageName(c); var installerFile = c.BuildContext.Get <string>("SdkInstallerFile"); var uploadUrl = AzurePublisher.CalculateFullUrlForFile(installerFile, AzurePublisher.Product.Sdk, version); DebRepoPublisherTool.PublishDebFileToDebianRepo( packageName, version, uploadUrl); return(c.Success()); }
public static BuildTargetResult DownloadHostAndSharedFxInstallers(BuildTargetContext c) { var sharedFrameworkVersion = DependencyVersions.SharedFrameworkVersion; var hostVersion = DependencyVersions.SharedHostVersion; var sharedFrameworkChannel = DependencyVersions.SharedFrameworkChannel; var sharedHostChannel = DependencyVersions.SharedHostChannel; var sharedFrameworkInstallerDownloadFile = Path.Combine(Dirs.CoreSetupDownload, "sharedFrameworkInstaller"); var sharedHostInstallerDownloadFile = Path.Combine(Dirs.CoreSetupDownload, "sharedHostInstaller"); Mkdirp(Path.GetDirectoryName(sharedFrameworkInstallerDownloadFile)); Mkdirp(Path.GetDirectoryName(sharedHostInstallerDownloadFile)); if (!File.Exists(sharedFrameworkInstallerDownloadFile)) { var sharedFrameworkInstallerDestinationFile = c.BuildContext.Get <string>("SharedFrameworkInstallerFile"); Mkdirp(Path.GetDirectoryName(sharedFrameworkInstallerDestinationFile)); AzurePublisher.DownloadFile( AzurePublisher.CalculateInstallerBlob( sharedFrameworkInstallerDestinationFile, sharedFrameworkChannel, sharedFrameworkVersion), sharedFrameworkInstallerDownloadFile).Wait(); File.Copy(sharedFrameworkInstallerDownloadFile, sharedFrameworkInstallerDestinationFile, true); } if (!File.Exists(sharedHostInstallerDownloadFile)) { var sharedHostInstallerDestinationFile = c.BuildContext.Get <string>("SharedHostInstallerFile"); Mkdirp(Path.GetDirectoryName(sharedHostInstallerDestinationFile)); AzurePublisher.DownloadFile( AzurePublisher.CalculateInstallerBlob( sharedHostInstallerDestinationFile, sharedHostChannel, hostVersion), sharedHostInstallerDownloadFile).Wait(); File.Copy(sharedHostInstallerDownloadFile, sharedHostInstallerDestinationFile, true); } return(c.Success()); }
public static BuildTargetResult DownloadHostAndSharedFxArchives(BuildTargetContext c) { var sharedFrameworkVersion = CliDependencyVersions.SharedFrameworkVersion; var sharedFrameworkChannel = CliDependencyVersions.SharedFrameworkChannel; var combinedSharedHostAndFrameworkArchiveDownloadFile = Path.Combine(CliDirs.CoreSetupDownload, "combinedSharedHostAndFrameworkArchive"); Mkdirp(Path.GetDirectoryName(combinedSharedHostAndFrameworkArchiveDownloadFile)); if (!File.Exists(combinedSharedHostAndFrameworkArchiveDownloadFile)) { // Needed for computing the blob path var combinedSharedHostAndFrameworkArchiveBuildContextFile = c.BuildContext.Get <string>("CombinedFrameworkHostCompressedFile"); AzurePublisher.DownloadFile( CalculateArchiveBlob( combinedSharedHostAndFrameworkArchiveBuildContextFile, sharedFrameworkChannel, sharedFrameworkVersion), combinedSharedHostAndFrameworkArchiveDownloadFile).Wait(); // Unpack the combined archive to shared framework publish directory Rmdir(Dirs.SharedFrameworkPublish); Mkdirp(Dirs.SharedFrameworkPublish); if (CurrentPlatform.IsWindows) { ZipFile.ExtractToDirectory(combinedSharedHostAndFrameworkArchiveDownloadFile, Dirs.SharedFrameworkPublish); } else { Exec("tar", "xf", combinedSharedHostAndFrameworkArchiveDownloadFile, "-C", Dirs.SharedFrameworkPublish); } } return(c.Success()); }
private static void AutoRenewLease(AzurePublisher instance, string blob, string leaseId) { // We will renew the lease every 45 seconds TimeSpan maxWait = TimeSpan.FromSeconds(45); TimeSpan delay = TimeSpan.FromMilliseconds(500); TimeSpan waitFor = maxWait; CancellationToken token = instance._cancellationTokenSource.Token; while (true) { // If the task has been requested to be cancelled, then do so. token.ThrowIfCancellationRequested(); try { CloudBlockBlob cloudBlob = instance._blobContainer.GetBlockBlobReference(blob); AccessCondition ac = new AccessCondition() { LeaseId = leaseId }; cloudBlob.RenewLeaseAsync(ac).Wait(); waitFor = maxWait; } catch (Exception e) { Console.WriteLine($"Retrying lease renewal on {blob}, {e.Message}"); waitFor = delay; } // If the task has been requested to be cancelled, then do so. token.ThrowIfCancellationRequested(); Thread.Sleep(waitFor); } }