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

Workflow for cli commands for cloud #1661

Merged
merged 8 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
51 changes: 49 additions & 2 deletions .github/workflows/cli-commands-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- "agenta-cli/**"

jobs:
run-agenta-cli:
serve-to-oss:
runs-on: ubuntu-latest
environment: oss
steps:
Expand All @@ -34,7 +34,7 @@ jobs:

- name: Run agenta init
run: |
APP_NAME="gh-cli-$(shuf -i 1000-9999 -n 1)"
APP_NAME="gh-cli-$(date +'%d-%m-%y_%H-%M-%S')"
cd examples/baby_name_generator
agenta init --app_name $APP_NAME --backend_host ${{ secrets.BACKEND_HOST }}
shell: bash
Expand All @@ -53,3 +53,50 @@ jobs:
agenta variant serve --file_name app.py --overwrite
shell: bash
continue-on-error: false

serve-to-cloud:
runs-on: ubuntu-latest
environment: oss
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
pip install poetry
cd agenta-cli
pip install -e .

- name: Create .env file
run: |
echo "OPENAI_API_KEY=${{ secrets.NEXT_PUBLIC_OPENAI_API_KEY }}" > .env
working-directory: examples/baby_name_generator

- name: Run agenta init
run: |
APP_NAME="gh-cli-$(date +'%d-%m-%y_%H-%M-%S')"
cd examples/baby_name_generator
AGENTA_API_KEY=${{ secrets.AGENTA_API_KEY }} agenta init --app_name $APP_NAME --backend_host https://cloud.agenta.ai --organisation team
shell: bash
continue-on-error: false

- name: Run agenta variant serve
run: |
cd examples/baby_name_generator
agenta variant serve --file_name app.py
shell: bash
continue-on-error: false

- name: Run agenta variant serve with overwrite
run: |
cd examples/baby_name_generator
agenta variant serve --file_name app.py --overwrite
shell: bash
continue-on-error: false
24 changes: 12 additions & 12 deletions agenta-cli/agenta/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ def cli():
@click.command()
@click.option("--app_name", default="")
@click.option("--backend_host", default="")
def init(app_name: str, backend_host: str):
@click.option("--organisation", default="")
aakrem marked this conversation as resolved.
Show resolved Hide resolved
def init(app_name: str, backend_host: str, organisation: str):
init_option = "Blank App" if backend_host != "" and app_name != "" else ""
"""Initialize a new Agenta app with the template files."""

Expand Down Expand Up @@ -171,18 +172,17 @@ def init(app_name: str, backend_host: str):

filtered_org = None
if where_question == "On agenta cloud":
which_organization = questionary.select(
"Which organization do you want to create the app for?",
choices=[
f"{org.name}: {org.description}" for org in user_organizations
],
).ask()
if not organisation:
aakrem marked this conversation as resolved.
Show resolved Hide resolved
which_organization = questionary.select(
"Which organization do you want to create the app for?",
choices=[
aakrem marked this conversation as resolved.
Show resolved Hide resolved
f"{org.name}: {org.description}" for org in user_organizations
],
).ask()
organisation = which_organization.split(":")[0]

filtered_org = next(
aakrem marked this conversation as resolved.
Show resolved Hide resolved
(
org
for org in user_organizations
if org.name == which_organization.split(":")[0]
),
(org for org in user_organizations if org.name == organisation),
None,
)

Expand Down
Loading