Skip to content

feat: discover environments from remote deployment repos#6

Open
hisco wants to merge 3 commits into
mainfrom
feat/remote-deployment-repo-envs
Open

feat: discover environments from remote deployment repos#6
hisco wants to merge 3 commits into
mainfrom
feat/remote-deployment-repo-envs

Conversation

@hisco

@hisco hisco commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Services with deploymentRepo now discover their environments from the remote deployment repo (clone → list overlays/ dirs → read skyhook/environments/{name}.yaml) instead of requiring a local environments[] array
  • Services without deploymentRepo continue using local environments as before
  • Token handling tries explicit github-token input first, falls back to GITHUB_TOKEN env var, with retry across tokens on auth failure
  • Branch defaults to remote HEAD when not explicitly specified (instead of hardcoded main)
  • autoDeploy added to the environment schema (defaults to false)
  • README rewritten to document both Skyhook and Koala configuration formats

Environment schema change

autoDeploy is now part of the environment configuration, both in local skyhook.yaml and remote skyhook/environments/{name}.yaml files. It controls the auto_deploy field in the matrix output. Defaults to false when not specified.

Local (skyhook.yaml):

environments:
  - name: dev
    clusterName: nonprod-cluster
    autoDeploy: true       # new field, optional, default false
  - name: staging
    clusterName: nonprod-cluster
                            # autoDeploy omitted → "false"

Remote (skyhook/environments/dev.yaml):

clusterName: nonprod-cluster
cloudProvider: gcp
account: my-project
location: us-east1
namespace: dev
autoDeploy: true

Previously auto_deploy was hardcoded to "true" for all matrix entries.

Key changes

File Change
src/deployment/repo-fetcher.js New — shallow clone with caching (repo:branch), overlay listing, env config reading with cache (repo:branch:envName)
src/index.js Wire up remote env resolution per service, token fallback via resolveTokens(), branch defaults to empty
src/matrix/matrix-builder.js Accept perServiceEnvs map; read autoDeploy from env instead of hardcoding
src/config/SkyhookConfig.js Add autoDeploy to SkyhookEnvironment (accepts bool/string, defaults false)
action.yml Remove hardcoded main default for branch input
tests/skyhook.test.js 37 tests (19 new) covering clone caching, token fallback, overlay listing, env config parsing/caching, per-service envs, autoDeploy in both paths
README.md Full rewrite documenting Skyhook remote env discovery, config formats, matrix output schema

Test plan

  • All 37 tests pass (npm test)
  • Token fallback: first token fails → retries with second token
  • All tokens fail → throws with clear error
  • Clone cache: same repo:branch cloned once, shared across services
  • Env config cache: namespaced by repo:branch:envName, no cross-repo collisions
  • Mixed services: remote-env service + local-env service produce correct matrix
  • Environment filter applies to both remote and local envs
  • No branch specified → git clone omits --branch (uses HEAD)
  • autoDeploy: true/false/"true"/undefined all handled correctly in constructor
  • autoDeploy: local path — matrix entries reflect env setting
  • autoDeploy: remote path — read from YAML, defaults false when missing
  • E2E: test in a workflow with a real deployment repo reference

hisco added 3 commits March 20, 2026 09:14
For services with deploymentRepo, environments are now discovered by
cloning the deployment repo and listing overlay directories, with env
details read from skyhook/environments/{name}.yaml files. Services
without deploymentRepo continue using the local environments[] array.

- Add src/deployment/repo-fetcher.js for clone, overlay listing, and
  env config reading with per-repo:branch clone cache and per-env
  config cache to prevent collisions
- Support per-service environments in matrix builder
- Token fallback: tries explicit github-token input, then GITHUB_TOKEN
  env var, with retry on auth failure
- Default to remote HEAD when branch input is not specified
- Rewrite README to document both Skyhook and Koala config formats
autoDeploy is now part of the environment schema (both local
skyhook.yaml environments[] and remote skyhook/environments/*.yaml).
Defaults to false when not specified.
- SkyhookEnvironment constructor: true, "true", false, undefined
- Local matrix builder: autoDeploy true/false reflected in auto_deploy
- Remote readEnvironmentConfig: autoDeploy read from YAML, defaults false
- Missing env YAML: autoDeploy defaults false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant