Skip to content

PWSH Shell cannot be used with FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY set to false

Summary

While trying to fadd integration test for pwsh on kubernetes (issue #27511 (closed)), I realized that the integration test failed when the FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY flag is set to false with the following error message: ERROR: Job failed (system failure): prepare environment: setting up scripts configMap: kubernetes executor incorrect shell type. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information

The same integration just runs fine with the FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY flag sets to true

An issue is already related but I don't think it does take in account the ability to set the shell to pwsh

Steps to reproduce

  • Start runner with the toml config as below
  • Set a project with the .gitlab-ci.yml file as below using the runner started above
  • Make a commit to start the pipeline
.gitlab-ci.yml
variables:
  FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY: "false"

job:
  script:
  - Write-Output $PSVersionTable

Actual behavior

The job fails with an error

Expected behavior

The job should pass as when the FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY flag is set to true. The job log should then look like follow :

Job Log when the FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY flag is set to true
Running with gitlab-runner development version (HEAD)
  on kubernetes UZjr6Ybk
Resolving secrets
Preparing the "kubernetes" executor
Using Kubernetes namespace: default
Using Kubernetes executor with image mcr.microsoft.com/powershell:7.1.1-alpine-3.12-20210125 ...
Preparing environment
WARNING: Pulling GitLab Runner helper image from Docker Hub. Helper image is migrating to registry.gitlab.com, for more information see https://docs.gitlab.com/runner/configuration/advanced-configuration.html#migrate-helper-image-to-registrygitlabcom
Waiting for pod default/runner-uzjr6ybk-project-24422682-concurrent-09mz9h to be running, status is Pending
Running on runner-uzjr6ybk-project-24422682-concurrent-09mz9h via 
Olatoundes-MacBook-Pro.local...
Getting source from Git repository
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/ratchade/playground/.git/
Created fresh repository.
Checking out 9050ad96 as master...
git-lfs/2.11.0 (GitHub; linux amd64; go 1.13.11; git fceccfb7bd)
Skipping Git submodules setup
Executing "step_script" stage of the job script
$ Write-Output $PSVersionTable
Name                           Value
----                           -----
PSVersion                      7.1.1
PSEdition                      Core
GitCommitId                    7.1.1
OS                             Linux 5.10.25-linuxkit #1 SMP Tue Mar 23 09:27:…
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Cleaning up file based variables
Job succeeded

Relevant logs and/or screenshots

job log
Running with gitlab-runner development version (HEAD)
  on kubernetes UZjr6Ybk
  feature flags: FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY:false
Resolving secrets
Preparing the "kubernetes" executor
Using Kubernetes namespace: default
Using Kubernetes executor with image mcr.microsoft.com/powershell:7.1.1-alpine-3.12-20210125 ...
Using attach strategy to execute scripts...
Preparing environment
ERROR: Job failed (system failure): prepare environment: setting up scripts configMap: kubernetes executor incorrect shell type. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information

Environment description

config.toml contents
[[runners]]
  name = "kubernetes"
  url = "https://gitlab.com/"
  token = "TOKEN_HERE"
  shell = "pwsh"
  executor = "kubernetes"
  [runners.kubernetes]
    image = "mcr.microsoft.com/powershell:7.1.1-alpine-3.12-20210125"
    namespace = "default"

Used GitLab Runner version

Running with gitlab-runner 13.11.0