From 70e5aaa107e17e726cf2c4fd4be0e34b2e8c352a Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sat, 30 Mar 2024 00:25:11 +0100 Subject: [PATCH] feat: add rust cli Signed-off-by: kjuulh --- cuddle-rust-cli/.drone.yml | 124 + cuddle-rust-cli/.gitignore | 2 + cuddle-rust-cli/Cargo.lock | 2276 +++++++++++++++++ cuddle-rust-cli/Cargo.toml | 14 + cuddle-rust-cli/README.md | 7 + cuddle-rust-cli/crates/%%name%%/.gitignore | 1 + cuddle-rust-cli/crates/%%name%%/Cargo.toml | 18 + .../crdb/20240201211013_initial.sql | 1 + cuddle-rust-cli/crates/%%name%%/src/main.rs | 29 + cuddle-rust-cli/cuddle-template.json | 10 + cuddle-rust-cli/cuddle.yaml | 21 + cuddle-rust-cli/renovate.json | 3 + cuddle-rust-cli/templates/docker-compose.yaml | 15 + cuddle-templates.json | 5 +- 14 files changed, 2524 insertions(+), 2 deletions(-) create mode 100644 cuddle-rust-cli/.drone.yml create mode 100644 cuddle-rust-cli/.gitignore create mode 100644 cuddle-rust-cli/Cargo.lock create mode 100644 cuddle-rust-cli/Cargo.toml create mode 100644 cuddle-rust-cli/README.md create mode 100644 cuddle-rust-cli/crates/%%name%%/.gitignore create mode 100644 cuddle-rust-cli/crates/%%name%%/Cargo.toml create mode 100644 cuddle-rust-cli/crates/%%name%%/migrations/crdb/20240201211013_initial.sql create mode 100644 cuddle-rust-cli/crates/%%name%%/src/main.rs create mode 100644 cuddle-rust-cli/cuddle-template.json create mode 100644 cuddle-rust-cli/cuddle.yaml create mode 100644 cuddle-rust-cli/renovate.json create mode 100644 cuddle-rust-cli/templates/docker-compose.yaml diff --git a/cuddle-rust-cli/.drone.yml b/cuddle-rust-cli/.drone.yml new file mode 100644 index 0000000..5790aed --- /dev/null +++ b/cuddle-rust-cli/.drone.yml @@ -0,0 +1,124 @@ +kind: pipeline +name: default +type: docker + +steps: + - name: load_secret + image: debian:buster-slim + volumes: + - name: ssh + path: /root/.ssh/ + environment: + SSH_KEY: + from_secret: gitea_id_ed25519 + commands: + - mkdir -p $HOME/.ssh/ + - echo "$SSH_KEY" | base64 -d > $HOME/.ssh/id_ed25519 + - chmod -R 600 ~/.ssh + - | + cat >$HOME/.ssh/config <, +} + +#[derive(Subcommand)] +enum Commands { + Hello {}, +} + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + dotenv::dotenv().ok(); + tracing_subscriber::fmt::init(); + + let cli = Command::parse(); + tracing::debug!("Starting cli"); + + if let Some(Commands::Hello { }) = cli.command { + println!("Hello!") + } + + Ok(()) +} diff --git a/cuddle-rust-cli/cuddle-template.json b/cuddle-rust-cli/cuddle-template.json new file mode 100644 index 0000000..cbe4ffd --- /dev/null +++ b/cuddle-rust-cli/cuddle-template.json @@ -0,0 +1,10 @@ +{ + "name": "cuddle-rust-cli", + "templating": "tera", + "delimiter": "[[]]", + "prompt": { + "name": { + "description": "Project name" + } + } +} \ No newline at end of file diff --git a/cuddle-rust-cli/cuddle.yaml b/cuddle-rust-cli/cuddle.yaml new file mode 100644 index 0000000..9f166a6 --- /dev/null +++ b/cuddle-rust-cli/cuddle.yaml @@ -0,0 +1,21 @@ +# yaml-language-server: $schema=https://git.front.kjuulh.io/kjuulh/cuddle/raw/branch/main/schemas/base.json + +base: "git@git.front.kjuulh.io:kjuulh/cuddle-rust-cli-plan.git" + +vars: + service: "%%name%%" + registry: kasperhermansen + + clusters: + clank-prod: + replicas: "3" + namespace: prod + + +deployment: + registry: git@git.front.kjuulh.io:kjuulh/clank-clusters + env: + prod: + clusters: + - clank-prod + diff --git a/cuddle-rust-cli/renovate.json b/cuddle-rust-cli/renovate.json new file mode 100644 index 0000000..7190a60 --- /dev/null +++ b/cuddle-rust-cli/renovate.json @@ -0,0 +1,3 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json" +} diff --git a/cuddle-rust-cli/templates/docker-compose.yaml b/cuddle-rust-cli/templates/docker-compose.yaml new file mode 100644 index 0000000..8fae72a --- /dev/null +++ b/cuddle-rust-cli/templates/docker-compose.yaml @@ -0,0 +1,15 @@ +version: "3" +services: + crdb: + restart: 'always' + image: 'cockroachdb/cockroach:v23.1.14' + command: 'start-single-node --advertise-addr 0.0.0.0 --insecure' + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/health?ready=1"] + interval: '10s' + timeout: '30s' + retries: 5 + start_period: '20s' + ports: + - 8080:8080 + - '26257:26257' diff --git a/cuddle-templates.json b/cuddle-templates.json index 7d36b4a..5d5c7d4 100644 --- a/cuddle-templates.json +++ b/cuddle-templates.json @@ -6,6 +6,7 @@ "empty", "deployment", "cuddle-infrastructure", - "cuddle-rust-service" + "cuddle-rust-service", + "cuddle-rust-cli" ] -} +} \ No newline at end of file