Compare commits
1 Commits
set-sast-c
...
0.1.6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d404034f9 |
@@ -1,26 +1,18 @@
|
||||
# You can override the included template(s) by including variable overrides
|
||||
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
|
||||
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings
|
||||
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings
|
||||
# Note that environment variables can be set in several places
|
||||
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
|
||||
stages:
|
||||
- test
|
||||
- publish
|
||||
- test
|
||||
- publish
|
||||
|
||||
running tests for tag:
|
||||
image: mcr.microsoft.com/dotnet/sdk:5.0
|
||||
stage: test
|
||||
script:
|
||||
- dotnet test tests/update-tag.tests
|
||||
- dotnet test tests/update-tag.tests
|
||||
|
||||
publish to nuget:
|
||||
only:
|
||||
- "/^\\d*.\\d*.\\d*$/"
|
||||
- /^\d*.\d*.\d*$/ # gets triggered if the commit tag is in the form n.n.n where n is any number
|
||||
image: mcr.microsoft.com/dotnet/sdk:5.0
|
||||
stage: publish
|
||||
script:
|
||||
- dotnet pack src/Cli -o ./packaged
|
||||
- dotnet nuget push ./packaged/*.nupkg -k $NUGET_API_KEY -s https://api.nuget.org/v3/index.json
|
||||
sast:
|
||||
stage: test
|
||||
include:
|
||||
- template: Security/SAST.gitlab-ci.yml
|
||||
- dotnet pack src/Cli -o ./packaged
|
||||
- dotnet nuget push ./packaged/*.nupkg -k $NUGET_API_KEY -s https://api.nuget.org/v3/index.json
|
||||
|
||||
@@ -26,8 +26,7 @@ namespace Cli
|
||||
var chosenService = await ChooseService(repoBasePath);
|
||||
var selection = await SelectVersion(repoBasePath, chosenService);
|
||||
await AddVersionTagToRepo(repoBasePath, selection.Version.ToString());
|
||||
await PushTagsToRemote(repoBasePath);
|
||||
await PushCommitsToRemote(repoBasePath);
|
||||
await PushToRemote(repoBasePath);
|
||||
}
|
||||
|
||||
private async Task<string> GetRepoBasePath(string workingDir)
|
||||
@@ -113,27 +112,11 @@ namespace Cli
|
||||
return selection;
|
||||
}
|
||||
|
||||
private async Task PushTagsToRemote(string workingDir)
|
||||
private async Task PushToRemote(string workingDir)
|
||||
{
|
||||
try
|
||||
{
|
||||
var output = await _mediator.Send(new PushTagsToRemote.Command(workingDir));
|
||||
AnsiConsole.Write(output);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AnsiConsole.Markup("[red]Error:[/] Tag was written but unable to push to remote\n\n");
|
||||
AnsiConsole.WriteException(ex);
|
||||
Environment.Exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task PushCommitsToRemote(string workingDir)
|
||||
{
|
||||
try
|
||||
{
|
||||
var output = await _mediator.Send(new PushCommitsToRemote.Command(workingDir));
|
||||
AnsiConsole.Write(output);
|
||||
await _mediator.Send(new PushCommitsToRemote.Command(workingDir));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<PackageId>Novaloop.UpdateTag</PackageId>
|
||||
<title>Updates the tag of a repo to the next chosen version according the semver symantic.</title>
|
||||
<PackageTags>semver;update-tag;tag;git</PackageTags>
|
||||
<Version>0.1.7</Version>
|
||||
<Version>0.1.5</Version>
|
||||
<Authors>Matthias Langhard</Authors>
|
||||
<Company>Novaloop AG</Company>
|
||||
<PackageProjectUrl>https://gitlab.com/novaloop-oss/novaloop.update-tag</PackageProjectUrl>
|
||||
|
||||
@@ -3,9 +3,9 @@ using System.Threading.Tasks;
|
||||
using Application.Interfaces;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Queries
|
||||
namespace Application.Commands
|
||||
{
|
||||
public class PushCommitsToRemote : IRequestHandler<PushCommitsToRemote.Command, string>
|
||||
public class PushCommitsToRemote : AsyncRequestHandler<PushCommitsToRemote.Command>
|
||||
{
|
||||
private readonly IGitRepoWriteService _gitRepoWriteService;
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Application.Queries
|
||||
_gitRepoWriteService = gitRepoWriteService;
|
||||
}
|
||||
|
||||
public class Command : IRequest<string>
|
||||
public class Command : IRequest
|
||||
{
|
||||
public string RepoPath { get; }
|
||||
|
||||
@@ -24,10 +24,10 @@ namespace Application.Queries
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task<string> Handle(Command request, CancellationToken ct)
|
||||
protected override async Task Handle(Command request, CancellationToken cancellationToken)
|
||||
{
|
||||
return await _gitRepoWriteService.Push(request.RepoPath, ct);
|
||||
await _gitRepoWriteService.PushTags(request.RepoPath);
|
||||
await _gitRepoWriteService.Push(request.RepoPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Application.Interfaces
|
||||
@@ -6,7 +5,7 @@ namespace Application.Interfaces
|
||||
public interface IGitRepoWriteService
|
||||
{
|
||||
void AddTag(string repoPath, string tag);
|
||||
Task<string> PushTags(string repoPath, CancellationToken cancellationToken);
|
||||
Task<string> Push(string repoPath, CancellationToken ct);
|
||||
Task<string> PushTags(string repoPath);
|
||||
Task<string> Push(string repoPath);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Application.Interfaces;
|
||||
using MediatR;
|
||||
|
||||
namespace Application.Queries
|
||||
{
|
||||
public class PushTagsToRemote : IRequestHandler<PushTagsToRemote.Command, string>
|
||||
{
|
||||
private readonly IGitRepoWriteService _gitRepoWriteService;
|
||||
|
||||
public PushTagsToRemote(IGitRepoWriteService gitRepoWriteService)
|
||||
{
|
||||
_gitRepoWriteService = gitRepoWriteService;
|
||||
}
|
||||
|
||||
public class Command : IRequest<string>
|
||||
{
|
||||
public string RepoPath { get; }
|
||||
|
||||
public Command(string repoPath)
|
||||
{
|
||||
RepoPath = repoPath;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task<string> Handle(Command request, CancellationToken ct)
|
||||
{
|
||||
return await _gitRepoWriteService.PushTags(request.RepoPath, ct);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Application.Interfaces;
|
||||
using CliWrap;
|
||||
@@ -15,21 +14,21 @@ namespace Infrastructure.Services
|
||||
repo.ApplyTag(tag);
|
||||
}
|
||||
|
||||
public async Task<string> PushTags(string repoPath, CancellationToken ct)
|
||||
public async Task<string> PushTags(string repoPath)
|
||||
{
|
||||
var result = await Cli.Wrap("git")
|
||||
.WithArguments("push --tags")
|
||||
.WithWorkingDirectory(repoPath)
|
||||
.ExecuteBufferedAsync(ct);
|
||||
.ExecuteBufferedAsync();
|
||||
return result.StandardOutput.Trim();
|
||||
}
|
||||
|
||||
public async Task<string> Push(string repoPath, CancellationToken ct)
|
||||
public async Task<string> Push(string repoPath)
|
||||
{
|
||||
var result = await Cli.Wrap("git")
|
||||
.WithArguments("push")
|
||||
.WithWorkingDirectory(repoPath)
|
||||
.ExecuteBufferedAsync(ct);
|
||||
.ExecuteBufferedAsync();
|
||||
|
||||
return result.StandardOutput.Trim();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user