v0.2.4

Documentation version

v0.2.4v0.3.2
en

Documentation language

en

Search documentation

ESC

Documentation search

What are you working on?

Find a guide, configuration option, action, or ESH topic.

Browse documentation
DocsConfigure repository policy and environment

Configure repository policy and environment

A workflow says what to run. Environment configuration says which values a task needs. Repository policy says which conventions the repository follows. Keeping those concerns in separate files makes them easier to understand and share:

  • .evin/workspace.flow and other .flow files orchestrate tasks.

  • .evin/environment.json describes values that tasks can use.

  • .evin/policy.json describes repository conventions used by Evin's Git hooks and release actions.

Create the starter files with:

evin init --all

This creates the workspace, environment, and policy files when they do not already exist. The starter workspace links to .evin/policy.json. You can also create the manifests separately with evin init --env or evin init --policy.

Give task environment variables a shared contract

Programs commonly read settings from environment variables such as PORT, LOG_LEVEL, or DATABASE_URL. Those variables still work the standard way with Evin: your application reads them from its process environment. Evin adds a place to describe what each value means and how its tasks should receive it.

Without a shared description, a task can depend on a value that happens to be set in one developer's shell but is missing in CI. Defaults and required values may also be repeated across scripts. .evin/environment.json lets a repository declare those expectations once, then select values by name or reusable preset from .flow tasks.

For example, describe a default log level and a database URL needed by tests:

{
  "$schema": "https://dl.everyinit.dev/schema/v1/environment",
  "presets": {
    "web-test": ["LOG_LEVEL", "DATABASE_URL"]
  },
  "environments": {
    "LOG_LEVEL": {
      "type": "string",
      "default": "info",
      "description": "Application logging verbosity"
    },
    "DATABASE_URL": {
      "type": "secret",
      "required": true,
      "scopes": ["Process"]
    }
  }
}

Then select that preset for the task that needs those values:

tasks:
  test:
    stage: Test
    presets: [web-test]
    run: npm test

The .env file at the workspace root is one source of local values. Workspace values and schema defaults can supply other values; a module can override workspace values. CI can provide the same variable names through the CI runner's environment. The manifest can define the interface without storing the secret values in the repository.

The environment manifest gives you controls over a plain collection of shell variables:

  • Declare a value required so Evin reports it when missing. Evin checks required declarations while resolving the workspace environment, even if the selected task does not use that variable.

  • Set a default for non-secret values, or document a pattern. Evin checks supplied .env and workspace values against that pattern.

  • Group related variables into a preset and select them for the tasks that need them.

  • Restrict declared variables to process or internal use, and to selected workflow stages.

  • Mark sensitive variables as secret so Evin redacts known values of at least four characters from captured task output.

The declarations make task inputs more visible and repeatable. Explicit selection can reduce what a task receives. Tasks with no env or presets currently receive the full resolved pool, plus a small host-variable safelist. For a tighter environment, select variables with env or presets and use pure: true when the task should also omit that default host safelist. Secret redaction helps with accidental output; it does not protect credentials that are printed, passed in command arguments, or exposed by a task. Keep secret values in an appropriate local or CI secret mechanism, not in the tracked JSON file.

Share repository conventions with policy

Teams often agree on commit messages, branch names, staged-file rules, and release conventions. Without shared rules, each contributor has to remember them, and different tools may interpret release changes differently. .evin/policy.json lets the repository keep these conventions together. Evin uses the configured policies in its Git hooks; release actions can also use the release rules to determine version and changelog behavior.

The starter .evin/workspace.flow already points to the policy file. If your workspace file was created separately, connect it like this:

workspace:
  name: storefront
  version: "1.0.0"
  policy: .evin/policy.json

For example, a repository can require a shared commit format and define how features and fixes affect the next release:

{
  "$schema": "https://dl.everyinit.dev/schema/v1/policy",
  "name": "Storefront policy",
  "commits": {
    "message_format": "{type}({scope}?){breaking?}: {description}",
    "fields": {
      "type": { "allowed_values": ["feat", "fix", "docs", "refactor", "test", "chore"] }
    }
  },
  "releases": {
    "versioning": { "strategy": "semver" },
    "change_types": {
      "feat": { "bump": "minor", "changelog_section": "Features" },
      "fix": { "bump": "patch", "changelog_section": "Bug Fixes" }
    }
  }
}

After editing policy, preview and install Evin's Git hooks:

evin sync --dry-run --verbose
evin sync

These are local Git hooks for repository guardrails, not server-side access controls. Use your Git hosting service's protections for rules that must be enforced on the remote. Policy hooks are also distinct from workflow hooks: on.hooks in a .flow task tells Git to run that task, while policy enables Evin's built-in repository checks. The repository policy reference lists the available rules.

Use evin check to catch configuration problems. For exact environment sources, selection behavior, fields, and validation rules, see the environment reference.

Next: connect workflows to Git hooks.

Page source: book/45.configure-repository-policy-and-environment.md