From 9aa82fad878e1ed16b19748ace0d07fdfd3e64cd Mon Sep 17 00:00:00 2001 From: Aishwarya Bhandari Date: Wed, 25 Sep 2024 12:03:28 -0700 Subject: [PATCH] build steps --- build/BuildSteps.cs | 49 --------------------------------------------- build/Program.cs | 1 - 2 files changed, 50 deletions(-) diff --git a/build/BuildSteps.cs b/build/BuildSteps.cs index 7cc7bc725..5c4d13fe1 100644 --- a/build/BuildSteps.cs +++ b/build/BuildSteps.cs @@ -672,55 +672,6 @@ public static void DeleteSBOMTelemetryFolder() Directory.Delete(Settings.SBOMManifestTelemetryDir, recursive: true); } - public static void UploadToStorage() - { - // Don't upload for public build. - if (Settings.IsPublicBuild) - { - ColoredConsole.WriteLine($"Skipping upload for public build."); - return; - } - - ColoredConsole.WriteLine($"Going to run the UploadToStorage. Setting is {Settings.IsPublicBuild}"); - - - if (!string.IsNullOrEmpty(Settings.BuildArtifactsStorage)) - { - var version = new Version(CurrentVersion); - var storageAccount = CloudStorageAccount.Parse(Settings.BuildArtifactsStorage); - var blobClient = storageAccount.CreateCloudBlobClient(); - var container = blobClient.GetContainerReference("builds"); - container.CreateIfNotExistsAsync().Wait(); - - container.SetPermissionsAsync(new BlobContainerPermissions - { - PublicAccess = BlobContainerPublicAccessType.Blob - }); - - foreach (var file in Directory.GetFiles(Settings.OutputDir, "Azure.Functions.Cli.*", SearchOption.TopDirectoryOnly)) - { - var fileName = Path.GetFileName(file); - ColoredConsole.Write($"Uploading {fileName}..."); - - var versionedBlob = container.GetBlockBlobReference($"{version.ToString()}/{fileName}"); - var latestBlob = container.GetBlockBlobReference($"{version.Major}/latest/{fileName.Replace($".{version.ToString()}", string.Empty)}"); - versionedBlob.UploadFromFileAsync(file).Wait(); - latestBlob.StartCopyAsync(versionedBlob).Wait(); - - ColoredConsole.WriteLine("Done"); - } - - var latestVersionBlob = container.GetBlockBlobReference($"{version.Major}/latest/version.txt"); - latestVersionBlob.UploadTextAsync(version.ToString()).Wait(); - } - else - { - var error = $"{nameof(Settings.BuildArtifactsStorage)} is null or empty. Can't run {nameof(UploadToStorage)} target"; - ColoredConsole.Error.WriteLine(error.Red()); - throw new Exception(error); - } - } - public static void LogIntoAzure() { var directoryId = Environment.GetEnvironmentVariable("AZURE_DIRECTORY_ID"); diff --git a/build/Program.cs b/build/Program.cs index fe6961a07..261372b61 100644 --- a/build/Program.cs +++ b/build/Program.cs @@ -33,7 +33,6 @@ static void Main(string[] args) .Then(DotnetPublishForNupkg) .Then(DotnetPack) .Then(CreateIntegrationTestsBuildManifest, skip: !args.Contains("--integrationTests")) - .Then(UploadToStorage, skip: !args.Contains("--ci")) .Run(); } }