Skip to content

Support code uploads without Git hoster#372

Draft
schmijos wants to merge 2 commits intoninech:mainfrom
schmijos:feature/support-git-once
Draft

Support code uploads without Git hoster#372
schmijos wants to merge 2 commits intoninech:mainfrom
schmijos:feature/support-git-once

Conversation

@schmijos
Copy link
Copy Markdown
Contributor

@schmijos schmijos commented Mar 20, 2026

This adds a parameter --from-local-dir. So you can call nctl like this:

nctl create app sample --from-local-dir

This then will pack the folder into a ZIP and upload it to gitonce (a service Nine would still have to provide).
Deploio can then check it out and deploy once.

Would look like this:

sequenceDiagram
      autonumber
      actor Coder
      participant Nctl as nctl CLI
      participant GitOnce as gitonce
      participant Deploio as deplo.io (kpack)

      Coder->>Nctl: nctl create app DEMO_APP --from-local-dir=./
      Nctl->>GitOnce: /upload ZIP
      GitOnce-->>Nctl: {"commit": COMMIT, "url": REPO_URL }
      Nctl->>Nctl: nctl create app DEMO_APP --git-url=REPO_URL --git-revision=COMMIT
      Nctl->>Deploio: Nine API Call

      Deploio->>Deploio: Start build from Git source
      Deploio->>GitOnce: GET REPO_URL/info/refs?service=git-upload-pack
      GitOnce-->>Deploio: Advertise refs

      Deploio->>GitOnce: POST REPO_URL/git-upload-pack
      GitOnce-->>Deploio: Send repository pack
      GitOnce->>GitOnce: Expire one-time repo and delete ZIP

      Deploio->>Deploio: Build and deploy app
      Coder->>Nctl: nctl logs build demo-app-1
      Nctl->>Deploio: Nine API Call
      Deploio-->>Nctl: Successful build logs

    Note over Coder,Nctl: Later operations using same Git URL will fail, for example:
      Coder->>Nctl: nctl update app DEMO_APP --git-url=REPO_URL
      Nctl->>Deploio: Request redeploy with same Git URL
      Deploio->>Deploio: Try to fetch source again
      Deploio->>GitOnce: GET/POST Git fetch
      GitOnce-->>Deploio: 410 Gone
      Coder->>Nctl: nctl logs build demo-app-2
      Nctl->>Deploio: Nine API Call
      Deploio-->>Nctl: Failed build logs
Loading

"strings"
)

const DefaultUploadURL = "https://gitonce.21ddead.deploio.app/upload"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's for sure not the final idea.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant