Describe the bug
BKT_TOKEN is intended to support headless/container usage, but currently bkt context create requires host metadata to already exist (which means running bkt auth login first). This blocks first-time workflows that want to supply credentials via BKT_TOKEN only.
To reproduce
Steps to reproduce the behavior:
bkt pr list and other commands fail if no context is provided
bkt context create fails if the host is not authenticated, with "host not found; run bkt auth login first"
bkt auth logon is not compatible with BKT_TOKEN
Expected behavior
When BKT_TOKEN is provided, one of following behaviours:
A/ bkt context create should create host metadata if missing, without requiring that the host is first authenticated
B/ bkt auth logon should successfully create host metadata (without storing the token)
C/ bkt pr list --host X --repo Y should be enough without any context provided
D/ bkt pr list should be enough if BKT_HOST, BKT_PROJECT, BKT_REPO are also provided as env vars (closest to GH CLI behaviour)
Happy to provide PR if can guide on best direction (A, B, C, D or other?)
Environment
- bkt version (
bkt --version): 0.19.0
- OS and architecture: Linux
- Bitbucket deployment (cloud, dc): dc
- Context configuration (workspace/project):
Additional context
GH CLI environment variables:
https://github.com/cli/cli/blob/d0558fcbaad794c343bdfd3efd75d13777c2d42a/pkg/cmd/root/help_topic.go#L52
Describe the bug
BKT_TOKENis intended to support headless/container usage, but currentlybkt context createrequires host metadata to already exist (which means runningbkt auth loginfirst). This blocks first-time workflows that want to supply credentials viaBKT_TOKENonly.To reproduce
Steps to reproduce the behavior:
bkt pr listand other commands fail if no context is providedbkt context createfails if the host is not authenticated, with "host not found; runbkt auth loginfirst"bkt auth logonis not compatible with BKT_TOKENExpected behavior
When BKT_TOKEN is provided, one of following behaviours:
A/
bkt context createshould create host metadata if missing, without requiring that the host is first authenticatedB/
bkt auth logonshould successfully create host metadata (without storing the token)C/
bkt pr list --host X --repo Yshould be enough without any context providedD/
bkt pr listshould be enough if BKT_HOST, BKT_PROJECT, BKT_REPO are also provided as env vars (closest to GH CLI behaviour)Happy to provide PR if can guide on best direction (A, B, C, D or other?)
Environment
bkt --version): 0.19.0Additional context
GH CLI environment variables:
https://github.com/cli/cli/blob/d0558fcbaad794c343bdfd3efd75d13777c2d42a/pkg/cmd/root/help_topic.go#L52