gchq / gchq/ConcourseTools

BUILD_CREATED_BY cannot be interpolated in format_string

Open Beginner friendly
#51 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
17
Forks
3
Avg merge
22h 1m
Merged PRs (30d)
3

Description

`BuildMetadata.format_string()` documents `BUILD_CREATED_BY` as an interpolatable value when Concourse exposes it, but the implementation stores it under the key `$BUILD_CREATED_BY`.

`string.Template` looks up the name without the leading `$`, so an exposed value is still treated as missing:

```python
with mock_environ({"BUILD_CREATED_BY": "alice"}):
TestBuildMetadata().format_string("Created by $BUILD_CREATED_BY")
# KeyError: 'BUILD_CREATED_BY'
```

The mapping should use `BUILD_CREATED_BY` as the key, with regression coverage for the exposed environment variable.

Contributor guide

Open the contributing guide

Research direction

Start with BuildMetadata.format_string() and the TestBuildMetadata test context, using mock_environ with BUILD_CREATED_BY set to alice. Add regression coverage for the exposed environment variable and verify that formatting Created by $BUILD_CREATED_BY no longer raises KeyError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
86/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.