Skip to content

Commit

Permalink
Modern Configuration Builder (v16.x) Part 1 (#2241)
Browse files Browse the repository at this point in the history
The new config will support:

- **appsettings.json** - With defaults for many settings here rather
than in code.
- **Environment Settings** - Enables the ability to override settings
with, for example, `MigratonTools:Target:PersonalAccessToken` as an
environment variable.
- **Console Overides** - Enables any setting to be passed via the
console.

These changes are a prelude to creating a configuration command that
allows users to change the settings and reduce the failure from manual
changes. Will also allow greater flexibility and use of the Options
Pattern as much as possible.

This will trigger a bump to 16.0 as its a major config change and the
code will adapt the new configs to the old model for legacy support..

Todo List:

- [x] Move all setting defaults to **appsettings.json**
- [x] Load settings where possible directly from config (options)
- [x] Map back to old format
- [x] Create TfsWorkItemTypeMapping
- [x] Create TTfsGitRepoMappings
- [x] Create TTfsFieldMappings
- [x] Create TTfsChangeSetMapping
- [x] ~Create convertor from Old EngineConfig to new Options loading~
- [x] Update Processors to
#2292
- [x] Add Writable solution with
https://stackoverflow.com/questions/40970944/how-to-update-values-into-appsetting-json
- [x] Soruce & Target
- [x] Version
- [x] Create new test strategy for main elements like processors
- [ ] Update the docs with new getting started.
  • Loading branch information
MrHinsh authored Aug 29, 2024
2 parents 1297af4 + b83b4ab commit 8a0f516
Show file tree
Hide file tree
Showing 655 changed files with 26,904 additions and 14,279 deletions.
59 changes: 51 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ jobs:
nkdAgility_ReleaseDescription: ${{ steps.nkdagility.outputs.release_description }}
nkdAgility_ReleaseDescriptionState: ${{ steps.nkdagility.outputs.release_description_state }}
nkdAgility_DocsDeployFolder: ${{ steps.nkdagility.outputs.docs_deploy_folder }}
nkdAgility_DocsBaseURL: ${{ steps.nkdagility.outputs.docs_baseURL }}
nkdAgility_DocsVersionFolder: ${{ steps.nkdagility.outputs.docs_version_folder }}
nkdAgility_RunRelease: ${{ steps.nkdagility.outputs.RunRelease }}

steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -88,32 +90,46 @@ jobs:
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
# Get Branch Name
Write-Output "::group::Get Branch Name"
Write-Output "-------------------------------------------"
$branchName = "${{ github.head_ref || github.ref_name }}"
Write-Output "We are running on: $branchName!"
$branchSafeName = $branchName.Replace("/", "-")
Write-Output "branchSafeName: $branchSafeName!"
Write-Output "-------------------------------------------"
Write-Output "::endgroup::"
# Ring Setup
Write-Output "::group::Ring Control Setup"
Write-Output "-------------------------------------------"
Write-Output "Ring Control Setup"
Write-Output "-------------------------------------------"
$Ring = "Canary"
$WingetApplicationId = "nkdagility.azure-devops-migration-tools"
$docs_deploy_folder = "./azure-devops-migration-tools/";
$docs_baseURL = "/learn/azure-devops-migration-tools"
$RunCodeRelease = 'false'
$RunDocsRelease = 'false'
switch ($Env:GitVersion_PreReleaseLabel) {
"" {
$Ring = "Release";
$WingetApplicationId = "nkdagility.azure-devops-migration-tools";
$docs_deploy_folder = "./azure-devops-migration-tools/"
$docs_baseURL = "/learn/azure-devops-migration-tools"
$RunRelease = 'true'
}
"Preview" {
$Ring = "Preview";
$WingetApplicationId = "nkdagility.azure-devops-migration-tools.Preview";
$docs_deploy_folder = "./azure-devops-migration-tools/preview/";
$docs_baseURL = "/learn/azure-devops-migration-tools/preview/"
$RunRelease = ( ('${{ inputs.ForceRelease }}' -eq 'true' ) -or ('${{ steps.filter.outputs.src }}' -eq 'true') -or ('${{ steps.filter.outputs.docs }}' -eq 'true') )
}
default {
$Ring = "Canary";
$WingetApplicationId = "nkdagility.azure-devops-migration-tools.Canary";
$docs_deploy_folder = "./azure-devops-migration-tools/canary/"
$docs_deploy_folder = "./azure-devops-migration-tools/canary/$branchSafeName"
$docs_baseURL = "/learn/azure-devops-migration-tools/canary/$branchSafeName"
$RunRelease = 'false'
}
}
Expand All @@ -123,19 +139,24 @@ jobs:
echo "WingetApplicationId=$WingetApplicationId" >> $env:GITHUB_OUTPUT
Write-Output "docs_deploy_folder=$docs_deploy_folder"
echo "docs_deploy_folder=$docs_deploy_folder" >> $env:GITHUB_OUTPUT
Write-Output "docs_baseURL=$docs_baseURL"
echo "docs_baseURL=$docs_baseURL" >> $env:GITHUB_OUTPUT
Write-Output "RunRelease=$RunRelease"
echo "RunRelease=$RunRelease" >> $env:GITHUB_OUTPUT
Write-Output "-------------------------------------------"
Write-Output "::endgroup::"
# Docs Setup
Write-Output "::group::Docs Setup"
Write-Output "-------------------------------------------"
Write-Output "Docs"
Write-Output "-------------------------------------------"
$docs_version_folder = "/azure-devops-migration-tools/$Env:GitVersion_SemVer"
Write-Output "docs_version_folder=$docs_version_folder"
echo "docs_version_folder=$docs_version_folder" >> $env:GITHUB_OUTPUT
Write-Output "-------------------------------------------"
Write-Output "::endgroup::"
# Get-ReleaseDescription
Write-Output "::group::Release Description Setup"
Write-Output "-------------------------------------------"
Write-Output "Get-ReleaseDescription"
Write-Output "-------------------------------------------"
Expand All @@ -154,6 +175,7 @@ jobs:
echo $description >> $env:GITHUB_OUTPUT
echo "$EOF" >> $env:GITHUB_OUTPUT
Write-Output "-------------------------------------------"
Write-Output "::endgroup::"
- uses: actions/upload-artifact@v4
with:
Expand All @@ -166,7 +188,7 @@ jobs:
runs-on: ubuntu-latest
needs: Setup
steps:
- name: "Create Summery"
- name: "Show Summery"
if: always()
shell: pwsh
id: nkdagility-summery
Expand All @@ -178,6 +200,7 @@ jobs:
- nkdAgility_WingetApplicationId: ${{needs.Setup.outputs.nkdAgility_WingetApplicationId}}
- nkdAgility_DocsVersionFolder: ${{needs.Setup.outputs.nkdAgility_DocsVersionFolder}}
- nkdAgility_DocsDeployFolder: ${{needs.Setup.outputs.nkdAgility_DocsDeployFolder}}
- nkdAgility_DocsBaseURL: ${{needs.Setup.outputs.nkdAgility_DocsBaseURL}}
- nkdAgility_ReleaseDescriptionState: ${{needs.Setup.outputs.nkdAgility_ReleaseDescriptionState}}
- nkdAgility_RunRelease: ${{needs.Setup.outputs.nkdAgility_RunRelease}}
### GitVersion
Expand All @@ -191,6 +214,15 @@ jobs:
- HasChanged_src: ${{needs.Setup.outputs.HasChanged_src}}
- HasChanged_docs: ${{needs.Setup.outputs.HasChanged_docs}}
- HasChanged_automation: ${{needs.Setup.outputs.HasChanged_automation}}
"@
echo $markdown >> $Env:GITHUB_STEP_SUMMARY
- name: "Show Release Description"
if: always()
shell: pwsh
id: nkdAgility_ReleaseDescription
run: |
Write-Host "::debug::nkdAgility_ReleaseDescription | $Env:GITHUB_STEP_SUMMARY"
$markdown = @"
## nkdAgility_ReleaseDescription
${{needs.Setup.outputs.nkdAgility_ReleaseDescription}}
"@
Expand Down Expand Up @@ -291,6 +323,12 @@ jobs:
GitVersion_InformationalVersion: ${{ needs.Setup.outputs.GitVersion_InformationalVersion }}
steps:
- uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0
with:
ruby-version: '3.2' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
- uses: cschleiden/replace-tokens@v1
with:
files: '["**/*.html"]'
Expand All @@ -304,8 +342,13 @@ jobs:
- uses: igsekor/[email protected]
id: spellcheck
name: Spellcheck
- name: Build Jekyll
uses: jerryjvl/jekyll-build-action@v1
- name: Build with Jekyll
# Outputs to the './_site' directory by default
run: bundle exec jekyll build --baseurl "${{needs.Setup.outputs.nkdAgility_DocsBaseURL}}"
env:
JEKYLL_ENV: production
# - name: Build Jekyll
# uses: jerryjvl/jekyll-build-action@v1
- uses: actions/upload-artifact@v4
with:
name: AzureDevOpsMigrationTools-Site
Expand Down Expand Up @@ -473,8 +516,8 @@ jobs:
DocsRelease:
name: "Release to Docs"
runs-on: ubuntu-latest
needs: [Setup, BuildDocs, GitHubRelease]
if: ${{ success() && ( needs.Setup.outputs.nkdAgility_RunRelease == 'true' ) }}
needs: [Setup, BuildDocs]
if: ${{ success() }}
steps:
- name: Download a single artifact
uses: actions/download-artifact@v4
Expand All @@ -493,7 +536,7 @@ jobs:
password: ${{ secrets.NKDAGILITY_LEARN_SFTP }}
port: 2222
# If true, outputs the results of the upload, without actually uploading.
dry-run: ${{ (needs.Setup.outputs.nkdAgility_Ring) == 'Canary' }}
#dry-run: ${{ (needs.Setup.outputs.nkdAgility_Ring) == 'Canary' }}
# A list of folders to upload in the format of `folder/ => upload_folder/`
uploads: |
./_site/ => ${{needs.Setup.outputs.nkdAgility_DocsDeployFolder}}
Expand Down
75 changes: 46 additions & 29 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
bigdecimal (3.1.8)
colorator (1.1.0)
concurrent-ruby (1.2.2)
concurrent-ruby (1.3.4)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
eventmachine (1.2.7)
faraday (2.7.4)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.2)
ffi (1.15.5)
faraday (2.10.1)
faraday-net_http (>= 2.0, < 3.2)
logger
faraday-net_http (3.1.1)
net-http
ffi (1.17.0-x64-mingw-ucrt)
ffi (1.17.0-x86_64-linux-gnu)
forwardable-extended (2.6.0)
google-protobuf (3.22.3-x64-mingw-ucrt)
google-protobuf (4.27.3-x64-mingw-ucrt)
bigdecimal
rake (>= 13)
google-protobuf (4.27.3-x86_64-linux)
bigdecimal
rake (>= 13)
http_parser.rb (0.8.0)
i18n (1.12.0)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
jekyll (4.3.2)
jekyll (4.3.3)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
Expand All @@ -35,12 +43,11 @@ GEM
safe_yaml (~> 1.0)
terminal-table (>= 1.8, < 4.0)
webrick (~> 1.7)
jekyll-github-metadata (2.16.0)
jekyll-github-metadata (2.16.1)
jekyll (>= 3.4, < 5.0)
octokit (>= 4, < 7, != 4.4.0)
jekyll-last-modified-at (1.3.0)
jekyll-last-modified-at (1.3.2)
jekyll (>= 3.7, < 5.0)
posix-spawn (~> 0.3.9)
jekyll-optional-front-matter (0.3.2)
jekyll (>= 3.0, < 5.0)
jekyll-redirect-from (0.16.0)
Expand All @@ -55,7 +62,7 @@ GEM
jekyll (>= 3.7, < 5.0)
jekyll-time-to-read (0.1.2)
jekyll
jekyll-toc (0.18.0)
jekyll-toc (0.19.0)
jekyll (>= 3.9)
nokogiri (~> 1.12)
jekyll-watch (2.2.1)
Expand All @@ -65,40 +72,50 @@ GEM
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.4)
listen (3.8.0)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.6.0)
mercenary (0.4.0)
nokogiri (1.14.3-x64-mingw-ucrt)
net-http (0.4.1)
uri
nokogiri (1.16.7-x64-mingw-ucrt)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
octokit (6.1.1)
faraday (>= 1, < 3)
sawyer (~> 0.9)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
posix-spawn (0.3.15)
public_suffix (5.0.1)
pygments.rb (2.4.0)
racc (1.6.2)
public_suffix (6.0.1)
pygments.rb (3.0.0)
racc (1.8.1)
rake (13.2.1)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
rb-inotify (0.11.1)
ffi (~> 1.0)
rexml (3.2.5)
rouge (4.1.0)
ruby2_keywords (0.0.5)
rexml (3.3.5)
strscan
rouge (4.3.0)
safe_yaml (1.0.5)
sass-embedded (1.62.0-x64-mingw-ucrt)
google-protobuf (~> 3.21)
sass-embedded (1.77.8-x64-mingw-ucrt)
google-protobuf (~> 4.26)
sass-embedded (1.77.8-x86_64-linux-gnu)
google-protobuf (~> 4.26)
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
strscan (3.1.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
unicode-display_width (2.4.2)
unicode-display_width (2.5.0)
uri (0.13.0)
webrick (1.8.1)

PLATFORMS
x64-mingw-ucrt
x86_64-linux

DEPENDENCIES
jekyll-github-metadata
Expand All @@ -115,4 +132,4 @@ DEPENDENCIES
rouge

BUNDLED WITH
2.4.10
2.5.17
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
assembly-versioning-scheme: MajorMinorPatch
mode: ContinuousDelivery
continuous-delivery-fallback-tag: 'Canary'
next-version: 15.0.1
next-version: 16.0.0
branches:
main:
mode: ContinuousDelivery
Expand Down
4 changes: 4 additions & 0 deletions GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using MigrationTools;
using MigrationTools.Enrichers;
using MigrationTools.Processors;
using MigrationTools.Processors.Infrastructure;
Loading

0 comments on commit 8a0f516

Please sign in to comment.