/PoshPipelines

Primary LanguagePowerShellMIT LicenseMIT

Logo

PoshPipelines

Requirements

  • PowerShell 7.x
winget install Microsoft.PowerShell
Install-Module -Name powershell-yaml -AllowClobber -Scope CurrentUser -Force

Install

git clone git@github.com:felipegodias/PoshPipelines.git
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

Powershell Profile

Import-Module <REPOSITORY_PATH>/PoshPipelines.psm1 -Force -ArgumentList <SETTINGS_FILE_PATH>

Usage

Settings.yaml

---
Pipelines:
    pipeline_foo:
        Description: "Prints Hello World"
        Steps:
            - Command: "Write-Host Hello World"
    pipeline_bar:
        Description: "Prints Steps Locations"
        WorkingDirectory: "C:/"
        Steps:
            - Command: "Get-Location | Write-Host"
            - Command: "Get-Location | Write-Host"
              WorkingDirectory: "C:/Users"
            - Command: "Get-Location | Write-Host"

Get-Pipeline (gpi)

Get the details of the given pipeline. If the pipeline does not exists or ain't passed to the function this will show all possible pipelines that can be invoked.

Get-Pipeline <PIPELINE_NAME>
gpi <PIPELINE_NAME>

#EXAMPLE 1
Get-Pipeline

#OUTPUT 1
#Name         Description
#----         -----------
#pipeline_bar Prints Steps Locations
#pipeline_foo Prints Hello World

#EXAMPLE 2
Get-Pipeline pipeline_foo

#OUTPUT 2
#Name             : pipeline_foo
#Description      : Prints Hello World
#WorkingDirectory : 

#Command                WorkingDirectory
#-------                ----------------
#Write-Host Hello World

#EXAMPLE 3
gpi pipeline_bar

#OUTPUT 3
#Name             : pipeline_bar
#Description      : Prints Steps Locations
#WorkingDirectory : C:/

#Command                   WorkingDirectory
#-------                   ----------------
#Get-Location | Write-Host
#Get-Location | Write-Host C:/Users
#Get-Location | Write-Host

Invoke-Pipeline (ipi)

Invokes all the steps from the given pipeline.

Invoke-Pipeline <PIPELINE_NAME>
ipi <PIPELINE_NAME>

#EXAMPLE 1
Invoke-Pipeline pipeline_foo

#OUTPUT 1
#Hello World

#EXAMPLE 2
ipi pipeline_bar

#OUTPUT 2
#C:\
#C:\Users
#C:\