-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VCI-821: Check if module in symlink on update (#121)
- Loading branch information
1 parent
57fabda
commit da200a5
Showing
36 changed files
with
433 additions
and
380 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
src/VirtoCommerce.Build/PlatformTools/Azure/AzureBlobModuleItem.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/VirtoCommerce.Build/PlatformTools/Extensions/LocalModuleCatalogExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.IO; | ||
using System.Linq; | ||
using PlatformTools.Modules; | ||
using VirtoCommerce.Platform.Core.Modularity; | ||
|
||
namespace PlatformTools.Extensions | ||
{ | ||
public static class LocalModuleCatalogExtensions | ||
{ | ||
public static bool IsModuleSymlinked(this ILocalModuleCatalog moduleCatalog, string moduleId) | ||
{ | ||
var moduleInfo = moduleCatalog.Modules.OfType<ManifestModuleInfo>().FirstOrDefault(m => m.ModuleName == moduleId); | ||
if(moduleInfo == null) | ||
{ | ||
return false; | ||
} | ||
|
||
var fileInfo = new FileInfo(moduleInfo.FullPhysicalPath); | ||
|
||
return fileInfo.LinkTarget != null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using System.Collections.Generic; | ||
using PlatformTools.Modules; | ||
|
||
namespace VirtoCommerce.Build.PlatformTools | ||
{ | ||
|
4 changes: 2 additions & 2 deletions
4
...ce.Build/PlatformTools/Azure/AzureBlob.cs → .../PlatformTools/Modules/Azure/AzureBlob.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/VirtoCommerce.Build/PlatformTools/Modules/Azure/AzureBlobModuleItem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using PlatformTools.Modules; | ||
|
||
namespace PlatformTools.Modules.Azure | ||
{ | ||
internal class AzureBlobModuleItem : ModuleItem | ||
{ | ||
public AzureBlobModuleItem(string id, string version) : base(id, version) | ||
{ | ||
|
||
} | ||
public string BlobName { get; set; } | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...atformTools/Azure/AzureCliToolSettings.cs → ...ols/Modules/Azure/AzureCliToolSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 40 additions & 40 deletions
80
...ild/PlatformTools/Azure/AzureDevClient.cs → ...formTools/Modules/Azure/AzureDevClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.TeamFoundation.Build.WebApi; | ||
using Microsoft.VisualStudio.Services.Common; | ||
using Microsoft.VisualStudio.Services.WebApi; | ||
using Nuke.Common; | ||
|
||
namespace PlatformTools.Azure; | ||
|
||
public class AzureDevClient | ||
{ | ||
private readonly VssConnection _connection; | ||
|
||
public AzureDevClient(string orgName, string token) | ||
{ | ||
_connection = new VssConnection(new Uri(orgName), new VssBasicCredential(string.Empty, token)); | ||
} | ||
|
||
public async Task<Uri> GetArtifactUrl(Guid project, string branch, string definitionName) | ||
{ | ||
var client = await _connection.GetClientAsync<BuildHttpClient>(); | ||
var build = await client.GetLatestBuildAsync(project, definitionName, branch); | ||
var artifacts = await client.GetArtifactsAsync(project, build.Id); | ||
Assert.NotEmpty(artifacts, | ||
$"No builds found for the project id: {project.ToString()}{Environment.NewLine}branch: {branch}{Environment.NewLine}definition: {definitionName}"); | ||
var result = artifacts.FirstOrDefault()?.Resource.DownloadUrl; | ||
|
||
return new Uri(result ?? string.Empty); | ||
} | ||
|
||
public async Task<Stream> GetArtifactStream(Guid project, string branch, string definitionName) | ||
{ | ||
var client = await _connection.GetClientAsync<BuildHttpClient>(); | ||
var build = await client.GetLatestBuildAsync(project, definitionName, branch); | ||
var result = await client.GetArtifactContentZipAsync(project, build.Id, "backend"); | ||
return result; | ||
} | ||
} | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.TeamFoundation.Build.WebApi; | ||
using Microsoft.VisualStudio.Services.Common; | ||
using Microsoft.VisualStudio.Services.WebApi; | ||
using Nuke.Common; | ||
|
||
namespace PlatformTools.Modules.Azure; | ||
|
||
public class AzureDevClient | ||
{ | ||
private readonly VssConnection _connection; | ||
|
||
public AzureDevClient(string orgName, string token) | ||
{ | ||
_connection = new VssConnection(new Uri(orgName), new VssBasicCredential(string.Empty, token)); | ||
} | ||
|
||
public async Task<Uri> GetArtifactUrl(Guid project, string branch, string definitionName) | ||
{ | ||
var client = await _connection.GetClientAsync<BuildHttpClient>(); | ||
var build = await client.GetLatestBuildAsync(project, definitionName, branch); | ||
var artifacts = await client.GetArtifactsAsync(project, build.Id); | ||
Assert.NotEmpty(artifacts, | ||
$"No builds found for the project id: {project.ToString()}{Environment.NewLine}branch: {branch}{Environment.NewLine}definition: {definitionName}"); | ||
var result = artifacts.FirstOrDefault()?.Resource.DownloadUrl; | ||
|
||
return new Uri(result ?? string.Empty); | ||
} | ||
|
||
public async Task<Stream> GetArtifactStream(Guid project, string branch, string definitionName) | ||
{ | ||
var client = await _connection.GetClientAsync<BuildHttpClient>(); | ||
var build = await client.GetLatestBuildAsync(project, definitionName, branch); | ||
var result = await client.GetArtifactContentZipAsync(project, build.Id, "backend"); | ||
return result; | ||
} | ||
} |
30 changes: 16 additions & 14 deletions
30
...ld/PlatformTools/Azure/AzureModuleItem.cs → ...ormTools/Modules/Azure/AzureModuleItem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
namespace PlatformTools.Azure | ||
{ | ||
internal class AzureModuleItem : ModuleItem | ||
{ | ||
public AzureModuleItem(string id, string version) : base(id, version) | ||
{ | ||
} | ||
|
||
public string BuildId { get; set; } | ||
public string Branch { get; set; } | ||
public string Definition { get; set; } | ||
} | ||
} | ||
|
||
using PlatformTools.Modules; | ||
|
||
namespace PlatformTools.Modules.Azure | ||
{ | ||
internal class AzureModuleItem : ModuleItem | ||
{ | ||
public AzureModuleItem(string id, string version) : base(id, version) | ||
{ | ||
} | ||
|
||
public string BuildId { get; set; } | ||
public string Branch { get; set; } | ||
public string Definition { get; set; } | ||
} | ||
} | ||
|
28 changes: 14 additions & 14 deletions
28
...formTools/Azure/AzurePipelineArtifacts.cs → ...s/Modules/Azure/AzurePipelineArtifacts.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
using System.Collections.Generic; | ||
using VirtoCommerce.Build.PlatformTools; | ||
|
||
namespace PlatformTools.Azure | ||
{ | ||
internal class AzurePipelineArtifacts : ModuleSource | ||
{ | ||
public string Organization { get; set; } | ||
public string Project { get; set; } | ||
public List<AzureModuleItem> Modules { get; set; } | ||
public override string Name { get; set; } = nameof(AzurePipelineArtifacts); | ||
} | ||
} | ||
using System.Collections.Generic; | ||
using PlatformTools.Modules; | ||
|
||
namespace PlatformTools.Modules.Azure | ||
{ | ||
internal class AzurePipelineArtifacts : ModuleSource | ||
{ | ||
public string Organization { get; set; } | ||
public string Project { get; set; } | ||
public List<AzureModuleItem> Modules { get; set; } | ||
public override string Name { get; set; } = nameof(AzurePipelineArtifacts); | ||
} | ||
} | ||
|
Oops, something went wrong.