Worked example: a release with real output
This page follows one scenario from start to finish. The commands and their output come from an automated end-to-end test (TestTheCommandLineTakesAnAgentFromDraftToProductionAndTheDataPlanesFollow in runtime/internal/controlplane/e2e). It runs the real robotelos program against a real server and database, with two fleets whose agents write releases into data databases of their own, one for dev and staging and one for production. After every step it checks those data databases, which is where a running conversation finds its release, and not only what the CLI prints. IDs and digests are shortened. The YAML files are the ones in Ship an agent; this page shows only the commands and what they print.
Two people take part. A developer writes and requests. A maintainer approves production. Add --account ID to each command, or select your account once with robotelos account use.
0. Turn on staging (once)
Staging is optional. A maintainer turns it on:
$ robotelos apply -f stg.yaml
environment/stg enabled: true
With staging on, production only accepts a version that has passed in staging.
1. Create an agent: it is a draft
$ robotelos apply -f support.yaml
agent/support created (draft revision 0)
$ robotelos get agent support
a1fd4ece-… support current version: -
$ robotelos get draft support
draft revision 0 (changes no release holds: true)
$ robotelos get releases support
VERSION STATUS DIGEST PUBLISHED
The agent has a draft and no release. Nothing can run from a draft:
$ robotelos apply -f support-dev.yaml # a rollout of version 1
NotFound: not found: release 1 of this agent does not exist or is retired
2. Publish version 1
$ robotelos apply -f support-version.yaml
agentrelease/support version 1 created: sha256:2da3efec…
$ robotelos get draft support
draft revision 0 (changes no release holds: false)
$ robotelos get release support/1
agentrelease/support/1
status: published
digest: sha256:2da3efec…
artifact:
{"agent":{"name":"support"}, … }
The release is frozen. The draft has no changes the release doesn’t hold.
3. Roll out to dev and staging
$ robotelos apply -f support-dev.yaml
agentrollout/support/dev generation 1 changed
$ robotelos apply -f support-stg.yaml
agentrollout/support/stg generation 1 changed
Before asking for production, record that version 1 passed in staging (the Evaluation file from Ship an agent, with environment: stg):
$ robotelos apply -f support-eval-stg.yaml
evaluation/5d5880b3-… regression v1 in stg recorded (passed: true)
4. Ask for production, and approve
$ robotelos apply -f support-prod.yaml # a rollout with environment: prod
agentrollout/support/prod generation 0 unchanged; promotion/ef9e37ab-… awaiting_approval (robotelos approve promotion ef9e37ab-…)
Production has not changed. It shows a request waiting:
$ robotelos get rollout support/prod
agentrollout/support/prod
generation: 0
version: -
state: PENDING
pending promotion: ef9e37ab-…
message: waiting for a promotion to be approved
The developer cannot approve it. The maintainer can:
$ robotelos approve promotion ef9e37ab-… # as the developer
PermissionDenied: forbidden: the caller's role does not allow this operation
$ robotelos approve promotion ef9e37ab-… --comment ok # as the maintainer
ef9e37ab-… v1 stg -> prod applying sha256:2da3efec…
$ robotelos get rollout support/prod
generation: 1
version: 1
state: ACTIVE
phase: Ready (observed generation 1)
fleet 939703a9-…: generation 1 Ready sha256:087ed6b8…
5. The same, but the promotion is rejected
A second agent, faq, goes through steps 1 to 3 and asks for production:
$ robotelos apply -f faq-prod.yaml
agentrollout/faq/prod generation 0 unchanged; promotion/3e9c6da4-… awaiting_approval (…)
$ robotelos reject promotion 3e9c6da4-… --comment not-yet # as the maintainer
3e9c6da4-… v1 stg -> prod rejected sha256:f36a757f…
It never reaches production:
$ robotelos get rollout faq/prod
NotFound: not found: nothing is deployed to prod
$ robotelos get rollouts faq
ENVIRONMENT GENERATION VERSION STATE PHASE
dev 1 1 ACTIVE Ready
stg 1 1 ACTIVE Ready
$ robotelos get promotion 3e9c6da4-…
3e9c6da4-… v1 stg -> prod rejected sha256:f36a757f…
To try again, apply the production rollout again: it creates a new promotion.
6. Update the agent: version 2, and different versions in different environments
Change the file (here, add temperature: 0.2) and apply it. This edits the draft only:
$ robotelos apply -f support.yaml
agent/support updated (draft revision 1)
$ robotelos get draft support
draft revision 1 (changes no release holds: true)
$ robotelos get rollouts support # nothing changed anywhere
ENVIRONMENT GENERATION VERSION STATE PHASE
dev 1 1 ACTIVE Ready
stg 1 1 ACTIVE Ready
prod 1 1 ACTIVE Ready
Publish version 2 and roll it out to dev only:
$ robotelos apply -f support-version.yaml
agentrelease/support version 2 created: sha256:93cb41b5…
$ robotelos apply -f support-dev.yaml # the rollout file now says version: 2
agentrollout/support/dev generation 2 changed
$ robotelos get rollouts support
ENVIRONMENT GENERATION VERSION STATE PHASE
dev 2 2 ACTIVE Ready
stg 1 1 ACTIVE Ready
prod 1 1 ACTIVE Ready
Dev runs version 2 while staging and production still run version 1. Every environment keeps its own version.
7. Version 2 follows the same path to production
Roll it out to staging, record that it passed, and ask for production. Production stays on version 1 until the promotion is approved:
$ robotelos apply -f support-prod.yaml # the rollout file says version: 2
agentrollout/support/prod generation 1 unchanged; promotion/77a74b64-… awaiting_approval (…)
$ robotelos get rollouts support
dev 2 2 ACTIVE Ready
stg 2 2 ACTIVE Ready
prod 1 1 ACTIVE Ready
$ robotelos approve promotion 77a74b64-… # as the maintainer
$ robotelos get rollouts support
dev 2 2 ACTIVE Ready
stg 2 2 ACTIVE Ready
prod 2 2 ACTIVE Ready
$ robotelos get revisions support/prod
prod promotion v2 generation 2 …
prod promotion v1 generation 1 …
8. Going back
Rolling back is applying the earlier version. Here dev goes back to version 1 while staging and production stay on 2:
$ robotelos apply -f support-dev.yaml # the rollout file says version: 1
agentrollout/support/dev generation 3 changed
$ robotelos get rollouts support
dev 3 1 ACTIVE Ready
stg 2 2 ACTIVE Ready
prod 2 2 ACTIVE Ready
Reading the phase
Right after an apply, a rollout says Accepted: Robotelos has recorded what the environment should run. As the fleet’s agent picks it up it moves through Distributed and Applied to Ready, which is when the agent has written the release into the environment’s data database and it passed its readiness check. The tables above were read after the fleets had caught up, so they say Ready.
If a fleet is away, the rollout stays short of Ready and the fleet’s own line shows the generation it last confirmed. When the fleet returns it converges without any action from you. See Operate fleets.
Other cases the test covers
- A fleet that is not running does not activate anything, and the rollout does not claim Ready until it does.
- An agent that restarts with an empty cache converges to the same state and writes nothing twice.
- A change based on a stale generation (
metadata.generation) is refused withAborted, and the data plane is unchanged. - Stopping an environment (a rollout with no version) needs a maintainer, and the data plane stops serving it. Applying a version again serves it as a new generation.
- After a rejection the same request can be made again and approved; a promotion that was already decided cannot be decided twice.
Next steps
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.