Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ability to delegate authorization to external sources #4864

Merged
merged 4 commits into from
Sep 3, 2024

Conversation

nickking-brt
Copy link
Contributor

what

This change allows administrators to delegate command authorization checks to an external command, in place of a Github team check.

why

This change allows Atlantis installation admins to write custom logic for authorization, without needing to modify Atlantis code. This allows for easier and more flexible integrations with team workflows and business requirements.

@nickking-brt nickking-brt requested review from a team as code owners August 21, 2024 16:49
@nickking-brt nickking-brt requested review from chenrui333, lukemassa and nitrocode and removed request for a team August 21, 2024 16:49
@github-actions github-actions bot added the go Pull requests that update Go code label Aug 21, 2024
@nickking-brt nickking-brt changed the title Add ability to delegate authorization to external sources feat: Add ability to delegate authorization to external sources Aug 21, 2024
@nickking-brt nickking-brt changed the title feat: Add ability to delegate authorization to external sources feat: add ability to delegate authorization to external sources Aug 21, 2024
@jamengual
Copy link
Contributor

Hi @nickking-brt please add docs, as many tests you can and an example in here of how that would work to understand the user flow.

@github-actions github-actions bot added docs Documentation website labels Aug 27, 2024
@nickking-brt
Copy link
Contributor Author

nickking-brt commented Aug 27, 2024

Hi @jamengual, I've added some tests and documentation with some examples. Please let me know if more is needed.

@chenrui333 chenrui333 added the feature New functionality/enhancement label Sep 3, 2024
Copy link
Member

@chenrui333 chenrui333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@GenPage GenPage removed the docs Documentation label Sep 3, 2024
@jamengual jamengual merged commit 9a0c648 into runatlantis:main Sep 3, 2024
28 checks passed
Copy link
Member

@chenrui333 chenrui333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we followup adding some token comment, this would be some breaking change (as it broke the CI right now)

{"level":"error","ts":"2024-09-03T22:40:26.913Z","caller":"events/command_runner.go:161","msg":"Unable to fetch user teams: Your token has not been granted the required scopes to execute this query. The 'name' field requires one of the following scopes: ['read:org', 'read:discussion'], but your token has only been granted the: ['admin:repo_hook', 'repo'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens.","json":{},"stacktrace":"github.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunAutoplanCommand\n\t/home/runner/work/atlantis/atlantis/server/events/command_runner.go:161"}

@nickking-brt
Copy link
Contributor Author

It looks like my change caused user team lookups to always happen, instead of being conditional. I'm working on a fix now to revert that behavior.

@nickking-brt nickking-brt deleted the feat/external-authz branch September 6, 2024 17:09
@jamengual
Copy link
Contributor

Thanks Nick.

a1k0u pushed a commit to a1k0u/atlantis that referenced this pull request Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality/enhancement go Pull requests that update Go code website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants