github.com/Racer159/jackal@v0.32.7-0.20240401174413-0bd2339e4f2e/adr/0022-dev-cmd.md (about)

     1  # 22. Introduce `dev` command
     2  
     3  Date: 2023-12-03
     4  
     5  ## Status
     6  
     7  Accepted
     8  
     9  ## Context
    10  
    11  > Feature request: <https://github.com/Racer159/jackal/issues/2169>
    12  
    13  The current package development lifecycle is:
    14  
    15  1. Create a `jackal.yaml` file and add components
    16  2. Create a package with `jackal package create <dir>`
    17  3. Debug any create errors and resolve by editing `jackal.yaml` and repeating step 2
    18  4. Run `jackal init` to initialize the cluster
    19  5. Deploy the package with `jackal package deploy <tarball>`
    20  6. Debug any deploy errors and resolve by editing `jackal.yaml` and repeating step 2 or 5
    21  
    22  If there are deployment errors, the common pattern is to reset the cluster (ex: `k3d cluster delete && k3d cluster create`) and repeat steps 4-6. Re-initializing the cluster, recreating the package, and redeploying the package is tedious and time consuming; especially when the package is large or the change was small.
    23  
    24  `jackal package create` is designed around air-gapped environments where the package is created in one environment and deployed in another. Due to this architecture, a package's dependencies _must_ be retrieved and assembled _each_ and _every_ time.
    25  
    26  There already exists the concept of [`YOLO` mode](0010-yolo-mode.md), which can build + deploy a package without the need for `jackal init`, and builds without fetching certain heavy dependencies (like Docker images). However, `YOLO` mode is not exposed via CLI flags, and is meant to develop and deploy packages in fully connected environments.
    27  
    28  ## Decision
    29  
    30  Introduce a `dev deploy` command that will combine the lifecycle of `package create` and `package deploy` into a single command. This command will:
    31  
    32  - Not result in a re-usable tarball / OCI artifact
    33  - Not have any interactive prompts
    34  - Not require `jackal init` to be run by default (override-able with a CLI flag)
    35  - Be able to create+deploy a package in either YOLO mode (default) or prod mode (exposed via a CLI flag)
    36  - Only build + deploy components that _will_ be deployed (contrasting with `package create` which builds _all_ components regardless of whether they will be deployed)
    37  
    38  ## Consequences
    39  
    40  The `dev deploy` command will make it easier to develop and deploy packages in connected **development** environments. It will also make it easier to debug deployment errors by allowing the user to iterate on the package without having to re-initialize the cluster, re-build and re-deploy the package each cycle.
    41  
    42  There is a purpose to placing this functionality behind a new command, rather than adding it to `package create`. Commands under `dev` are meant to be used in **development** environments, and are **not** meant to be used in **production** environments. There is still the possibility that a user will use `dev deploy` in a production environment, but the command name and documentation will make it clear that this is not the intended use case.