Skip to content

BKT_TOKEN requires regular authentication first #134

@jamesbeilby

Description

@jamesbeilby

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:

  1. bkt pr list and other commands fail if no context is provided
  2. bkt context create fails if the host is not authenticated, with "host not found; run bkt auth login first"
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions