(chore): update utils layout and dapr deps
This commit is contained in:
parent
13e31855f6
commit
dc9182916a
80
utils/engines/release/Invoke-ReleasePackage.ps1
Normal file
80
utils/engines/release/Invoke-ReleasePackage.ps1
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
#requires -Version 7.0
|
||||||
|
#requires -PSEdition Core
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Plugin-driven release engine entry script.
|
||||||
|
#>
|
||||||
|
|
||||||
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
$srcDir = (Resolve-Path (Join-Path $scriptDir '..\..')).Path
|
||||||
|
|
||||||
|
. (Join-Path $srcDir 'modules/Engine/Import-EngineModules.ps1')
|
||||||
|
Import-EngineModules -Engine Release
|
||||||
|
|
||||||
|
$settings = Get-ScriptSettings -ScriptDir $scriptDir
|
||||||
|
$configuredPlugins = Get-ConfiguredPlugins -Settings $settings
|
||||||
|
|
||||||
|
Write-Log -Level 'STEP' -Message '=================================================='
|
||||||
|
Write-Log -Level 'STEP' -Message 'RELEASE ENGINE'
|
||||||
|
Write-Log -Level 'STEP' -Message '=================================================='
|
||||||
|
|
||||||
|
$plugins = $configuredPlugins
|
||||||
|
$engineContext = New-EngineContext -Plugins $plugins -ScriptDir $scriptDir -SrcDir $srcDir -Settings $settings
|
||||||
|
Write-Log -Level 'OK' -Message 'All pre-flight checks passed!'
|
||||||
|
$sharedPluginSettings = $engineContext
|
||||||
|
|
||||||
|
$releaseStageInitialized = $false
|
||||||
|
$releaseHadPluginFailures = $false
|
||||||
|
|
||||||
|
if ($plugins.Count -eq 0) {
|
||||||
|
Write-Log -Level 'WARN' -Message 'No plugins configured in scriptSettings.json.'
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for ($pluginIndex = 0; $pluginIndex -lt $plugins.Count; $pluginIndex++) {
|
||||||
|
$plugin = $plugins[$pluginIndex]
|
||||||
|
|
||||||
|
if ((Test-IsPublishPlugin -Plugin $plugin) -and -not $releaseStageInitialized) {
|
||||||
|
if (Test-PluginRunnable -Plugin $plugin -SharedSettings $sharedPluginSettings -EngineDirectory $scriptDir -WriteLogs:$false) {
|
||||||
|
$remainingPlugins = @($plugins[$pluginIndex..($plugins.Count - 1)])
|
||||||
|
Initialize-ReleaseStageContext -RemainingPlugins $remainingPlugins -SharedSettings $sharedPluginSettings -ArtifactsDirectory $engineContext.artifactsDirectory -Version $engineContext.version
|
||||||
|
$releaseStageInitialized = $true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$pluginSucceeded = Invoke-ConfiguredPlugin -Plugin $plugin -SharedSettings $sharedPluginSettings -EngineDirectory $scriptDir -ContinueOnError:$false
|
||||||
|
if (-not $pluginSucceeded) {
|
||||||
|
$releaseHadPluginFailures = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not $releaseStageInitialized) {
|
||||||
|
$noReleasePluginsLogLevel = if ($engineContext.isNonReleaseBranch) { 'INFO' } else { 'WARN' }
|
||||||
|
Write-Log -Level $noReleasePluginsLogLevel -Message 'No release-stage initialization ran (no enabled publish plugins reached, or none runnable).'
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Log -Level 'OK' -Message '=================================================='
|
||||||
|
if ($releaseHadPluginFailures) {
|
||||||
|
Write-Log -Level 'ERROR' -Message 'RELEASE FAILED'
|
||||||
|
}
|
||||||
|
elseif ($engineContext.PSObject.Properties.Name -contains 'skipPublishPlugins' -and $engineContext.skipPublishPlugins) {
|
||||||
|
Write-Log -Level 'OK' -Message 'RUN COMPLETE (publish skipped by ReleasePublishGuard)'
|
||||||
|
}
|
||||||
|
elseif ($engineContext.isNonReleaseBranch) {
|
||||||
|
Write-Log -Level 'OK' -Message 'NON-RELEASE RUN COMPLETE'
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Log -Level 'OK' -Message 'RELEASE COMPLETE'
|
||||||
|
}
|
||||||
|
Write-Log -Level 'OK' -Message '=================================================='
|
||||||
|
|
||||||
|
if ($engineContext.isNonReleaseBranch -and -not ($engineContext.PSObject.Properties.Name -contains 'skipPublishPlugins' -and $engineContext.skipPublishPlugins)) {
|
||||||
|
$preferredReleaseBranch = Get-PreferredReleaseBranch -EngineContext $engineContext
|
||||||
|
Write-Log -Level 'INFO' -Message "For publish, use an allowed branch (see ReleasePublishGuard.branches), e.g. '$preferredReleaseBranch', and satisfy the guard requirements."
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($releaseHadPluginFailures) {
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
1
utils/engines/release/custom/.gitkeep
Normal file
1
utils/engines/release/custom/.gitkeep
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
||||||
133
utils/engines/release/scriptSettings.json
Normal file
133
utils/engines/release/scriptSettings.json
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft-07/schema",
|
||||||
|
"title": "Release Package Script Settings",
|
||||||
|
"description": "Invoke-ReleasePackage.ps1 plugin settings for maksit-dapr.",
|
||||||
|
"plugins": [
|
||||||
|
{
|
||||||
|
"name": "DotNetReleaseVersion",
|
||||||
|
"stageLabel": "build",
|
||||||
|
"enabled": true,
|
||||||
|
"projectFiles": [
|
||||||
|
"..\\..\\..\\src\\MaksIT.Dapr\\MaksIT.Dapr.csproj"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "DotNetTest",
|
||||||
|
"stageLabel": "test",
|
||||||
|
"enabled": true,
|
||||||
|
"project": "..\\..\\..\\src\\MaksIT.Dapr.Tests",
|
||||||
|
"resultsDir": "..\\..\\..\\testResults"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "QualityGate",
|
||||||
|
"stageLabel": "qualityGate",
|
||||||
|
"enabled": true,
|
||||||
|
"coverageThreshold": 0,
|
||||||
|
"failOnVulnerabilities": true,
|
||||||
|
"projectFiles": [
|
||||||
|
"..\\..\\..\\src\\MaksIT.Dapr\\MaksIT.Dapr.csproj"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "DotNetPack",
|
||||||
|
"stageLabel": "build",
|
||||||
|
"enabled": true,
|
||||||
|
"projectFiles": [
|
||||||
|
"..\\..\\..\\src\\MaksIT.Dapr\\MaksIT.Dapr.csproj"
|
||||||
|
],
|
||||||
|
"artifactsDir": "..\\..\\..\\release"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "DotNetCreateArchive",
|
||||||
|
"stageLabel": "build",
|
||||||
|
"enabled": true,
|
||||||
|
"zipNamePattern": "maksit.dapr-{version}.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ReleasePublishGuard",
|
||||||
|
"stageLabel": "release",
|
||||||
|
"enabled": true,
|
||||||
|
"branches": [
|
||||||
|
"main"
|
||||||
|
],
|
||||||
|
"requireExactTagOnHead": true,
|
||||||
|
"tagVersionMustMatchDotNetRelease": true,
|
||||||
|
"whenRequirementsNotMet": "skip",
|
||||||
|
"requireCleanWorkingTree": false,
|
||||||
|
"ensureTagOnRemote": true,
|
||||||
|
"remoteName": "origin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "GitHub",
|
||||||
|
"stageLabel": "release",
|
||||||
|
"enabled": true,
|
||||||
|
"githubToken": "GITHUB_MAKS_IT_COM",
|
||||||
|
"repository": "https://github.com/MAKS-IT-COM/maksit-core-dapr",
|
||||||
|
"releaseNotesFile": "..\\..\\..\\CHANGELOG.md",
|
||||||
|
"releaseTitlePattern": "Release {version}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "DotNetNuGet",
|
||||||
|
"stageLabel": "release",
|
||||||
|
"enabled": true,
|
||||||
|
"nugetApiKey": "NUGET_MAKS_IT",
|
||||||
|
"source": "https://api.nuget.org/v3/index.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "NpmReleaseVersion",
|
||||||
|
"stageLabel": "build",
|
||||||
|
"enabled": false,
|
||||||
|
"packageJsonPath": "..\\..\\..\\src\\package.json",
|
||||||
|
"syncWorkspaceVersions": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "NpmBuild",
|
||||||
|
"stageLabel": "build",
|
||||||
|
"enabled": false,
|
||||||
|
"workspaceRoot": "..\\..\\..\\src",
|
||||||
|
"useCi": true,
|
||||||
|
"buildScript": "build"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "NpmPublish",
|
||||||
|
"stageLabel": "release",
|
||||||
|
"enabled": false,
|
||||||
|
"npmApiKey": "NPMJS_MAKS_IT",
|
||||||
|
"registry": "https://registry.npmjs.org",
|
||||||
|
"access": "public",
|
||||||
|
"workspaceRoot": "..\\..\\..\\src",
|
||||||
|
"publishOrder": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "DotNetDockerPush",
|
||||||
|
"stageLabel": "release",
|
||||||
|
"enabled": false,
|
||||||
|
"registryUrl": "cr.maks-it.com",
|
||||||
|
"credentialsEnvVar": "CR_MAKS_IT",
|
||||||
|
"projectName": "my-service",
|
||||||
|
"contextPath": "..\\..\\..\\src",
|
||||||
|
"pushLatest": true,
|
||||||
|
"images": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "DotNetHelmPush",
|
||||||
|
"stageLabel": "release",
|
||||||
|
"enabled": false,
|
||||||
|
"chartPath": "..\\..\\..\\helm\\my-service",
|
||||||
|
"ociRepository": "oci://cr.maks-it.com/charts",
|
||||||
|
"credentialsEnvVar": "CR_MAKS_IT",
|
||||||
|
"pushLatest": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "DotNetCleanupArtifacts",
|
||||||
|
"stageLabel": "release",
|
||||||
|
"enabled": true,
|
||||||
|
"includePatterns": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"excludePatterns": [
|
||||||
|
"*.zip"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user