The pwshake.ps1
bootstrapper script contains commands to load all required parts to install the PWSHAKE engine from the source of PSGallery.
It imports PWSHAKE engine as a Powershell module (named pwshake
, surprisingly) that exports a single function Invoke-pwshake
and its alias pwshake
as well.
Then it calls Invoke-pwshake
command with all parameters passed to the bootstrapper.
All parameters are optional since they all have conventional default values:
-
Aliases:
-Path
,-File
,-ConfigFile
Default is:
[string]"$PSScriptRoot\pwshake.yaml"
- i.e.pwshake.yaml
from the same directory as the bootstrapper.Tells to PWSHAKE engine where to find a
yaml
config file that contains all data for execution.Example:
PS>./pwshake.ps1 ./my/custom_pwshake.yaml
Or:
PS>Invoke-pwshake -ConfigPath ./my/custom_pwshake.yaml
Or:
PS>pwshake -Path /home/user/dev/myrepo/custom_pwshake.yaml
-
Aliases:
-RunLists
,-Roles
Default is:
@()
- an empty array, i.e. nothing to override inyaml
config'sinvoke_tasks:
element.Tells to PWSHAKE engine which of
tasks:
element items from the givenyaml
config must be executed.Actually if it's not an empty array, it strongly overrides the content of the
yaml
config'sinvoke_tasks:
element.Example (invokes the only
publish
task):PS>./pwshake.ps1 -Tasks publish
Or (invokes in sequence
clean
,build
andtest
tasks):PS>Invoke-pwshake -Roles @("clean", "build", "test")
Or (the same as previous, but with natural Powershell syntax):
PS>pwshake -RunLists clean, build, test
-
Alias:
-Attributes
Default is:
$null
- i.e. nothing to merge into theyaml
config'sattributes:
element.Gives PWSHAKE engine an ability to populate the
yaml
config'sattributes:
element with an external data (metadata as a term) passed from the outside world (CI server, cloud provider agent, canny developer, etc).The
-MetaData
parameter can accept:- raw
json
string:PS>./pwshake.ps1 -MetaData '{"env_name":"shake42","override_to":"test"}'
- multiline string:
PS>./pwshake.ps1 -MetaData "env_name=shake42$([Environment]::NewLine)override_to=test"
- Powershell
[hashtable]
literal:PS>./pwshake.ps1 -MetaData @{env_name="shake42";override_to="test"}
- path to the
metadata
file which contains simple key value pairs in each row:PS>cat ./metadata env_name=shake42 override_to=test PS>./pwshake.ps1 -MetaData ./metadata ...
- path to the
metadata.json
file which containsjson
object literal:PS>cat ./metadata.json { "env_name": "shake42", "override_to": "test" } PS>Invoke-pwshake -MetaData ./metadata.json ...
- path to the
metadata.yaml
file which containsyaml
representation of theattributes:
element content withoutattributes:
element itself:All listed above options produce the same PWSHAKE engine output:PS>cat ./metadata.yaml env_name: shake42 override_to: test PS>pwshake -MetaData ./metadata.yaml ...
PWSHAKE config: attributes: env_name: "shake42" override_to: "test" pwshake_path: /absolute/path/to/your/working/directory/MyRepo ...
- raw
-
Alias:
-LogLevel
Default is:
Verbose
- for backward compatibility.Available values:
Quiet
- logs nothing, except Powershell host process exceptions, the olny way to check if run was successful - inspect if process (powershell.exe
orpwsh
) exit code was not 0;Error
- logs only script exceptions and third party cli tools failures (exit code is not 0);Warning
- reserved for future;Minimal
- logs only raw scripts and cli tools output passed to stdout, stderr and any Powershell streams;Information
- additionally logs task and step captions before each task\step invocation;Verbose
- additionally logsInvoke-pwshake
call arguments and PWSHAKE config file content after all initialization stages performed by the PWSHAKE engine (merging metadata, attributes interpolation, etc)Debug
- logs tons of tracing information about each action performed during the PWSHAKE config file processing;Silent = Quiet
- alias;Normal = Information
- alias;Default = Verbose
- alias for backward compatibility.
-
Aliases:
-WhatIf
,-Noop
Default is:
$false
- i.e. normal execution.If it's passed as flag (
[switch]
in Powershell terms) the PWSHAKE engine does not execute any actualsteps:
listed inpwshake.yaml
config, rather it only:- includes config data from files listed in
includes:
- merges
attributes:
with-MetaData
input parameter value - overrides
attributes:
with data listed inattributes_overrides:
- interpolates
attributes:
with substitutions like{{blah-blah}}
- arranges
tasks:
according to their dependencies and order inpwshake.yaml
config - invokes
invoke_tasks:
items without actualsteps:
execution
This option is useful for developing complex
pwshake.yaml
configs with many interdependenttasks:
, severalincludes:
items and/or long chains of{{}}
substitutions andattributes_overrides:
PS>./pwshake.ps1 ./my_complex_pwshake.yaml -DryRun
- includes config data from files listed in