-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from wild-devops/develop
Implemented kind of DSL via templates composition
- Loading branch information
Showing
43 changed files
with
780 additions
and
173 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
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
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
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
19 changes: 19 additions & 0 deletions
19
examples/5.templates/v1.4/built_in_templates_override_pwshake.yaml
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,19 @@ | ||
templates: | ||
echo: | ||
text: '...' | ||
color: DarkGreen # this is default | ||
powershell: | | ||
Write-Host (Coalesce $step.echo, $step.text) -ForegroundColor $step.color | ||
tasks: | ||
print_me_in_green: | ||
- echo: I'm not green | ||
print_me_in_cyan: | ||
- echo: | ||
- echo: | ||
text: I'm not cyan | ||
color: Cyan | ||
|
||
invoke_tasks: | ||
- print_me_in_green | ||
- print_me_in_cyan |
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,35 @@ | ||
includes: | ||
- templates/composed.yaml | ||
|
||
tasks: | ||
test_composed_templates: | ||
- 'dotnet versions': | ||
steps: | ||
- 'implicit version': | ||
dotnet: | ||
- 'inline command': | ||
dotnet: --version | ||
- 'explicit command': | ||
dotnet: | ||
command: --version | ||
- 'explicit options': | ||
dotnet: | ||
options: --version | ||
- 'explicit command and options': | ||
dotnet: | ||
command: msbuild | ||
options: /version | ||
- 'nested version': | ||
dotnet_version: | ||
- 'deep nested version': | ||
msbuild_version: | ||
- 'circular reference error': | ||
on_error: continue | ||
circular1: | ||
|
||
test_all: | ||
depends_on: | ||
- test_composed_templates | ||
|
||
invoke_tasks: | ||
- test_all |
31 changes: 31 additions & 0 deletions
31
examples/5.templates/v1.4/nested_and_composed_templates_pwshake.yaml
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,31 @@ | ||
includes: | ||
- nested_templates.yaml | ||
- composed_templates.yaml | ||
- templates/sparse-checkout.yaml | ||
|
||
tasks: | ||
test_nested_composed_templates: | ||
- 'Test each': | ||
each: | ||
items: | ||
- one | ||
- two | ||
- three | ||
action: echo $_ | ||
- 'Prepare sparse-checkout file': | ||
sparse-checkout: | ||
- examples | ||
- doc | ||
- tools | ||
- 'Prepare other sparse-checkout file': | ||
sparse-checkout: | ||
directories: | ||
- tests | ||
- scripts | ||
|
||
test_all: | ||
depends_on: | ||
- test_nested_composed_templates | ||
|
||
invoke_tasks: | ||
- test_all |
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,33 @@ | ||
includes: | ||
- templates/nested.yaml | ||
|
||
tasks: | ||
test_nested_templates: | ||
- 'implicit version': | ||
dotnet: | ||
- 'inline command': | ||
dotnet: --version | ||
- 'explicit command': | ||
dotnet: | ||
command: --version | ||
- 'explicit options': | ||
dotnet: | ||
options: --version | ||
- 'explicit command and options': | ||
dotnet: | ||
command: msbuild | ||
options: /version | ||
- 'nested version': | ||
dotnet_version: | ||
- 'deep nested version': | ||
msbuild_version: | ||
- 'circular reference error': | ||
on_error: continue | ||
circular1: | ||
|
||
test_all: | ||
depends_on: | ||
- test_nested_templates | ||
|
||
invoke_tasks: | ||
- test_all |
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,11 @@ | ||
includes: | ||
- nested.yaml | ||
|
||
templates: | ||
each: | ||
powershell: | | ||
(@() + $step.items) | ForEach-Object { Invoke-Expression $step.action } | ||
steps: | ||
each: | ||
items: $[[$step.steps]] | ||
action: Invoke-Step $config $_ |
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,20 @@ | ||
templates: | ||
dotnet: | ||
command: | ||
options: | ||
powershell: | | ||
& dotnet $(Coalesce $step.command, $step.dotnet, '') $(Coalesce $step.options, $step.dotnet, '--version') | ||
dotnet_version: | ||
dotnet: --version | ||
msbuild_version: | ||
dotnet_version: | ||
command: msbuild | ||
options: /version | ||
circular1: | ||
circular2: | ||
circular2: | ||
circular3: | ||
circular3: | ||
circular4: | ||
circular4: | ||
circular2: |
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,6 @@ | ||
templates: | ||
sparse-checkout: | ||
powershell: | | ||
foreach ($directory in (Coalesce $step.directories, $step['sparse-checkout'])) { | ||
Invoke-Step $config @{echo=$directory} | ||
} |
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,41 @@ | ||
|
||
resources: | ||
- git: | ||
repo: https://github.com/wild-devops/pwshake.git | ||
ref: v1.0.0 | ||
sparses: | ||
- examples | ||
- doc | ||
target: .old_repo | ||
|
||
templates: | ||
git: | ||
repo: | ||
ref: | ||
sparses: | ||
target: | ||
powershell: | | ||
$target = Join-Path -Path $config.attributes.pwshake_path -ChildPath $step.target | ||
if (Test-Path $target) { | ||
Remove-Item -Path $target -Recurse -Force | ||
} | ||
New-Item -Path $target -ItemType Directory | Out-Null | ||
try { | ||
Push-Location $target | ||
git init --quiet | ||
& git remote add origin $($step.repo) | ||
git fetch --quiet --tags --prune --no-progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* | ||
if ($step.sparses) { | ||
git config core.sparsecheckout true | ||
New-Item -Path .git/info/sparse-checkout -ItemType File | Out-Null | ||
foreach ($folder in $step.sparses) { | ||
Add-Content -path .git/info/sparse-checkout -value "/$folder" -Encoding Ascii -Force | ||
} | ||
} | ||
& git checkout --quiet $($step.ref) | ||
} finally { | ||
Pop-Location | ||
} | ||
includes: | ||
- .old_repo/examples/hello_pwshake.yaml |
Oops, something went wrong.