Skip to content

Commit

Permalink
Powershell client (windmill-labs#3551)
Browse files Browse the repository at this point in the history
* init commit of partial functionality

* Simplified layout (matching TS client)

* reworked get & post

webrequest allows more interaction with response

* Added more functionality

* Added cancel and wait for jobs

* todo added

* Async script running and query util

* Added sync script & async flow

* Stop-WindmillExecution

Implementation of `cancel_running` from Python client.
Also changed $Body -> $Data to be more explicit (we don't expect JSON body as the method will convert it for us)

* Added get workspace and job

* added token creation

* Added job cancel cmdlet

* get id token

* Final draft

- Manual testing complete
- Rearranged methods & functions
- Added a bit more functionality

* fixed incomplete synopsis

* added parent job back

dont think it's related to this module. reported finding in discord

* feat: publish CI

---------

Co-authored-by: HugoCasa <[email protected]>
  • Loading branch information
lfanew and HugoCasa authored Apr 18, 2024
1 parent dee52b5 commit 29f746a
Show file tree
Hide file tree
Showing 8 changed files with 853 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/change-versions-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ sed -i '' -e "/\"version\": /s/: .*,/: \"$VERSION\",/" ${root_dirpath}/frontend/
sed -i '' -e "/^version =/s/= .*/= \"$VERSION\"/" ${root_dirpath}/python-client/wmill/pyproject.toml
sed -i '' -e "/^windmill-api =/s/= .*/= \"\\^$VERSION\"/" ${root_dirpath}/python-client/wmill/pyproject.toml
sed -i '' -e "/^version =/s/= .*/= \"$VERSION\"/" ${root_dirpath}/python-client/wmill_pg/pyproject.toml
sed -i '' -e "/^ModuleVersion =/s/= .*/= '$VERSION'/" ${root_dirpath}/powershell-client/WindmillClient/WindmillClient.psd1
# sed -i '' -e "/^wmill =/s/= .*/= \"\\^$VERSION\"/" python-client/wmill_pg/pyproject.toml
sed -i '' -e "/^wmill =/s/= .*/= \">=$VERSION\"/" ${root_dirpath}/lsp/Pipfile
sed -i '' -e "/^wmill_pg =/s/= .*/= \">=$VERSION\"/" ${root_dirpath}/lsp/Pipfile
Expand Down
1 change: 1 addition & 0 deletions .github/change-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ sed -i -e "/\"version\": /s/: .*,/: \"$VERSION\",/" ${root_dirpath}/frontend/pac
sed -i -e "/^version =/s/= .*/= \"$VERSION\"/" ${root_dirpath}/python-client/wmill/pyproject.toml
sed -i -e "/^windmill-api =/s/= .*/= \"\\^$VERSION\"/" ${root_dirpath}/python-client/wmill/pyproject.toml
sed -i -e "/^version =/s/= .*/= \"$VERSION\"/" ${root_dirpath}/python-client/wmill_pg/pyproject.toml
sed -i -e "/^ModuleVersion =/s/= .*/= '$VERSION'/" ${root_dirpath}/powershell-client/WindmillClient/WindmillClient.psd1
# sed -i -e "/^wmill =/s/= .*/= \"\\^$VERSION\"/" ${root_dirpath}/python-client/wmill_pg/pyproject.toml
sed -i -e "/^wmill =/s/= .*/= \">=$VERSION\"/" ${root_dirpath}/lsp/Pipfile
sed -i -e "/^wmill_pg =/s/= .*/= \">=$VERSION\"/" ${root_dirpath}/lsp/Pipfile
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/gallery_on_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Publish powershell-client
on:
push:
tags:
- "v*"
workflow_dispatch:

jobs:
publish_gallery:
runs-on: ubicloud-standard-8
steps:
- uses: actions/checkout@v4
- run: . ./powershell-client/publish.ps1
shell: pwsh
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ any snippets of code that require a positive license check to be activated.
Those snippets and files are under a proprietary and commercial license. Private
and public forks MUST not include any of the above proprietary and commercial
code. Windmill Labs, Inc. provide tools to clean the codebase from those
snippets upon demand. The files under python-client/ deno-client/ go-client/ are
snippets upon demand. The files under python-client/ deno-client/ go-client/ powershell-client/ are
Apache 2.0 Licensed.

The openapi files, including the OpenFlow spec is Apache 2.0 Licensed.
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/lib/script_helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@ export const POWERSHELL_INIT_CODE = `param($Msg, $Dflt = "default value", [int]$
# Import-Module MyModule
# Import-Module WindmillClient
# Connect-Windmill
# Get-WindmillVariable -Path 'u/user/foo'
# the last line of the stdout is the return value
Write-Output "Hello $Msg"`

Expand Down
155 changes: 155 additions & 0 deletions powershell-client/WindmillClient/WindmillClient.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
#
# Module manifest for module 'WindmillClient'
#
# Generated by: hugo
#
# Generated on: 4/18/2024
#

@{

# Script module or binary module file associated with this manifest.
RootModule = 'WindmillClient.psm1'

# Version number of this module.
ModuleVersion = '1.309.3'

# Supported PSEditions
# CompatiblePSEditions = @()

# ID used to uniquely identify this module
GUID = '8a2396f8-2582-400c-a762-cdd6a0699b0b'

# Author of this module
Author = 'Windmill Labs'

# Company or vendor of this module
CompanyName = 'Windmill Labs, Inc'

# Copyright statement for this module
Copyright = '(c) Windmill Labs, Inc 2022'

# Description of the functionality provided by this module
Description = 'Client for the Windmill platform.'

# Minimum version of the PowerShell engine required by this module
# PowerShellVersion = ''

# Name of the PowerShell host required by this module
# PowerShellHostName = ''

# Minimum version of the PowerShell host required by this module
# PowerShellHostVersion = ''

# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# DotNetFrameworkVersion = ''

# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# ClrVersion = ''

# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
# RequiredModules = @()

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
# FormatsToProcess = @()

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = @(
'Connect-Windmill',
'Disconnect-Windmill',
'New-WindmillToken',
'Get-WindmillIdToken',
'Get-WindmillWorkspace',
'Get-WindmillVersion',
'Get-WindmillUser',
'Get-WindmillVariable',
'New-WindmillVariable',
'Set-WindmillVariable',
'Remove-WindmillVariable',
'Get-WindmillResource',
'New-WindmillResource',
'Set-WindmillResource',
'Remove-WindmillResource',
'Invoke-WindmillScript',
'Start-WindmillScript',
'Start-WindmillFlow',
'Stop-WindmillJob',
'Wait-WindmillJob',
'Stop-WindmillExecution',
'Get-WindmillJob',
'Get-WindmillResult')

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()

# Variables to export from this module
VariablesToExport = '*'

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = @()

# DSC resources to export from this module
# DscResourcesToExport = @()

# List of all modules packaged with this module
# ModuleList = @()

# List of all files packaged with this module
# FileList = @()

# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{

PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
# Tags = @()

# A URL to the license for this module.
LicenseUri = 'https://github.com/windmill-labs/windmill/tree/main/LICENSE'

# A URL to the main website for this project.
ProjectUri = 'https://github.com/windmill-labs/windmill/tree/main/powershell-client'

# A URL to an icon representing this module.
# IconUri = ''

# ReleaseNotes of this module
# ReleaseNotes = ''

# Prerelease string of this module
# Prerelease = ''

# Flag to indicate whether the module requires explicit user acceptance for install/update/save
# RequireLicenseAcceptance = $false

# External dependent modules of this module
# ExternalModuleDependencies = @()

} # End of PSData hashtable

} # End of PrivateData hashtable

# HelpInfo URI of this module
# HelpInfoURI = ''

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''

}

Loading

0 comments on commit 29f746a

Please sign in to comment.