@dooer/dooer-test-env 1.19.0 → 1.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,7 @@ const registry = require('../registry')
5
5
  const bankid = require('../bankid')
6
6
  const { generateCompose } = require('../compose/generate')
7
7
  const discovery = require('../discovery/client')
8
+ const envSpec = require('../env-spec')
8
9
 
9
10
  // Every profile the generator emits (lib/compose/generate.js). `down` must name them all, or compose
10
11
  // silently leaves the profiled containers running.
@@ -21,11 +22,17 @@ const PROFILES = ['full', 'frontend', 'hq', 'booking']
21
22
  // found out was a bug that was already fixed. An npm install rewrites lib/, so its mtime moves ahead of a
22
23
  // compose file generated by the previous version, and a local edit to the generator does the same.
23
24
  // The compose file is a build artifact — anything hand-edited there was already lost on the next `db pull`.
25
+ //
26
+ // The environment spec counts as an input too. It carries the image tag of every service, so refreshing it
27
+ // and NOT regenerating leaves the stack pinned to whatever versions it was born with — which is how the
28
+ // local service-dooer-test-env sat at 3.1.1 while staging ran 3.2.1, and a purge failed with a foreign-key
29
+ // error that had been fixed weeks earlier.
24
30
  function composeIsStale() {
25
31
  if (!fs.existsSync(rt.COMPOSE_FILE)) return true
26
32
  try {
27
- const generator = require.resolve('../compose/generate')
28
- return fs.statSync(generator).mtimeMs > fs.statSync(rt.COMPOSE_FILE).mtimeMs
33
+ const composedAt = fs.statSync(rt.COMPOSE_FILE).mtimeMs
34
+ const inputs = [require.resolve('../compose/generate'), require('../env-spec').SPEC_FILE]
35
+ return inputs.some((f) => fs.existsSync(f) && fs.statSync(f).mtimeMs > composedAt)
29
36
  } catch (_) {
30
37
  return false // never block `up` on a stat that failed
31
38
  }
@@ -153,6 +160,26 @@ module.exports = [
153
160
  for (const n of locals)
154
161
  console.log(` ${n} → host.docker.internal:${state.local[n].port} (pid ${state.local[n].pid})`)
155
162
  }
163
+ // Version pins from `service deploy`. They live in docker-compose.override.yml and win over the
164
+ // generated compose file forever — so a pinned service silently stays behind while everything around
165
+ // it moves, and `up` looks like it worked. Flagged when the pin no longer matches the environment
166
+ // spec, because that is the case where it costs you: the local service-dooer-test-env sat on 3.1.1
167
+ // through a spec refresh, a regenerate and a --force-recreate, failing with a bug fixed weeks before.
168
+ const pins = state.deploy || {}
169
+ const names = Object.keys(pins)
170
+ if (names.length) {
171
+ console.log(chalk.yellow('\nPinned to a specific version (`service deploy`):'))
172
+ for (const n of names) {
173
+ const current = envSpec.imageFor(n)
174
+ const behind = current && current !== pins[n]
175
+ console.log(
176
+ ` ${n} → ${pins[n]}` +
177
+ (behind ? chalk.yellow(` ← the environment spec has ${current.split(':').pop()}`) : '')
178
+ )
179
+ }
180
+ console.log(chalk.gray(' clear a pin with: service deploy <name> <tag-from-the-spec>'))
181
+ }
182
+
156
183
  try {
157
184
  const reg = await discovery.list(rt.ROUTER_URL)
158
185
  const overrides = Object.keys((reg && reg.overrides) || {})
package/lib/copy.js CHANGED
@@ -104,6 +104,9 @@ async function copyOrganization({ organizationId, sourceEnv, targetEnv, reason,
104
104
  `, ${refs.rowsInserted} inserted (the rest the target already had)`
105
105
  )
106
106
  }
107
+ // Places the closure could not reach. Printed even though the copy succeeded: each one is a reference
108
+ // that may dangle, and a limitation nobody is told about is the same as one nobody fixed.
109
+ for (const w of (refs && refs.warnings) || []) console.log(chalk.yellow(` WARNING ${w}`))
107
110
 
108
111
  // Rows whose foreign key points at a parent that did not come with them. The load runs with FK
109
112
  // enforcement off (no ordering of 336 tables satisfies every constraint), and Postgres never re-checks,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dooer/dooer-test-env",
3
- "version": "1.19.0",
3
+ "version": "1.19.1",
4
4
  "description": "Run the whole Dooer backend locally (staging DB minus customers), copy/purge customers between environments, and shred — one CLI.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": "Dooer/cli-dooer-test-env",