Pre-swap isolation gate in install-release.sh misses a bare variable line and ambiguous flag spellings

Open
#75 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
53/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
bash, python
Domain
backend, devops

Research direction

Start with ops/release/install-release.sh:746-779 and its call site at :1203-1217; compare the shell parsing with the worker's Python str.strip() behavior described in the issue. Then inspect ops/release/tests/test_install_release.bats:965-976, ops/release/README.md, and the changelog's Unreleased section. Done means the listed parsing cases, pre-swap behavior, documentation, and release note are covered by the acceptance criteria.

Written by the indexing model from the issue text.

Description

client enhancement P3

Problem

Before it swaps the code, ops/release/install-release.sh checks each worker env file and the EXTRA_ENV of setup.env. If a variable from ORCH_ISOLATION_REQUIRED_ENV has a value and ORCH_ENFORCE_ISOLATION is not true, the deploy aborts, because the new worker would refuse to start (ops/release/install-release.sh:746-779, used at :1203-1217).

The parser in isolation_vars_status has some edge cases:

  1. Bare variable line. A line without = is skipped (ops/release/install-release.sh:752). In podman --env-file, a line with only a name passes that variable through from the caller's environment. A bare line with a protected name may therefore put the variable in the worker, but the gate treats it as absent.
  2. Two spellings of the flag. The flag and the list are matched with toupper and the last line wins (ops/release/install-release.sh:757-758). If a file has both ORCH_ENFORCE_ISOLATION=false and orch_enforce_isolation=true, the gate passes or fails depending on line order, and it is not clear which value the worker reads.
  3. Whitespace class. Values are trimmed with [ \t\r] (ops/release/install-release.sh:769). The worker uses Python str.strip(), which also strips \f and \v. This only matters for unusual files.
  4. Test fixtures. The bats case for an empty or commented variable (ops/release/tests/test_install_release.bats:965-976) puts several cases into one file, so it mainly tests last-wins. There is no CRLF file case for the protected variable.

Proposed change

  1. Bare line: if a line without = names a protected variable, abort with a clear error (exit code 3 path), or with a new code that says "pass-through line, value unknown". Lines without = that do not name a protected variable stay ignored.
  2. Ambiguous flag: if ORCH_ENFORCE_ISOLATION or ORCH_ISOLATION_REQUIRED_ENV appears with more than one spelling (different case), abort with an "ambiguous" error that names the file and the spellings, never the values.
  3. Add \f\v to the trim class so shell and worker agree.
  4. Split the fixture into one bats case per situation (empty value, spaces only, commented line, last empty occurrence) and add a CRLF file case.
  5. Document the new abort cases in ops/release/README.md.

Compatibility

This only adds abort cases to the pre-swap gate. It changes no API, database, env name or worker behavior. A host whose env files have no bare protected-name line and only one spelling of each flag sees no change.

A host that does have one of those lines will start to fail the gate before the swap, with the installed code untouched. The release note must tell operators to check setup.env and each env.N for bare protected-name lines and duplicate flag spellings before they upgrade.

Acceptance criteria

  • Bats: a bare line with a protected name aborts before the swap and the installed code is untouched.
  • Bats: a bare line with any other name does not trigger the gate.
  • Bats: two spellings of ORCH_ENFORCE_ISOLATION in one file abort with the "ambiguous" message, in both line orders.
  • Bats: one case each for empty, spaces only, commented and last-empty, plus a CRLF file case.
  • Error messages name the file and the variable names, never a value.
  • Existing deployments whose env files have neither pattern deploy exactly as before (the current gate tests pass unchanged).
  • The release note and ops/release/README.md describe the new abort cases and the pre-upgrade check.
  • CHANGELOG entry under Unreleased.
Dominant language
Python
Stars
0
Forks
0
Avg merge
1d 1h
Merged PRs (30d)
10

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AInvirion/orcaster

All issues in AInvirion/orcaster

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.