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

core: version-chooser: allow setting bootstrap repo and tag #2397

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion core/services/versionchooser/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ async def get_bootstrap_version() -> Any:
async def set_bootstrap_version(request: web.Request) -> Any:
data = await request.json()
tag = data["tag"]
return await versionChooser.set_bootstrap_version(tag)
repo = data.get("repo", "bluerobotics/blueos-bootstrap")
return await versionChooser.set_bootstrap_version(tag, repo)


async def load(request: web.Request) -> Any:
Expand Down
3 changes: 3 additions & 0 deletions core/services/versionchooser/openapi/versionchooser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ paths:
tag:
type: string
example: master
repo:
type: string
example: bluerobotics/blueos-bootstrap

/version/restart:
post:
Expand Down
4 changes: 2 additions & 2 deletions core/services/versionchooser/utils/chooser.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ async def get_bootstrap_version(self) -> str:
logger.critical(f"unable to read bootstrap version: {e}")
return "Unknown"

async def set_bootstrap_version(self, tag: str) -> web.StreamResponse:
async def set_bootstrap_version(self, tag: str, repo: str) -> web.StreamResponse:
"""Set the bootstrap container to a new version.

Stops the current bootstrap container, renames it to a backup,
Expand Down Expand Up @@ -197,7 +197,7 @@ async def set_bootstrap_version(self, tag: str) -> web.StreamResponse:

HOME = "/root"
bootstrap_config = {
"Image": f"bluerobotics/blueos-bootstrap:{tag}",
"Image": f"{repo}:{tag}",
"HostConfig": {
"RestartPolicy": {"Name": "unless-stopped"},
"NetworkMode": "host",
Expand Down
Loading