> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blobhub.io/llms.txt
> Use this file to discover all available pages before exploring further.

# blobhub app push

> Build the app and make the app blob's draft equal it, optionally installing the draft

`push` builds the repository and makes the app blob's draft revision hold exactly what `build/` holds: it uploads the
files whose content changed, deletes the ones that are gone, writes the Readme and the License, and asks the platform to
read the result with [`describe`](https://docs.blobhub.io/blob-types/app/operations/describe).

With `--install`, it then installs the draft as a development installation, so one command takes the repository to
running blobs.

## Synopsis

```bash theme={null}
blobhub app push [-f <path>] [--library-catalog <file-or-url>] [--install <alias>] [--installer <org/blob>]
                 [--input <name=value>] [--yes]
```

| Flag | Default | Description |
| - | - | - |
| `-f`, `--file` | `app.yaml` | The app's `app.yaml`; the repository is its folder. |
| `--library-catalog` | none: declared libraries go unchecked | As for [`build`](https://docs.blobhub.io/cli/app/commands/build). |
| `--install` | off | Install the draft over this installation after pushing. It confirms by itself over a new or development installation whose plan deletes no blob. |
| `--installer` | `installed-apps` in the app's organization | The installer blob `--install` uses, as `<org>/<blob>`. |
| `--input` | none | An input's value for the installation: `name=value`, `name=@path` or `name=env:VAR`. Repeatable. |
| `--yes` | off | Confirm an install whose plan deletes a blob, or one over a committed installation that is `uninstalled`. A ready or failed installation of committed versions never takes the draft, `--yes` or not. |

`--installer`, `--input` and `--yes` mean something only with `--install`. Without it, `push` exits `2` with the usage
error `--installer, --input and --yes apply only with --install`, before any call.

## What it does

```mermaid theme={null}
sequenceDiagram
  participant D as Developer
  participant C as blobhub app push
  participant A as App blob
  participant I as Installer blob
  D->>C: push [--install reports-dev]
  C->>C: build, write what changed
  C->>A: read the blob, absent: create it, private
  C->>A: default revision committed: create a draft
  C->>A: list files, put changed, delete gone
  C->>A: Readme and License, when changed
  C->>A: describe
  C-->>D: N problems
  opt --install
    C->>I: read the installer, absent: create it
    C->>I: plan, then install the draft
    loop each second while installing
      C->>I: read the log and the installation
    end
    C-->>D: the log, ending ready
  end
```

1. Builds, exactly as [`build`](https://docs.blobhub.io/cli/app/commands/build) does.
2. Reads the app blob `app.alias` in `--org`. The first push creates it, private, and waits up to 120 seconds until it
   is ready.
3. If the blob's default revision is committed, creates a draft revision and waits up to 120 seconds until it is the
   blob's ready default.
4. Lists the draft's files with their SHA-256, puts each `build/` file whose hash differs, and deletes each file
   `build/` no longer has. A second push of unchanged sources makes no write.
5. Writes `README.md` and `LICENSE` as the revision's Readme and License, only when their text differs. They travel as
   revision metadata, not as files.
6. Runs `describe` and prints what it found.

```text theme={null}
opened a draft of acme-corp/field-reports
pushed to acme-corp/field-reports draft: 6 files changed, 1 deleted
updated readme
describe: Field Reports 0.3.0, 2 blobs, 2 inputs
0 problems
```

The first push begins with `created app blob acme-corp/field-reports, private`; a push to a blob whose default is
already a draft has no `opened` line, and `updated readme` or `updated license` appears only when that text changed.
When `describe` reports problems, `push` prints each as `problem: <text>`, then exits `1` with `APP_HAS_PROBLEMS` and
the message `N problems`. The draft is uploaded either way, so fixing the sources and pushing again converges, and
`--install` installs nothing. A `describe` answer whose `problems` is missing or not a list of sentences is refused
`API_TRANSIENT_ERROR` before the `describe:` line, never read as `0 problems`: the message is
`cannot read the platform's answer: ...`, and it ends `; nothing was installed` only with `--install`.

With `--json`, the result is one JSON document on stdout: `app`, `revision_id`, `created`, `opened`, `changed` and
`deleted` (paths), `metadata` (the items written), `describe` (its `app`, `blobs` and `inputs`), `problems`, and
`install`. A refusal leaves stdout empty and is one JSON document on stderr. When an install fails, the error's
`problems` hold the log's error entries, or its last five entries when none is an error; a timeout holds the last five.
A refusal at write time, after the plan was confirmed, keeps the refusal's `problems` too: a limit reached since the
plan (`LIMIT_EXCEEDED`), whose human output prints only the message, or an installer blob a delete claims while the
install call runs (`BLOB_NOT_READY`), whose problem prints first. A refusal of the plan, `APP_NOT_CONFIRMED`,
`INSTALL_HAS_PROBLEMS` or `PLAN_CHANGED`, carries `confirm` as
[`installer install`](https://docs.blobhub.io/cli/installer/commands/install#output) describes.

## `--install`

`--install reports-dev` installs the draft (`version: draft`) over the installation `reports-dev`. It is possible only
in the app blob's own organization: for a draft in another, the platform refuses the installation. A draft's
installation is a [development installation](https://docs.blobhub.io/blob-types/installer/overview.md#development-installations), whose blobs stay
editable, so a graph can be changed in the visual editor and copied back with [`pull`](https://docs.blobhub.io/cli/app/commands/pull).

The installer is `installed-apps` in the app's organization unless `--installer` names another. A missing installer blob
is created first and the line `created installer blob acme-corp/installed-apps` says so. It prints the plan, headed
`installing the draft over acme-corp/installed-apps · reports-dev`.

`push --install` confirms the plan for you when the installation is new or a development one, and the plan's
[`deletes`](https://docs.blobhub.io/blob-types/installer/operations/plan#response), which the CLI reads rather than the lines, is empty. It
waits for `--yes` in two cases: a plan that deletes a blob, and an `uninstalled` installation that was not a development
one, which the draft makes again as one. Without `--yes` it then prints the plan, exits `1` with the line
`refused: pass --yes to install` (`APP_NOT_CONFIRMED`) and installs nothing. A `ready` or `failed` installation of
committed versions never takes the draft: its plan names the problem `development_mismatch`, and the push ends with
`refused: 1 problem; nothing was installed` (`INSTALL_HAS_PROBLEMS`), `--yes` or not. Install the draft as another
installation, such as `reports-dev`.

Once confirmed, the install sends the plan's digest, as [`installer install`](https://docs.blobhub.io/cli/installer/overview) does, and
follows the installation, printing each log line as it is written (`HH:MM:SS  message`, and see
[the log](https://docs.blobhub.io/blob-types/installer/overview.md#the-log)), until the installation is ready. It exits `1` with
`INSTALLATION_FAILED` when it fails and gives up after 30 minutes with `INSTALLATION_FOLLOW_TIMEOUT`. A plan that has
changed by then installs nothing, and the push ends with
`refused: the plan changed while it was confirmed; nothing was installed` (`PLAN_CHANGED`).

`--input` supplies the installation's inputs. `name=value` is text, `name=@path` reads a `.json`, `.yaml` or `.yml`
file as a document and any other file as text, and `name=env:VAR` reads an environment variable, so a secret such as
`weather_key` never appears in a command line:

```bash theme={null}
# the development installation's config from a file, the secret from the environment
blobhub app push --install reports-dev --input config=@dev-config.yaml --input weather_key=env:WEATHER_KEY
```

No input value is ever printed or put in `--json`. What `--input` refuses before any request is under
[`--input`](https://docs.blobhub.io/cli/installer/overview#--input).

## Errors

| Code | When |
| - | - |
| `MANIFEST_NOT_FOUND`, `MANIFEST_INVALID` | As for [`build`](https://docs.blobhub.io/cli/app/commands/build); `MANIFEST_INVALID` too for a `README.md` or `LICENSE` that is not UTF-8 text. |
| `FORMAT_UNSUPPORTED`, `FORMAT_PARSE_ERROR` | As for [`build`](https://docs.blobhub.io/cli/app/commands/build). |
| `BLOB_REFERENCE_INVALID` | No organization for the app blob: pass `--org` or set `BLOBHUB_ORG`. |
| `BLOB_NOT_ACCESSIBLE` | The app blob exists, but this key cannot read it; or, with `--install`, the platform refused a call to the installer, and the message names what was refused, such as `cannot install <org>/<app> into <org>/<blob>: `, then the platform's own. |
| `BLOB_TYPE_MISMATCH` | A blob of another type holds the alias `app.alias`. |
| `BLOB_NOT_READY` | The app blob was not `ready` within 120 seconds, or is a stranded `updating`; or the platform refused a call `blob_not_ready`, with its message, `blob <org>/<blob> is <status>`: it refuses a read of the app blob, or with `--install` the installer blob, that is being deleted or has failed, as `blob acme-corp/field-reports is failed`, with no hint, and a write, such as the upload, to one that is not `ready`. With `--install`, also the platform's `blob_not_ready` refusing the install, whose problem prints first when a delete claims the installer blob while the call runs, and nothing is installed. |
| `REVISION_PENDING` | The draft was not the blob's ready default within 120 seconds. |
| `REVISION_NOT_WRITABLE` | The draft cannot be written. |
| `APP_HAS_PROBLEMS` | `describe` reports problems, each printed as `problem: <text>`, and the message is `N problems`; the draft is uploaded and nothing is installed. With `--install`, also the platform's `invalid_app` refusing the install: any problems the refusal carries print first, as `installer install` prints them, and the message is the platform's. |
| `APP_NOT_CONFIRMED` | `--install` whose plan deletes a blob, or over an `uninstalled` installation that was not a development one, without `--yes`; exit `1`, and nothing is installed. A confirmed install, by itself or with `--yes`, whose plan has no problems and still no digest ends with `refused: the plan has no digest to confirm; nothing was installed`: the platform's answer and this CLI disagree, so update blobhub-cli. |
| `INSTALL_HAS_PROBLEMS` | The install's plan names problems, `--yes` or not, such as `development_mismatch` over a ready or failed installation of committed versions; each is printed as `problem: <text>`, and nothing is installed. |
| `PLAN_CHANGED` | The plan changed between the push printing it and the install; the new one is printed, and nothing is installed. |
| `MIGRATION_RUNNING`, `DEVELOPMENT_MISMATCH`, `LIMIT_UNMET`, `PERSON_REQUIRED`, `APP_BUSY` | The install call itself was refused with that check: the plan printed had passed it, and the platform's plan made before it acted did not. The problem is printed as `problem: <text>` before the error, and nothing is installed. |
| `ENV_VAR_NOT_SET`, `INPUT_ARGUMENT_INVALID` | An `--input` form names an unset or empty variable, or is malformed: a repeated name, an empty name, a missing `=`, an unreadable file, a file that does not parse ([`--input`](https://docs.blobhub.io/cli/installer/overview#--input)). |
| `VALUE_NOT_JSON` | An `--input` holds a value JSON cannot carry, refused before any request, the installer blob's creation included. A YAML document that holds itself is refused as it is read ([`--input`](https://docs.blobhub.io/cli/installer/overview#--input)). A string or key holding a lone surrogate is refused in the platform's words ([`--input`](https://docs.blobhub.io/cli/installer/overview#--input)). With `--install`, the installation alias and the app are checked too, `installation: <reason>` or `app.<key>: <reason>`. Or the build refuses one, as for [`build`](https://docs.blobhub.io/cli/app/commands/build), or a built path no request can carry, `<build dir>/<path>: <reason>`. Each comes before the push creates or uploads anything. |
| `ALIAS_IN_USE` | `--install`'s alias already names a blob that is not an installation. |
| `INPUT_MISSING`, `INPUT_INVALID` | The platform refuses the installation's inputs. |
| `INSTALLATION_BUSY`, `INSTALLATION_FAILED`, `INSTALLATION_FOLLOW_TIMEOUT` | An operation is already running on `--install`'s alias, the installation failed, or it did not settle in 30 minutes. |
| `CREDENTIALS_NOT_FOUND`, `PROFILE_NOT_FOUND`, `INSECURE_CREDENTIALS_PERMISSIONS` | No usable credential, a credentials file the CLI refuses to read, or an API URL or key no request can carry ([Error codes](https://docs.blobhub.io/cli/error-codes.md#credentials-and-authentication)). |
| `API_RATE_LIMITED`, `API_TRANSIENT_ERROR`, `API_NETWORK_ERROR` | A call failed; running the command again converges, since a push uploads by content hash. `API_TRANSIENT_ERROR` is also a `describe` answer, or with `--install` a plan, that the CLI cannot read. |
| `DEFINITION_CATEGORY_UNKNOWN` | A definition's category cannot be resolved; as for [`build`](https://docs.blobhub.io/cli/app/commands/build). |
| `IMPORT_UNVERIFIED`, `WIDGET_LIBRARIES_UNVERIFIED` | Advisories from the build, on stderr; the exit code stays `0`. |

Every code above, with its remediation, is in [Error codes](https://docs.blobhub.io/cli/error-codes.md).

## See also

* [`blobhub app build`](https://docs.blobhub.io/cli/app/commands/build) — the build `push` runs first.
* [`blobhub app pull`](https://docs.blobhub.io/cli/app/commands/pull) — copies edits made in a development installation back.
* [`blobhub app commit`](https://docs.blobhub.io/cli/app/commands/commit) — makes the draft a version.
* [Installer commands](https://docs.blobhub.io/cli/installer/overview.md) — installing a committed version, and following the log.
* [App blob type](https://docs.blobhub.io/blob-types/app/overview.md) — revisions, drafts and versions.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.