Skip to main content

A lemniscat plugin to run powershell scripts

Project description

lemniscat.plugin.powershell

A powershell plugin for lemniscat

Description

This plugin allows you to run powershell commands and scripts in your lemniscat pipeline.

Usage

Pre-requisites

In order to use this plugin, you need to add plugin into the required section of your manifest file.

requirements:
  - name: lemniscat.plugin.powershell
    version: 0.2.0

Running powershell commands

- task: powershell
  displayName: 'Powershell'
  steps:
    - run
  parameters:
    type: inline
    script: |
      $name = "Philippe"
      Write-Host "Hello $name"

Running powershell script

- task: powershell
  displayName: 'Powershell'
  steps:
    - run
  parameters:
    type: file
    filePath: ${{ workingdirectory }}/scripts/Hello.ps1
    fileParams:
      name: ${{ username }}

Running powershell commmands and pass variables through json file

[!NOTE] This feature is particulary recommand when you need to manipulate complexe variable with your task. You can access to the variables in the json file by using the following command:

$location = Get-Location
$variables = Get-Content "$($location.path)/vars.json" | ConvertFrom-Json -Depth 100
- task: powershell
  displayName: 'Powershell'
  steps:
    - run
  parameters:
    type: inline
    script: |
      $location = Get-Location
      $variables = Get-Content "$($location.path)/vars.json" | ConvertFrom-Json -Depth 100
      $version = az --version
      Write-Host "Azure CLI version: $version"
    storeVariablesInFile:
      format: json
      withSecrets: false

Inputs

Parameters

  • type: The type of the command to run. It can be inline or file
  • script: The script to run. It can be a powershell command line. It is used only if type is inline
  • filePath: The path of the powershell script file (*.ps1) to run. It is used only if type is file
  • fileParams: The parameters to pass to the powershell script file. It is used only if type is file
  • storeVariablesInFile: Describe the way to store the variables in a file to used in the task.

StoreVariablesInFile

  • format: The format of the file to store the variables. It can be json or yaml
  • withSecrets: A boolean value to indicate if the secrets should be stored in the file. It can be true or false

Outputs

You can push variables to the lemniscat runtime in order to be used after by other tasks. To do that, you need to use Write-Host command in your powershell script to push variables to the lemniscat runtime. You must use the following format to push variables to the lemniscat runtime: [lemniscat.pushvar] <variableName>=<variableValue>

For example:

Write-Host "[lemniscat.pushvar] workspaceExist=$workspaceExist"

You can specify the sensitivity of the variable by adding secret like this : [lemniscat.pushvar.secret] <variableName>=<variableValue>

For example:

Write-Host "[lemniscat.pushvar.secret] storageAccountKey=$storageAccountKey"

By default all variable are considered as string. If you want to specify the type of the variable, you can add the type after the variable name like this: [lemniscat.pushvar(<variableType>)] <variableName>=<variableValue>

variableType can be string, int, bool, float, json (for complexe object)

For example:

Write-Host "[lemniscat.pushvar(int)] numberOfFiles=$numberOfFiles"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lemniscat_plugin_powershell-0.2.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file lemniscat_plugin_powershell-0.2.1.tar.gz.

File metadata

File hashes

Hashes for lemniscat_plugin_powershell-0.2.1.tar.gz
Algorithm Hash digest
SHA256 bff81cd892b47d40fb7701f9fcf867dae81087c256c7e73db70876d94e3bea9c
MD5 95ded82889720255b1be25a9759725f3
BLAKE2b-256 4fc89c7f881e3e87d74a311a29961b468876e82234be8ad0a8b91ae989a0e3c6

See more details on using hashes here.

File details

Details for the file lemniscat.plugin.powershell-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for lemniscat.plugin.powershell-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 96f0052777701e2213e95d32c84bf4952dca5f4f13edba9cd9c8a8f90169a4cd
MD5 01f8f6c0b28ae018d7dac6d30480d4ff
BLAKE2b-256 554b811262d86f9b801c646061676c243b673132878d1185ac286b45a8f2cf68

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page