Skip to content

Commit 6060d58

Browse files
authored
Merge pull request #5 from wild-devops/develop
v1.3.0
2 parents 545759e + 10c97bb commit 6060d58

File tree

96 files changed

+539
-148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+539
-148
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@master
1313
- name: Run tests
14-
run: pwsh -NoLogo -NoProfile -File ./tests/pwshake.Tests.ps1
14+
run: ./tests/pwshake.Tests.ps1
15+
shell: pwsh

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*.log
2-
.*/
2+
.*/
3+
*.xml

README.md

Lines changed: 2 additions & 0 deletions

doc/config.md

Lines changed: 20 additions & 0 deletions

doc/invoke_tasks.md

Lines changed: 2 additions & 2 deletions

doc/resources.md

Lines changed: 35 additions & 0 deletions

doc/templates.md

Lines changed: 30 additions & 6 deletions

examples/1.hello/v1.0/my_pwshake.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Simple task invokation and attributes interpolation
2+
attributes:
3+
hello_to: PWSHAKE
4+
5+
tasks:
6+
say_hello:
7+
- powershell: Write-Host "Hello {{hello_to}}!"
8+
9+
invoke_tasks:
10+
- say_hello

examples/1.hello/v1.2/my_pwshake.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
attributes:
2+
hello_to: PWSHAKE
3+
4+
# Simple template substitution
5+
templates:
6+
echo:
7+
powershell: Write-Host "$($step.echo)"
8+
9+
tasks:
10+
say_hello:
11+
- echo: "Hello {{hello_to}}!"
12+
13+
invoke_tasks:
14+
- say_hello

examples/1.hello/v1.3/my_pwshake.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
attributes:
2+
pwshake_verbosity: Normal # Try to change with any of: Error, Warning, Normal, Verbose, Debug
3+
hello_to: PWSHAKE
4+
5+
tasks:
6+
say_hello:
7+
# 'echo' template is now included in the built-in templates
8+
- echo: "Hello {{hello_to}}!"
9+
10+
invoke_tasks:
11+
- say_hello
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
attributes:
2+
a:
3+
b:
4+
c: d
5+
e: "{{a.b.c}}"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
attributes:
2+
a: "{{b}}"
3+
b: "{{c}}"
4+
c: "d"
5+
env_name: "{{$env:HOSTNAME}}"
6+
override_to: "{{c}}ev"
7+
win_fqdn: "{{env_name}}-windows.shake.{{override_to}}"
File renamed without changes.
File renamed without changes.

examples/pwshake_config.yaml renamed to examples/4.complex/v1.0/complex_pwshake.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Includes
22
includes:
33
- attributes.json
4-
- hello_pwshake.yaml
5-
- empty_tasks_pwshake.yaml
64

75
# Attributes overrides
86
attributes_overrides:

examples/pwshake_create_env.yaml renamed to examples/4.complex/v1.0/create_env_pwshake.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
# Tasks declared
22
roles:
3-
update_chef:
4-
- powershell: Write-Host "Here chef step."
5-
deploy_role:
6-
- powershell: Write-Host "Deploy role $($env:shake_application_role)"
7-
- powershell: Write-Host "Here firewall rules for $($env:shake_application_role)"
83
role_webui:
9-
- powershell: $env:shake_application_role = 'webui'
4+
- powershell: $script:shake_application_role = 'webui'
105
- invoke_tasks:
116
- deploy_role
127
role_api:
13-
- powershell: $env:shake_application_role = 'api'
8+
- powershell: $script:shake_application_role = 'api'
149
- invoke_tasks:
1510
- deploy_role
1611
role_static:
1712
scripts:
18-
- powershell: $env:shake_application_role = 'static'
13+
- powershell: $script:shake_application_role = 'static'
1914
- in: attributes_overrides
2015
pwsh: |
2116
Get-Location
@@ -32,6 +27,11 @@ roles:
3227
- role_api
3328
- role_static
3429
- pwsh: Write-Host "{{$([System.Guid]::Empty)}}"
30+
update_chef:
31+
- powershell: Write-Host "Here chef step."
32+
deploy_role:
33+
- powershell: Write-Host "Deploy role $shake_application_role"
34+
- powershell: Write-Host "Here firewall rules for $shake_application_role"
3535

3636
# Tasks to execute
3737
invoke_tasks:
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

examples/module/pwshake.yaml renamed to examples/4.complex/v1.0/module/pwshake.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
attributes:
2-
py_arg: 0
2+
py_arg: 42
3+
pwsh_arg:
34

45
includes:
56
- module.json
@@ -25,7 +26,7 @@ tasks:
2526
pwsh: |
2627
Invoke-Command -ScriptBlock {
2728
if ($true) {
28-
& '{{pwshake_path}}/call_throw.ps1' 'pwshake{{py_arg}}'
29+
& '{{pwshake_path}}/call_throw.ps1' 'dir{{pwsh_arg}}'
2930
}
3031
} -InformationAction Ignore -ErrorAction Stop
3132
File renamed without changes.
File renamed without changes.

examples/msbuild_pwshake.yaml renamed to examples/5.templates/v1.2/msbuild_pwshake.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
includes:
2-
- templates/templates.yaml
2+
- templates/dotnet.yaml
33

44
attributes:
55
configuration: Release

examples/templates/python_pwshake.yaml renamed to examples/5.templates/v1.2/python_pwshake.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
includes:
2-
- python.yaml
2+
- templates/python.yaml
33

44
tasks:
55
test_python_template:
@@ -9,8 +9,7 @@ tasks:
99
- python:
1010
inline: print('Hello pwshake!');
1111
- python:
12-
file: |
13-
{{pwshake_path}}/hello.py again
12+
file: '{{pwshake_path}}/hello.py again'
1413
- python: '{{pwshake_path}}/hello.py twice'
1514

1615
invoke_tasks:
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
templates:
2+
dotnet:
3+
command:
4+
options: --version
5+
powershell: |
6+
$cmd = "dotnet"
7+
if ($step.command) {
8+
$cmd += " $($step.command)"
9+
}
10+
if ($step.options) {
11+
$cmd += " $($step.options)"
12+
}
13+
$cmd | Cmd-Shell
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
templates:
2+
file:
3+
path:
4+
content:
5+
encoding: UTF8
6+
powershell: |
7+
if (-not (Test-Path $step.path)) { New-Item -ItemType File -Path $step.path }
8+
Set-Content -Path (Resolve-Path $step.path) -Value $step.content -Encoding $step.encoding -Force

examples/templates/templates.yaml renamed to examples/5.templates/v1.2/templates/transform_xml_file.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
templates:
2-
dotnet:
3-
command:
4-
options: --version
5-
powershell: |
6-
"dotnet $($step.command) $($step.options)" | Cmd-Shell
7-
82
transform_xml_file:
93
path:
104
appends:
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
includes:
2+
- templates/file.yaml
3+
- templates/transform_xml_file.yaml
4+
5+
tasks:
6+
transform_xml_config:
7+
- file:
8+
path: '{{pwshake_path}}/test.xml'
9+
content: |
10+
<xml>
11+
<one />
12+
<two three="wrong" />
13+
<six seven="wrong" />
14+
</xml>
15+
- pwsh: |
16+
Write-Host "Initial content:"
17+
Get-Content {{pwshake_path}}/test.xml -Raw
18+
- transform_xml_file:
19+
path: test.xml
20+
appends:
21+
'/xml': '<five six="seven" />'
22+
'/xml/five[1]': '<eight nine="ten" />'
23+
updates:
24+
'/xml/two/@three': 'four'
25+
removes:
26+
'/xml/six[@seven="wrong"]':
27+
- pwsh: |
28+
Write-Host "Transform result:"
29+
Get-Content {{pwshake_path}}/test.xml -Raw
30+
Remove-Item {{pwshake_path}}/test.xml -Force
31+
32+
invoke_tasks:
33+
- transform_xml_config
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
attributes:
2+
test_path: '{{pwshake_path}}/hello.json'
3+
4+
tasks:
5+
test_new_actions:
6+
- echo: 'Creating: {{test_path}}'
7+
- file:
8+
path: '{{test_path}}'
9+
content: '$(@{"I"="m";"a"="test"} | ConvertTo-Json)'
10+
- echo: 'Checking: {{test_path}}'
11+
- echo: '$(Get-Content {{test_path}} -Raw)'
12+
- echo: 'Removing: {{test_path}}'
13+
- pwsh: Remove-Item {{test_path}} -Force
14+
15+
invoke_tasks:
16+
- test_new_actions

examples/6.errors/v1.3/corrupted.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Added Yaml parser errors handling
2+
corrupted:
3+
step:
4+
step:

0 commit comments

Comments
 (0)