Skip to content

Testing a JPS manifest in staging before promoting to production

A repeatable staging pipeline for JPS manifests — install, smoke test, soak, promote — so the first run against a customer environment isn't the first run.

You make a small change to a JPS manifest — version bump, one config line, an extra cmd action — and push it to your private marketplace. The next time anyone installs from that entry, the change is live. There is no staging environment between “I edited the file” and “the customer is running it.” The first failure mode you’ll hit is a manifest that worked yesterday and broke today because the baseUrl asset moved, the upstream image bumped a default, or your YAML parser silently accepted a typo. None of that is JPS’s fault. It’s the absence of a pipeline.

What’s happening

A JPS manifest is code that runs against production infrastructure. The same hygiene that applies to any other deploy applies here: don’t release directly to production, run the same path twice (once against staging, once against production), and have a smoke test that tells you whether the result is good without you logging in to look.

The minimal staging pipeline has four gates:

  1. Lint / schema check. YAML parses, schema fields match what the engine expects, required fields are present, regexes compile.
  2. Install on staging. Fresh empty environment, manifest installs end-to-end, no actions return non-zero.
  3. Smoke test on staging. Application responds, health endpoint reports the right version, basic functional checks pass.
  4. Soak. Leave the staging environment running for a fixed period (24 hours is a reasonable default for non-trivial changes) before promoting. Catches issues that only show up under sustained load or scheduled-job execution.

Gate 1 runs on every commit, gate 2 on every release candidate, gate 3 on every install, gate 4 only when the change touches anything beyond a version-string bump.

The gate that operators skip and regret is gate 4. A manifest that installs cleanly and passes smoke tests can still leave the environment in a state that decays — a cron job that fails on its first scheduled run, a TLS cert that’s installed but won’t renew, an autoscale rule that’s correct but never triggers. Twenty-four hours of soak doesn’t catch everything, but it catches the things that show up in the first day, which is most of them.

How to verify

A staging pipeline is one bash script that invokes the four gates in order. Each gate exits non-zero on failure so the pipeline halts:

#!/usr/bin/env bash
# /opt/jps-pipeline/run.sh
# Usage: run.sh <manifest> <version> <staging-env-name>

set -euo pipefail

MANIFEST="${1:?usage: run.sh manifest version env-name}"
VERSION="${2}"
STAGING_ENV="${3}"
SESSION="${JEL_SESSION:?set JEL_SESSION}"
REGION="${REGION:-yyz}"

echo "==> Gate 1: schema/lint"
python3 -c "import yaml; yaml.safe_load(open('${MANIFEST}'))"
npx --yes jps-validator "${MANIFEST}"

echo "==> Gate 2: install on staging"
# Clean previous staging env if it exists
if jelastic environment.control.GetEnvInfo \
     --envName "${STAGING_ENV}" --session "${SESSION}" \
     >/dev/null 2>&1; then
  jelastic environment.control.DeleteEnv \
    --envName "${STAGING_ENV}" --session "${SESSION}" \
    --password "${JEL_ACCOUNT_PASS}"
fi

jelastic marketplace.app.Install \
  --manifest "$(cat "${MANIFEST}")" \
  --envName "${STAGING_ENV}" \
  --displayName "Staging ${VERSION}" \
  --region "${REGION}" \
  --session "${SESSION}"

# Block until the environment is running or fails
for i in $(seq 1 60); do
  status=$(jelastic environment.control.GetEnvInfo \
    --envName "${STAGING_ENV}" --session "${SESSION}" \
    | jq -r '.env.status')
  case "${status}" in
    running) break ;;
    failed)  echo "Install failed"; exit 1 ;;
    *) sleep 10 ;;
  esac
done

echo "==> Gate 3: smoke test"
URL="https://${STAGING_ENV}.<your-paas>.com"
for i in $(seq 1 20); do
  code=$(curl -sk -o /dev/null -w '%{http_code}' "${URL}/health")
  if [ "${code}" = "200" ]; then break; fi
  sleep 6
done
[ "${code}" = "200" ] || { echo "Health not 200 (got ${code})"; exit 1; }

reported_version=$(curl -sk "${URL}/version" | jq -r '.version')
[ "${reported_version}" = "${VERSION}" ] || {
  echo "Version mismatch: expected ${VERSION}, got ${reported_version}"
  exit 1
}

# Functional smoke tests — these are app-specific
curl -sk -X POST "${URL}/api/v1/ping" -H 'X-Smoke-Test: 1' | jq -e '.ok==true'

echo "==> Gate 4: soak"
# In CI this is the point where you stop and a separate scheduled
# job (24h later) runs the post-soak verification. For an interactive
# run, sleep is fine.
SOAK_HOURS="${SOAK_HOURS:-24}"
if [ "${SOAK_HOURS}" -gt 0 ]; then
  echo "Soaking ${SOAK_HOURS}h — re-run with SOAK_HOURS=0 to skip"
  end=$(($(date +%s) + SOAK_HOURS*3600))
  while [ "$(date +%s)" -lt "${end}" ]; do
    code=$(curl -sk -o /dev/null -w '%{http_code}' "${URL}/health")
    if [ "${code}" != "200" ]; then
      echo "Soak failed at $(date -u): health=${code}"
      exit 1
    fi
    sleep 300
  done
fi

echo "==> All gates passed for ${VERSION}"

Verify the pipeline itself the same way you’d verify the manifest: by running it against a known-good change and a known-bad change. Introduce a deliberate YAML syntax error and confirm gate 1 catches it. Point baseUrl at a 404 path and confirm gate 2 catches it. Bump the version in the manifest but not in the application release and confirm gate 3 catches it. A pipeline that hasn’t been red on purpose hasn’t been tested.

The fix

The pipeline above gets you started, but the real win is in what you wire around it:

  • A single staging environment per manifest, named predictably. Don’t spin up staging-test-1, staging-test-2, staging-mautic-fork-take-3. One name per manifest, recreated from scratch on every release candidate. Stale staging environments accumulate and start to lie.
  • CI runs gates 1-3 on every PR to the manifest repository. Gate 4 (soak) runs only on PRs that merge to the release branch. Most PRs are dependency bumps and version-string changes that don’t need a day of soak.
  • The same release mechanism for staging and production. If staging is installed by marketplace.app.Install against a manifest you pasted into the CLI, but production is installed by a different team clicking the marketplace UI, the two paths can diverge. Use the same JPS marketplace publish + install for both. Tag environments with a tier=staging or tier=production label so monitoring and alerting can treat them differently.
  • Tear down staging after promotion. A staging environment that lives forever drifts. Tear it down when production has caught up, recreate it for the next release candidate. The teardown also exercises the delete path, which is its own thing that can break.
  • Promote by re-running the install with the production env name, not by mutating staging. “Promote” is a misleading verb here — what you actually do is install the same vetted manifest, against a separately-named production environment. The state from staging doesn’t carry over and shouldn’t; staging’s job is to prove the manifest works, not to be promoted.

A pipeline like this catches the class of issues that show up only after a manifest meets reality:

  • An asset on baseUrl returned a 404 because the CDN cache hadn’t propagated yet — gate 2 catches it.
  • A regex in settings.fields didn’t match the input the operator typed — gate 2 catches it on the first install attempt.
  • A cmd action depends on a binary that isn’t in the base image, and it worked locally because you tested by hand on a node that had it — gate 2 catches it.
  • A cron job runs every day at 03:00 UTC, was misconfigured, and would have started failing the next morning — gate 4 catches it.

The first manifest you ship through this pipeline takes 30 minutes longer than just running it. The first time the pipeline catches an issue that would have hit a customer environment, you’ve paid for the rest of the year.


Stack Harbor builds and operates this exact pipeline for customers on our Cloud PaaS — JPS authoring, lint-in-CI, staging environment per manifest, soak gating, scheduled promotion windows. If you’d rather not own the pipeline yourself, our deployment management team owns it under environment management.