-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compatible(integration_test_charm.yaml): Grant full SSH access on Azu…
…re runners (#200) Grant Data Platform team members full SSH access on Azure runners (for debugging) Uses SSH keys associated with GitHub accounts
- Loading branch information
1 parent
2e008de
commit cd382c2
Showing
4 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import importlib.resources | ||
import os | ||
import pathlib | ||
|
||
import requests | ||
|
||
from . import static | ||
|
||
|
||
def main(): | ||
# TODO: use GitHub API to get list of users in `canonical/data-platform` team instead of | ||
# hard-coding (waiting for approval from IS on token request) | ||
# https://docs.github.com/en/rest/teams/members?apiVersion=2022-11-28#list-team-members | ||
user_file = importlib.resources.files(static) / "data_platform_usernames" | ||
users = user_file.read_text(encoding="utf-8").strip().split("\n") | ||
keys = [] | ||
for user in users: | ||
response = requests.get( | ||
f"https://api.github.com/users/{user}/keys", | ||
headers={ | ||
"Accept": "application/vnd.github+json", | ||
"X-GitHub-Api-Version": "2022-11-28", | ||
"Authorization": f'Bearer {os.environ["GH_TOKEN"]}', | ||
}, | ||
) | ||
response.raise_for_status() | ||
for key in response.json(): | ||
keys.append(key["key"]) | ||
authorized_keys = pathlib.Path("~/.ssh/authorized_keys").expanduser() | ||
with authorized_keys.open("a", encoding="utf-8") as file: | ||
file.writelines(f"{key}\n" for key in keys) |
21 changes: 21 additions & 0 deletions
21
python/cli/data_platform_workflows_cli/static/data_platform_usernames
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
delgod | ||
paulomach | ||
taurus-forever | ||
welpaolo | ||
grobbie | ||
juditnovak | ||
dragomirp | ||
deusebio | ||
Batalex | ||
a-velasco | ||
theoctober19th | ||
marceloneppel | ||
phvalguima | ||
MiaAltieri | ||
lucasgameiroborges | ||
Mehdi-Bendriss | ||
marcoppenheimer | ||
zmraul | ||
shayancanonical | ||
reneradoi | ||
carlcsaposs-canonical |
This file contains 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