Skip to main content
atmos.yaml9.9 KB
View on GitHub
base_path: "."

components:
terraform:
base_path: components/terraform
container:
base_path: .

stacks:
base_path: stacks
included_paths:
- deploy/**/*
name_template: "{{ .vars.stage }}"

container:
runtime:
provider: docker

# Throwaway emulator credentials, never a real Git account.
git:
repositories:
deployments:
uri: http://atmos:atmos@localhost:3001/atmos/deployments.git
branch: main
workdir: .atmos/git/deployments
commit:
signing: never
author:
name: Atmos Portal
email: portal@localhost

commands:
- name: portal
description: Manage the local Backstage container with Atmos
commands:
- name: up
description: Start Git/AWS emulators and Backstage from source or supplied prebuilt images
flags:
- name: portal-image
type: string
default: ""
description: Prebuilt customized portal image by digest (requires runner-image)
- name: runner-image
type: string
default: ""
description: Matching prebuilt runner image by digest (requires portal-image)
- name: runner-from-source
type: bool
default: false
description: Development option, build the runner's Atmos from this checkout (requires Go) instead of the release image
- name: open
type: bool
default: false
description: Open the Backstage dashboard in the default browser
steps:
- type: script
interpreter: starlark
script: |
images = module.load("scripts/modules/images.star")
images.prepare(ctx.flags["portal-image"], ctx.flags["runner-image"], ctx.flags["runner-from-source"])
atmos.validate("stacks")
atmos.emulator("up", "backstage-git", flags = {"stack": "local"})
atmos.emulator("up", "backstage-aws", flags = {"stack": "local"})
- type: script
source: scripts/seed.star
- type: script
interpreter: starlark
viewport:
height: 8
padding: 1
script: |
if not ctx.flags["portal-image"]:
atmos.container("build", "backstage", flags = {"stack": "local"}, output = "viewport")
atmos.container("up", "backstage", flags = {"stack": "local"})
if ctx.flags["runner-from-source"]:
runner = module.load("scripts/modules/runner.star")
runner.build_binary()
atmos.container("build", "backstage-runner-source", flags = {"stack": "local"}, output = "viewport")
# A runner created from an older image would otherwise be reused as is.
atmos.container("down", "backstage-runner", flags = {"stack": "local"})
elif not ctx.flags["runner-image"]:
atmos.container("build", "backstage-runner", flags = {"stack": "local"}, output = "viewport")
atmos.container("up", "backstage-runner", flags = {"stack": "local"})
ui.info("TechDocs: `http://localhost:3000/catalog/default/component/payments/docs`")
ui.info("Actions: `http://localhost:3001/atmos/deployments/actions`")
ui.info("Backstage dashboard: `http://localhost:3000` (sign in as guest)")
ui.info("Gitea: `http://localhost:3001` (login: `atmos` / `atmos`)")
if ctx.flags["open"]:
browser.open("http://localhost:3000")
- name: open
description: Open the Backstage dashboard in the default browser
steps:
- type: script
interpreter: starlark
script: |
browser.open("http://localhost:3000")
- name: down
description: Reset the portal, ephemeral emulators, and managed Git repository
steps:
- type: script
interpreter: starlark
script: |
atmos.container("down", "backstage-runner", flags = {"stack": "local"})
atmos.container("down", "backstage", flags = {"stack": "local"})
atmos.emulator("down", "backstage-aws", flags = {"stack": "local"})
atmos.emulator("down", "backstage-git", flags = {"stack": "local"})
atmos.git("clean", "deployments", flags = {"force": True})
# Rootful Linux runners create state the host user cannot delete.
# Stop the runner first, then clean only this demo's mounted CI data.
cleanup = exec.run(["rm", "-rf", ".atmos/ci"], check = False, output = "capture")
if cleanup.exit_code != 0:
exec.run(["docker", "run", "--rm", "--user", "0:0",
"--mount", "type=bind,src=" + fs.resolve(".atmos/ci") + ",dst=/cleanup",
"--entrypoint", "find", "atmos-backstage-runner:local",
"/cleanup", "-mindepth", "1", "-delete"])
exec.run(["rm", "-rf", ".atmos/ci"])
- name: logs
description: Show Backstage logs
steps:
- type: script
interpreter: starlark
script: |
atmos.container("logs", "backstage", flags = {"stack": "local"})
- name: status
description: Show the Backstage container status
steps:
- type: script
interpreter: starlark
script: |
atmos.container("ps", "backstage", flags = {"stack": "local"})
- name: test
description: Verify Backstage; optionally test the full Git-to-provisioning flow
flags:
- name: provision
type: bool
default: false
description: Create and merge a test PR, provision its local bucket, and verify the catalog
steps:
- name: backstage-tests
type: test
title: Backstage integration
steps:
- name: checks
type: parallel
max_concurrency: 3
steps:
- name: backend-ready
title: Backend readiness
type: http
url: http://localhost:7007/.backstage/health/v1/readiness
expect:
status: [200]
timeout: 2s
retry:
max_attempts: 120
initial_delay: 1s
backoff_strategy: constant
- name: dashboard
title: Dashboard responds
type: http
url: http://localhost:3000
expect:
status: [200]
timeout: 10s
- name: catalog
title: Catalog and templates
needs: [backend-ready]
type: script
interpreter: starlark
script: |
checks = module.load("scripts/modules/backstage_tests.star")
checks.catalog_entities()
- name: docs-metadata
title: TechDocs entity metadata
needs: [backend-ready]
type: script
interpreter: starlark
script: |
checks = module.load("scripts/modules/backstage_tests.star")
checks.techdocs_metadata()
- name: docs-content
title: TechDocs handbook content
needs: [backend-ready]
type: script
interpreter: starlark
script: |
checks = module.load("scripts/modules/backstage_tests.star")
checks.techdocs_content()
- name: describe-dev
title: Dev stack inheritance and overrides
needs: [backend-ready]
type: script
interpreter: starlark
script: |
checks = module.load("scripts/modules/backstage_tests.star")
checks.describe_stack("dev", 2)
- name: describe-prod
title: Prod stack inheritance and overrides
needs: [backend-ready]
type: script
interpreter: starlark
script: |
checks = module.load("scripts/modules/backstage_tests.star")
checks.describe_stack("prod", 4)
- name: reject-stack
title: Reject unknown stack
needs: [backend-ready]
type: script
interpreter: starlark
script: |
checks = module.load("scripts/modules/backstage_tests.star")
checks.reject_unknown_stack()
- name: reject-service
title: Reject invalid service names
needs: [backend-ready]
type: script
interpreter: starlark
script: |
checks = module.load("scripts/modules/backstage_tests.star")
checks.reject_invalid_service()
- type: script
source: scripts/test-provision.star
- name: plan
description: Plan a merged service request against the local AWS emulator
flags:
- name: service
required: true
steps:
- type: script
source: scripts/plan.star
- name: apply
description: Apply a merged service request and register its Git-backed catalog entry
flags:
- name: service
required: true
steps:
- type: script
source: scripts/apply.star