Skip to content

Conversation

@IanButterworth
Copy link

@IanButterworth IanButterworth commented Mar 7, 2025

Closes #83

I found that this pre-exit hook isn't picking up additions to BUILDKITE_ENV_FILE so I added a source here.

I also was hitting an issue where sourcing BUILDKITE_ENV_FILE threw unbound variable errors like below because of scripts stored in env vars. I assume they're not escaped enough? Perhaps thats a bug?

...
BUILDKITE_SCRIPT_PATH="echo \"--- Download test results from test job\"\n# Debug: Verify env file contents\ncat \"$BUILDKITE_ENV_FILE\"\n\necho \"BUILDKITE_PLUGIN_TEST_COLLECTOR_JOB_ID=$BUILDKITE_PLUGIN_TEST_COLLECTOR_JOB_ID\"\nbuildkite-agent artifact download --step \"test_aarch64-apple-darwin\" \"results*.json\" . \|\| true\n"
BUILDKITE_BUILD_AUTHOR="Ian Butterworth"
...

caused

/tmp/job-env-019573a5-4a0a-47d5-8a51-c0ad52c802c63733389565: line 12: BUILDKITE_PLUGIN_TEST_COLLECTOR_JOB_ID: unbound variable

I think the same would happen with BUILDKITE_COMMAND.

Hence why I added set +u around the source.

@IanButterworth
Copy link
Author

I opted to not source the env var file because of buildkite/agent#3227

This needs a way for steps earlier than when this runs to set job_id. Currently I don't know a way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow assigning report to another job

1 participant