Skip to content

Commit

Permalink
build steps
Browse files Browse the repository at this point in the history
  • Loading branch information
aishwaryabh committed Sep 25, 2024
1 parent 16c1f35 commit 9aa82fa
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 50 deletions.
49 changes: 0 additions & 49 deletions build/BuildSteps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
1 change: 0 additions & 1 deletion build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down

0 comments on commit 9aa82fa

Please sign in to comment.