PINF-703 add token login support to autheticate with token passing#2157
Open
pgvishnuram wants to merge 4 commits into
Open
PINF-703 add token login support to autheticate with token passing#2157pgvishnuram wants to merge 4 commits into
pgvishnuram wants to merge 4 commits into
Conversation
Coverage Report for CI Build 0Coverage increased (+0.001%) to 45.092%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
There was a problem hiding this comment.
Pull request overview
This PR adds support for authenticating to Astro Private Cloud (software/Houston) using a pre-provided token (intended for CI/CD), bypassing the interactive OAuth/basic-auth acquisition flow when a token is supplied.
Changes:
- Extend
software/auth.Loginto accept an optionaltokenargument and resolve it via a newresolveAuthTokenhelper. - Wire the existing
--token-loginCLI flag through to the software login path (not just cloud login). - Update affected unit tests for the new function signature.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| software/auth/auth.go | Accepts a provided token and skips interactive auth flows when present via resolveAuthToken. |
| software/auth/auth_test.go | Updates Login(...) callsites for the new signature (but currently contains several assertion-guard bugs noted in comments). |
| cmd/auth.go | Passes --token-login value into software login calls. |
| cmd/auth_test.go | Updates softwareLogin test stub signature to include the new token parameter. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| houstonMock.On("ListWorkspaces", nil).Return([]houston.Workspace{{ID: "ck05r3bor07h40d02y2hw4n4v"}, {ID: "test-workspace-id"}}, nil).Once() | ||
| out = &bytes.Buffer{} | ||
| if s.NoError(Login("localhost", false, "test", "test", "0.30.0", houstonMock, out)) { | ||
| if s.NoError(Login("localhost", false, "test", "test", "", "0.30.0", houstonMock, out)) { |
|
|
||
| out := &bytes.Buffer{} | ||
| if s.NoError(Login("localhost", false, "test", "test", "0.30.0", houstonMock, out)) { | ||
| if s.NoError(Login("localhost", false, "test", "test", "", "0.30.0", houstonMock, out)) { |
|
|
||
| out := &bytes.Buffer{} | ||
| if s.NoError(Login("localhost", false, "test", "test", "0.30.0", houstonMock, out)) { | ||
| if s.NoError(Login("localhost", false, "test", "test", "", "0.30.0", houstonMock, out)) { |
|
|
||
| out := &bytes.Buffer{} | ||
| if s.NoError(Login("localhost", false, "test", "test", "0.30.0", houstonMock, out)) { | ||
| if s.NoError(Login("localhost", false, "test", "test", "", "0.30.0", houstonMock, out)) { |
|
|
||
| out := &bytes.Buffer{} | ||
| if s.NoError(Login("dev.astro.io", false, "test", "test", "0.30.0", houstonMock, out)) { | ||
| if s.NoError(Login("dev.astro.io", false, "test", "test", "", "0.30.0", houstonMock, out)) { |
|
|
||
| out := &bytes.Buffer{} | ||
| if s.NoError(Login("test.astro.io", false, "test", "test", "0.30.0", houstonMock, out)) { | ||
| if s.NoError(Login("test.astro.io", false, "test", "test", "", "0.30.0", houstonMock, out)) { |
|
|
||
| out := &bytes.Buffer{} | ||
| if s.ErrorIs(Login("localhost", false, "test", "test", "0.30.0", houstonMock, out), errMockRegistry) { | ||
| if s.ErrorIs(Login("localhost", false, "test", "test", "", "0.30.0", houstonMock, out), errMockRegistry) { |
|
|
||
| out := &bytes.Buffer{} | ||
| if s.ErrorIs(Login("localhost", false, "test", "test", "0.30.0", houstonMock, out), errMockRegistry) { | ||
| if s.ErrorIs(Login("localhost", false, "test", "test", "", "0.30.0", houstonMock, out), errMockRegistry) { |
Comment on lines
+291
to
+305
| // resolveAuthToken returns the provided token when non-empty; otherwise it | ||
| // runs the interactive basic-auth/oAuth flow against Houston to obtain one. | ||
| func resolveAuthToken(token, username, password string, oAuthOnly bool, ctx *config.Context, client houston.ClientInterface) (string, error) { | ||
| if token != "" { | ||
| return token, nil | ||
| } | ||
| authConfig, err := houston.Call(client.GetAuthConfig)(ctx) | ||
| if err != nil { | ||
| return "", err | ||
| } | ||
| if username == "" && !oAuthOnly && authConfig.LocalEnabled { | ||
| username = input.Text(inputUsername) | ||
| } | ||
| return getAuthToken(username, password, authConfig, ctx, client) | ||
| } |
ianbuss
reviewed
Jun 8, 2026
ianbuss
left a comment
Contributor
There was a problem hiding this comment.
Change seems ok, we should test the case where a token is passed in, which I don't think I see here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
APC cloud has a option to pass token as a input param to get authenticated avoiding the whole oauth flow , seems the flow doesnt work from the begining and this adds the missing flow to allow CI/CD systems to get authenticated by passing the token directly
🎟 Issue(s)
https://linear.app/astronomer/issue/PINF-703/broken-cli-token-auth-flow-for-cicd
🧪 Functional Testing
QA should able to pass token string as below format
export APC_CLOUD_TOKEN=xxxxxxx
./astro login --token-login $APC_CLOUD_TOKEN
and see sucessful authtication message
📸 Screenshots
📋 Checklist
make testbefore taking out of draftmake lintbefore taking out of draft