buildkite / buildkite/agent

Run Python/Ruby scripts for hooks instead of Bash

Open
#1,136 12 comments 0 reactions 0 assignees View on GitHub
hook
Dominant language
Go
Stars
1.1k
Forks
378
Avg merge
2d 6h
Merged PRs (30d)
74

Description

All the example plugins I see are 100% bash scripts, but it would be really useful to break into another language like Python or Ruby to be more productive.

I tried making a plugin with a simple Python script but see things like this, where it's running each line as bash rather than respecting the hook file's shebang:

```
/var/lib/buildkite-agent/builds/default-ubuntu-1804-vagrantup-com-1/my-org/my-repo/.buildkite/plugins/my-plugin/hooks/pre-command: line 3: import: command not found
--
```

I set `BUILDKITE_SHELL` to `/bin/bash -eo pipefail -c`, which seems pretty close to the default.

@lox any thoughts? :smile:

Contributor guide

Open the contributing guide

Research direction

Start by tracing how the plugin hook at .buildkite/plugins/my-plugin/hooks/pre-command is invoked and how BUILDKITE_SHELL affects that invocation. Reproduce the Python shebang failure, then verify that hooks written in Python or Ruby are executed by their declared interpreter rather than Bash.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, python, ruby
Domain
ci-cd, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.