Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.
Merged
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import asyncclick as click
from jumpstarter_cli_common.exceptions import async_handle_exceptions
from jumpstarter_cli_common.oidc import Config, decode_jwt_issuer, opt_client_id, opt_connector_id
from jumpstarter_cli_common.oidc import Config, decode_jwt_issuer, opt_oidc

from jumpstarter.common.exceptions import FileNotFoundError
from jumpstarter.config import ClientConfigV1Alpha1, ClientConfigV1Alpha1Drivers, ObjectMeta, UserConfigV1Alpha1
Expand All @@ -27,15 +27,6 @@
help="Enter the Jumpstarter client name.",
default=None,
)
@click.option("--username", type=str, help="Enter the OIDC username.", default=None)
@click.option("--password", type=str, help="Enter the OIDC password.", default=None)
@click.option("--token", type=str, help="Enter the OIDC token.", default=None)
@click.option(
"--issuer",
type=str,
help="Enter the OIDC issuer.",
default=None,
)
@click.option(
"--allow",
type=str,
Expand All @@ -45,8 +36,7 @@
@click.option(
"--unsafe", is_flag=True, help="Should all driver client packages be allowed to load (UNSAFE!).", default=None
)
@opt_client_id
@opt_connector_id
@opt_oidc
@async_handle_exceptions
async def client_login( # noqa: C901
alias: str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import asyncclick as click
from jumpstarter_cli_common.exceptions import handle_exceptions

from .common import opt_config, opt_duration_partial, opt_selector_simple
from .common import opt_config, opt_duration_partial, opt_selector
from jumpstarter.common.utils import launch_shell


@click.command("shell", short_help="Spawns a shell connecting to a leased remote exporter")
@click.option("-n", "--lease", "lease_name", type=str)
@opt_config
@opt_selector_simple
@opt_selector
@opt_duration_partial(default=timedelta(minutes=30), show_default="00:30:00")
@handle_exceptions
def client_shell(config, selector: str, duration: timedelta, lease_name):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@
" Matching objects must satisfy all of the specified label constraints.",
)

opt_selector_simple = click.option(
"-l",
"--selector",
help="Selector (label query) to filter on, only supports '=', (e.g. -l key1=value1,key2=value2)."
" Matching objects must satisfy all of the specified label constraints.",
required=True,
)


class ClientParamType(click.ParamType):
name = "client"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
)
from jumpstarter_cli_common.exceptions import handle_exceptions

from .common import opt_config, opt_duration_partial, opt_selector_simple
from .common import opt_config, opt_duration_partial, opt_selector


@click.group()
Expand All @@ -21,7 +21,7 @@ def create():

@create.command(name="lease")
@opt_config
@opt_selector_simple
@opt_selector
@opt_duration_partial(required=True)
@opt_output_all
@handle_exceptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from jumpstarter_cli_common import OutputMode, OutputType, make_table, opt_output_all
from jumpstarter_cli_common.exceptions import handle_exceptions

from .common import DURATION, opt_config
from .common import opt_config, opt_duration_partial


@click.group()
Expand All @@ -17,7 +17,7 @@ def update():
@update.command(name="lease")
@opt_config
@click.argument("name")
@click.option("--duration", "duration", type=DURATION, required=True)
@opt_duration_partial(required=True)
@opt_output_all
@handle_exceptions
async def update_lease(config, name: str, duration: timedelta, output: OutputType):
Expand Down
17 changes: 13 additions & 4 deletions packages/jumpstarter-cli-common/jumpstarter_cli_common/oidc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import os
from dataclasses import dataclass
from functools import wraps
from typing import ClassVar

import aiohttp
Expand All @@ -21,10 +22,18 @@
truststore.inject_into_ssl()


opt_client_id = click.option("--client-id", "client_id", type=str, default="jumpstarter-cli", help="OIDC client id")
opt_connector_id = click.option(
"--connector-id", "connector_id", type=str, help="OIDC token exchange connector id (Dex specific)"
)
def opt_oidc(f):
@click.option("--issuer", help="OIDC issuer")
@click.option("--client-id", "client_id", help="OIDC client id", default="jumpstarter-cli")
@click.option("--token", help="OIDC access token")
@click.option("--username", help="OIDC username")
@click.option("--password", help="OIDC password")
@click.option("--connector-id", "connector_id", help="OIDC token exchange connector id (Dex specific)")
@wraps(f)
def wrapper(*args, **kwds):
return f(*args, **kwds)

return wrapper


@dataclass(kw_only=True)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import asyncclick as click
from jumpstarter_cli_common.oidc import Config, decode_jwt_issuer, opt_client_id, opt_connector_id
from jumpstarter_cli_common.oidc import Config, decode_jwt_issuer, opt_oidc

from jumpstarter.config.exporter import ExporterConfigV1Alpha1, ObjectMeta

Expand All @@ -9,12 +9,7 @@
@click.option("-e", "--endpoint", type=str, help="Enter the Jumpstarter service endpoint.", default=None)
@click.option("--namespace", type=str, help="Enter the Jumpstarter exporter namespace.", default=None)
@click.option("--name", type=str, help="Enter the Jumpstarter exporter name.", default=None)
@click.option("--username", type=str, help="Enter the OIDC username.", default=None)
@click.option("--password", type=str, help="Enter the OIDC password.", default=None)
@click.option("--token", type=str, help="Enter the OIDC token.", default=None)
@click.option("--issuer", type=str, help="Enter the OIDC issuer.", default=None)
@opt_client_id
@opt_connector_id
@opt_oidc
async def exporter_login(
alias: str,
endpoint: str,
Expand Down