[data-reveal]{opacity:1!important;transform:none!important}
AntelopeJS DMS
DocumentationPublishing

Publishing

How the Unpublished changes and Versions pages publish the project's git repository as versions.

Unpublished changes lists the files of the working copy that differ from the latest version: tracked and untracked files, without the ignored ones. It reads them through a copy of the user's index, so it never stages anything and git hashes only the files that changed. Its form publishes them as the next version. Versions lists every published version. A version's page shows its release notes, its files and commits since the published version before it, and the environments it is on.

Published and pending versions

A version counts as published once origin holds its release/v<N> tag, the same tag object as the local one. The latest version is the newest published one.

A local release tag that origin lacks, such as the one a refused push leaves, is pending. Its commits stay unpublished, and the Changes page and the navbar panel say that the tag is saved locally and has not reached origin. Versions does not list it, and its page answers 404, as for a version that does not exist. While origin does not answer, every local version counts as published.

The repository

Publishing works on the git repository that the repositoryPath option names. The folder must be the root of a work tree, with an origin remote that answers, and HEAD must be on a branch other than an env/* one. Otherwise the page says why, and a publish is refused.

The publish

A publish checks the repository and reads origin's refs, then runs four steps:

  1. Commit: git add --all, then git commit as the signed-in DMS user. The step is skipped when the working copy has nothing to commit.
  2. Tag: an annotated release/v<N> tag, N one more than the highest release tag, local or on origin. The tag message is the version name, "Version " when left empty, then the release notes. The step is skipped when the publish pushes a pending version again.
  3. Move: git branch -f env/<name> to the commit.
  4. Push: the branch, the tag and env/<name> to origin in one git push --atomic.

AntelopeJS Cloud builds what env/<name> points to. One publish runs at a time, and none while a promotion pushes.

Where a publish goes

The environments a publish may move come from the project this DMS publishes. Each durable environment that alone builds its own env/<name> branch qualifies, the release pipeline's stages first and in their order, so the form proposes the first stage the project has. Production only receives promoted versions once the project has a stage before it. A project with no Preview and no Staging publishes to Production.

A publish to an environment the project does not have is refused before anything is written. When no environment builds an env/ branch, the page says a publish would deploy nothing. A DMS that publishes no project, or whose project AntelopeJS Cloud does not answer for, offers the repository's own env/* branches except env/production, and Preview when it has none.

The publish names its commit, the SHA it pushes, once the commit step ended. Above Deploy to, the form shows what the version adds to the chosen environment, as the Resources page's publish-note route answers it: "This version adds a dependency: Redis", and a link to review the plan.

Following the deployment

After the push, the publish dialog follows the four AntelopeJS Cloud steps of the commit on the environment that builds env/<name>: provision, build, health check, switch traffic. It reads the Deployments page's publish-steps?environment=<name>&commit=<sha> route every 2 s until the deployment is live or failed, for 20 minutes at most. It stops after 5 failed reads in a row, with a link to Deployments. It keeps reading while the dialog is closed.

A failed deployment says the step it stopped at, with the build's summary, and what visitors see: "Visitors still see v15 on Preview: AntelopeJS Cloud kept it serving." The message names the serving deployment by the published version tagged on its commit, else by its number. The route says in words when no AntelopeJS Cloud environment builds the branch, or the DMS is not connected. A publish that had ended before the page opened is not followed.

After a refused push

The next publish picks its version from where HEAD stands:

  • HEAD is the pending version's commit and the working copy is clean. The publish skips the commit and the tag, then moves env/<name> and pushes that version's existing tag. The request needs no commit message, and its version name and release notes are not used: the form asks only for the environment. Any other publish needs a commit message.
  • HEAD moved, for example after git pull merged origin's commits, or the working copy has edits. The publish commits them if any, then tags HEAD as a new version, numbered past every release tag, local or on origin. The pending tag stays in the local repository as it is and is never pushed, moved or deleted.

The pending tag names a commit without the commits origin added, so pushing it as the version an environment runs would ship a commit that is not HEAD. A tag is never moved, so the pulled HEAD takes the next number.

Rules

  • Only an env/* branch moves past a non-fast-forward, through --force-with-lease against the commit origin held when the publish began. No refspec carries +, since git lets + override the lease.
  • A tag is never forced or replaced. The tag step fails when release/v<N> exists locally or on origin.
  • A refused push changes nothing on origin, since it is atomic. The publish then says, for each ref, whether origin holds what it pushed. The commit and the tag stay in the local repository.
  • When origin refuses the work branch because it holds commits this copy lacks, the failure says so: "origin has commits on develop that this copy does not have. Pull them, then publish again." Any other failure names the step and git's first error line, as in "The push failed: refs/heads/env/preview rejected (stale info)". The step's log keeps git's whole output.
  • The pages list origin's branches and release tags only, and reuse them for 30 s per repository. They list them again as soon as origin's URL changes. A publish lists them afresh before it starts and after a refused push, and the next page read after a publish lists them again.
  • Git runs with no shell and no terminal prompt. On Linux and macOS, git runs without the DMS's terminal, and ssh may not open a password dialog unless SSH_ASKPASS_REQUIRE says otherwise. So ssh fails rather than ask for a passphrase or a host key. The ssh the user configures still applies: core.sshCommand, GIT_SSH_COMMAND, ~/.ssh/config and an agent.
  • A git call past its time limit is asked to stop, so it can remove its lock files, and killed 5 s later. Git calls still running when the DMS exits are stopped too. A push may run for 15 minutes. Any other git call is stopped after 60 s.
  • Logs hide the user and password a URL carries.