buildkite / buildkite/agent

Exported function in environment hook not available in command steps

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

Description

Hi there,

We're in the process of upgrading our buildnodes from v2 to v3 and we've noticed an issue with functions that are exported via `export -f func-name` in the environment hook. When attempting to use `func-name` in the command step, we get a `command not found` error.

The full hook looks like:

```
#!/bin/bash -e

. /var/lib/buildkite-agent/.functions
export -f func-name
```

Where `/var/lib/buildkite-agent/.functions` contains the definition for `func-name`.

I've tried moving this export into other hooks however it doesn't seem to fix the problem.

Is this a known bug/change or are we doing something wrong?

Contributor guide

Open the contributing guide

Research direction

The report identifies a Bash environment hook, /var/lib/buildkite-agent/.functions, and a command step as the reproduction inputs. Start by reproducing the exported func-name failure, then trace how the agent launches hooks and command steps. Done means the function is available in the command step, or the supported behavior is clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, go
Domain
ci-cd, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.