Skip to content

Custom job shell

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Release notes

Gitlab can build on many platforms, but some systems, including docker images require complex bootstrapping before a build can be started.

By default, gitlab executes builds in /bin/sh on unix/linux and powershell for windows. This feature would let developers specify the shell to be used for the scripts in a job directly in the gitlab YAML.

Intended users

Any developer:

User experience goal

A developer should be able to specify any shell program and have the job scripts execute within it. The shell can be anything that can accept a single file as an argument (that file contains the script content), eg:

/bin/sh
/usr/local/bin/python
powershell
cmd
perl

Proposal

Example yaml:

job:
  image: docker:dind
  shell: dockerd-entrypoint.sh /bin/sh
  script:
    - docker run --rm -v $(pwd):/mounted ....

or even

job:
  image: python:3.7
  shell: python
  script:
    - import os
    - print("hello world, cwd={}".format(os.getcwd())

Permissions and Security

No extra permissions beyond being able to trigger a pipeline

Edited by 🤖 GitLab Bot 🤖