Skip to content

Commit

Permalink
CI: Fixes kamu-base-with-data-mt image builds (#885)
Browse files Browse the repository at this point in the history
* Images, kamu-base-with-data-mt: add "kamu" to predefined users

* Images, kamu-base-with-data-mt: init-workspace.py use .kamuconfig

* CHANGELOG.md: update
  • Loading branch information
s373r authored Oct 8, 2024
1 parent 5184748 commit f060d0a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Recommendation: for ease of reading, use the following order:
- Updated our crate dependencies so they can be built in isolation
### Fixed
- `--yes / -y` flag: fixed when working from a TTY
- CI: Fixes `kamu-base-with-data-mt` image builds

## [0.204.4] - 2024-09-30
### Changed
Expand Down
3 changes: 3 additions & 0 deletions images/kamu-base-with-data-mt/extra/.kamuconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ version: 1
content:
users:
predefined:
- accountName: kamu
isAdmin: true
avatarUrl: https://avatars.githubusercontent.com/u/50896974?s=200&v=4
- accountName: sh101-bowen
avatarUrl: https://cdn-icons-png.flaticon.com/512/3118/3118054.png
- accountName: sh102-gambier
Expand Down
21 changes: 14 additions & 7 deletions images/kamu-base-with-data-mt/init-workspace.py
Original file line number Diff line number Diff line change
@@ -1,48 +1,55 @@
#!/usr/bin/env python

import os
import sys
import shutil
import subprocess
from pathlib import Path

###############################################################################

CURRENT_PATH = Path(__file__).resolve().parent
S3_REPO_URL = "s3://datasets.kamu.dev/odf/v2/example-mt/"


###############################################################################

def s3_listdir(url):
return [
line.strip().split(' ')[1]
for line in subprocess.run(
f"aws s3 ls {url}",
shell=True,
f"aws s3 ls {url}",
shell=True,
text=True,
check=True,
capture_output=True,
).stdout.splitlines()
]


def s3_cat(url):
return subprocess.run(
f"aws s3 cp {url} -",
shell=True,
f"aws s3 cp {url} -",
shell=True,
text=True,
check=True,
capture_output=True,
).stdout.strip()


###############################################################################

subprocess.run(
"kamu init --multi-tenant --exists-ok",
"kamu init --multi-tenant --exists-ok",
shell=True,
check=True,
)

shutil.copy(CURRENT_PATH / "extra/.kamuconfig", ".kamuconfig")

for did in s3_listdir(S3_REPO_URL):
url = S3_REPO_URL + did
alias = s3_cat(f"{S3_REPO_URL}{did}info/alias")
account, name = alias.split('/', 1)

subprocess.run(
f"kamu --account {account} pull --no-alias {url} --as {name}",
shell=True,
Expand Down

0 comments on commit f060d0a

Please sign in to comment.