@rallycry/conveyor-agent 11.0.19 → 11.0.21

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.
@@ -1,14 +1,17 @@
1
1
  import {
2
+ POD_PROFILE_ENV,
2
3
  awaitGitReady,
3
4
  buildSessionPreviewPorts,
5
+ isPodProfile,
4
6
  loadForwardPorts,
7
+ podProfileRunsWorkload,
5
8
  readWorkspaceBytes,
6
9
  statWorkspacePath,
7
10
  workspacePathExists
8
- } from "./chunk-WS7QRB37.js";
11
+ } from "./chunk-4ZDIBDQC.js";
9
12
  import {
10
13
  reportBootMilestone
11
- } from "./chunk-GL2DIQEQ.js";
14
+ } from "./chunk-Q4FQOJ7D.js";
12
15
  import {
13
16
  runSetupCommand,
14
17
  runStartCommand,
@@ -91,11 +94,21 @@ async function runDbSchemaSync(options) {
91
94
 
92
95
  // src/setup/deps-sync.ts
93
96
  import { join as join2 } from "path";
97
+
98
+ // src/setup/pod-profile-env.ts
99
+ function podRunsWorkload(env = process.env) {
100
+ const raw = env[POD_PROFILE_ENV]?.trim();
101
+ if (!raw || !isPodProfile(raw)) return true;
102
+ return podProfileRunsWorkload(raw);
103
+ }
104
+
105
+ // src/setup/deps-sync.ts
94
106
  var INSTALLER_SCRIPT_CANDIDATES = ["scripts/install-deps.sh"];
95
107
  var BUN_INSTALL = "bun install --frozen-lockfile";
96
108
  var DEPS_SYNC_TIMEOUT_MS = 9e5;
97
109
  var REGISTRY_KEY_ENV = "NPM_CACHE_READER_KEY";
98
110
  function isDisabled2(env) {
111
+ if (!podRunsWorkload(env)) return true;
99
112
  const flag = env.CONVEYOR_DEPS_SYNC?.trim().toLowerCase();
100
113
  return flag === "0" || flag === "false";
101
114
  }
@@ -276,6 +289,7 @@ function parseHostPort(value, defaultPort) {
276
289
  }
277
290
  function resolveSidecarTargets(env = process.env) {
278
291
  const targets = [];
292
+ if (!podRunsWorkload(env)) return targets;
279
293
  const databaseUrl = env.DATABASE_URL;
280
294
  if (databaseUrl) {
281
295
  try {
@@ -128,7 +128,7 @@ function errText(err) {
128
128
  }
129
129
  async function syncTaskBranchToRepo(deps, paths) {
130
130
  const { git, log } = deps;
131
- const { branch, baseBranch } = deps.bundle.gitPlan;
131
+ const { branch } = deps.bundle.gitPlan;
132
132
  try {
133
133
  await git(["remote", "set-url", "origin", paths.remoteUrl], {
134
134
  cwd: paths.repoDir,
@@ -140,6 +140,18 @@ async function syncTaskBranchToRepo(deps, paths) {
140
140
  }
141
141
  const credentialFailure = await persistCredentialHelper(deps, paths);
142
142
  if (credentialFailure) return credentialFailure;
143
+ const [, resetSucceeded] = await Promise.all([
144
+ warmBaseBranch(deps, paths),
145
+ resetTrackedChanges(deps, paths)
146
+ ]);
147
+ if (!resetSucceeded) return { state: "failed", reason: "pre-checkout reset failed" };
148
+ log.info(`[boot] Repo remote ready; agent will checkout ${branch}`);
149
+ return { state: "ready" };
150
+ }
151
+ async function warmBaseBranch(deps, paths) {
152
+ const { git, log } = deps;
153
+ const { baseBranch } = deps.bundle.gitPlan;
154
+ const started = performance.now();
143
155
  try {
144
156
  await git(["fetch", "origin", `+refs/heads/${baseBranch}:refs/remotes/origin/${baseBranch}`], {
145
157
  cwd: paths.repoDir,
@@ -147,17 +159,24 @@ async function syncTaskBranchToRepo(deps, paths) {
147
159
  });
148
160
  } catch (err) {
149
161
  log.warn(`[boot] WARN: fetch origin/${baseBranch} failed: ${errText(err)}`);
162
+ } finally {
163
+ log.info(`[boot] step=gitFetchBase ms=${Math.round(performance.now() - started)}`);
150
164
  }
165
+ }
166
+ async function resetTrackedChanges(deps, paths) {
167
+ const { git, log } = deps;
168
+ const started = performance.now();
151
169
  try {
152
170
  await git(["reset", "--hard", "HEAD"], { cwd: paths.repoDir, timeoutMs: QUICK_GIT_TIMEOUT_MS });
171
+ return true;
153
172
  } catch (err) {
154
173
  log.error(
155
174
  `[boot] ERROR: failed to clean tracked repo changes before checkout: ${errText(err)}`
156
175
  );
157
- return { state: "failed", reason: "pre-checkout reset failed" };
176
+ return false;
177
+ } finally {
178
+ log.info(`[boot] step=gitResetTracked ms=${Math.round(performance.now() - started)}`);
158
179
  }
159
- log.info(`[boot] Repo remote ready; agent will checkout ${branch}`);
160
- return { state: "ready" };
161
180
  }
162
181
  async function persistCredentialHelper(deps, paths) {
163
182
  try {