Skip to content

Augustin's interview#4

Open
alafanechere wants to merge 2 commits intoalgolia:mainfrom
alafanechere:augustin/01-23-augustin
Open

Augustin's interview#4
alafanechere wants to merge 2 commits intoalgolia:mainfrom
alafanechere:augustin/01-23-augustin

Conversation

@alafanechere
Copy link
Copy Markdown

@alafanechere alafanechere commented Jan 23, 2025

What

This is my quick attempt at implementing a mocked deploy CLI.

  • The first commit is the output of my live coding session.
  • The second commit is a polished version keeping mocked logic.

Installing it 📦

poetry install

Running it 🐚

Happy path 🟢

poetry run paas deploy backend

Failing path 🔴

Non existent app

poetry run paas deploy not-existing

Sync attempt failing

poetry run paas deploy failing-app

Review guidelines 👁️

  • cli.py: Exposes the command and the control flow.
  • registries.py: Declares an application registry hydrated by the ArgoCD API. The source of truth of our system.
  • models.py: Where I declare models to have extensible objects.
  • errors.py: Declare logical errors with a bit of sugar to automatically send some of them to Slack.

Potential improvements 👷

  • Add a logging system instead of click.echo, improve error logging
  • Add unit tests
  • Use real API calls - or use monkey patching (ArgoCD REST API, DD Python SDK)
  • Check availability of the dependencies (Datadog, ArgoCD) before running the CLI and handle errors gracefully
  • Add a timeout for each step to avoid long running requests
  • Create a github action workflow to automate the CLI run
  • Instrument the CLI with telemetry to audit the runs
  • Add a configuration system to allow the CLI to be configured with environment variables

@alafanechere
Copy link
Copy Markdown
Author

@BriceSantus

@BriceSantus
Copy link
Copy Markdown
Collaborator

@BriceSantus

Thanks @alafanechere! And specialy to take extra time to propose a more complex solution in afb4944.
I'll take a deep look on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants