Skip to content

Pwsh shell support for kubernetes when legacy execution strategy ff is set to false

What does this MR do?

This MR add the support of shell pwsh to the kubernete executor when the FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY flag is set to false

Why was this MR needed?

The shell pwsh is already supported when the FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY flag is set to true. This MR is needed to not lose this functionality

What's the best way to test this MR?

Three tests using the same TOML config :

config.toml
[[runners]]
  name = "kubernetes"
  url = "https://gitlab.com/"
  token = "YOUR_TOKEN_HERE"
  shell = "pwsh"
  executor = "kubernetes"
  [runners.kubernetes]
    image = "mcr.microsoft.com/powershell"
    namespace = "default"

Successful job

gitlab-ci.yaml
variables:
  FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY: "false"

job:
  script:
  - Write-Output $PSVersionTable "================================="
  - for ($i = 1 ; $i -le 10 ; $i++){ Get-Date; Start-Sleep -s 1; Write-Output "================================="; }
Job succeeds as show in the log


Log

Screen_Shot_2021-05-19_at_10.33.05_PM

Job Failure because of syntax error

gitlab-ci.yaml
variables:
  FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY: "false"

job:
  script:
  - Write-Outputuuu $PSVersionTable "================================="
  - for ($i = 1 ; $i -le 10 ; $i++){ Get-Date; Start-Sleep -s 1; Write-Output "================================="; }
Job fails as show in the log


Log

Screen_Shot_2021-05-19_at_10.40.32_PM

Job Failure because of parser error

gitlab-ci.yaml
variables:
  DURATION: 10
  FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY: "false"


job:
  script:
  - $str = @"`ncn=James "Jim" Smith, cn=James $ Smith, cn=James $ Smith, cn=Sally Wilson + Jones, cn=William O'Brian, cn=William O`Brian, cn=Richard West, cn=Roy Johnson$`n"@
  - Write-Output $PSVersionTable
  - get-childitem| % {write-host $_.length $_.name -separator "`t`t"}
  - echo 'James "Jim" Smith'
  - Write-Host "James $ Smith"
  - Write-Host $str
  - echo $str
  - for ($i = 1 ; $i -le $DURATION ; $i++){ Get-Date; Start-Sleep -s 1; Write-Output "================================="; }
Job fails as show in the log


Log

Screen_Shot_2021-06-02_at_6.39.25_PM

What are the relevant issue numbers?

closes: #27511 (closed) #27758 (closed)

Edited by Romuald Atchadé

Merge request reports