-
-
Notifications
You must be signed in to change notification settings - Fork 990
fix(cli-v3): authenticate to Docker Hub to prevent rate limits (#2911) #2992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@trigger.dev/core": patch | ||
| --- | ||
|
|
||
| Fix: ConsoleInterceptor now delegates to original console methods to preserve log chain when other interceptors (like Sentry) are present. (#2900) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@trigger.dev/cli-v3": patch | ||
| --- | ||
|
|
||
| Fix: Native build server failed with Docker Hub rate limits. Added support for checking checking `DOCKER_USERNAME` and `DOCKER_PASSWORD` in environment variables and logging into Docker Hub before building. (#2911) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@trigger.dev/cli-v3": patch | ||
| --- | ||
|
|
||
| Fix: Ignore engine checks during deployment install phase to prevent failure on build server when Node version mismatch exists. (#2913) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
|
|
||
| import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; | ||
| import { updateTriggerPackages } from "./update.js"; | ||
| import * as nypm from "nypm"; | ||
| import * as pkgTypes from "pkg-types"; | ||
| import * as fs from "node:fs/promises"; | ||
| import * as clack from "@clack/prompts"; | ||
| import path from "node:path"; | ||
|
|
||
| // Mock dependencies | ||
| vi.mock("nypm"); | ||
| vi.mock("pkg-types"); | ||
| vi.mock("node:fs/promises"); | ||
| vi.mock("@clack/prompts"); | ||
| vi.mock("std-env", () => ({ | ||
| hasTTY: true, | ||
| isCI: false, | ||
| })); | ||
| vi.mock("../utilities/initialBanner.js", () => ({ | ||
| updateCheck: vi.fn().mockResolvedValue(undefined), | ||
| printStandloneInitialBanner: vi.fn(), | ||
| })); | ||
| vi.mock("../version.js", () => ({ | ||
| VERSION: "3.0.0", | ||
| })); | ||
| vi.mock("../cli/common.js", () => ({ | ||
| CommonCommandOptions: { pick: () => ({}) }, | ||
| })); | ||
| vi.mock("../utilities/cliOutput.js", () => ({ | ||
| chalkError: vi.fn(), | ||
| prettyError: vi.fn(), | ||
| prettyWarning: vi.fn(), | ||
| })); | ||
| vi.mock("../utilities/fileSystem.js", () => ({ | ||
| removeFile: vi.fn(), | ||
| writeJSONFilePreserveOrder: vi.fn(), | ||
| })); | ||
| vi.mock("../utilities/logger.js", () => ({ | ||
| logger: { | ||
| debug: vi.fn(), | ||
| log: vi.fn(), | ||
| table: vi.fn(), | ||
| }, | ||
| })); | ||
| vi.mock("../utilities/windows.js", () => ({ | ||
| spinner: () => ({ | ||
| start: vi.fn(), | ||
| message: vi.fn(), | ||
| stop: vi.fn(), | ||
| }), | ||
| })); | ||
|
|
||
| describe("updateTriggerPackages", () => { | ||
| beforeEach(() => { | ||
| vi.resetAllMocks(); | ||
|
|
||
| // Default mocks | ||
| vi.mocked(fs.writeFile).mockResolvedValue(undefined); | ||
| vi.mocked(fs.rm).mockResolvedValue(undefined); | ||
| vi.mocked(pkgTypes.readPackageJSON).mockResolvedValue({ | ||
| dependencies: { | ||
| "@trigger.dev/sdk": "2.0.0", // Mismatch | ||
| }, | ||
| }); | ||
| vi.mocked(pkgTypes.resolvePackageJSON).mockResolvedValue("/path/to/package.json"); | ||
| vi.mocked(clack.confirm).mockResolvedValue(true); // User confirms update | ||
| vi.mocked(nypm.installDependencies).mockResolvedValue(undefined); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| vi.clearAllMocks(); | ||
| }); | ||
|
|
||
| it("should pass --no-engine-strict for npm when ignoreEngines is true", async () => { | ||
| vi.mocked(nypm.detectPackageManager).mockResolvedValue({ name: "npm", command: "npm", version: "1.0.0" } as any); | ||
|
|
||
| await updateTriggerPackages(".", { ignoreEngines: true } as any, true, true); | ||
|
|
||
| expect(nypm.installDependencies).toHaveBeenCalledWith(expect.objectContaining({ | ||
| args: ["--no-engine-strict"], | ||
| })); | ||
| }); | ||
|
|
||
| it("should pass --config.engine-strict=false for pnpm when ignoreEngines is true", async () => { | ||
| vi.mocked(nypm.detectPackageManager).mockResolvedValue({ name: "pnpm", command: "pnpm", version: "1.0.0" } as any); | ||
|
|
||
| await updateTriggerPackages(".", { ignoreEngines: true } as any, true, true); | ||
|
|
||
| expect(nypm.installDependencies).toHaveBeenCalledWith(expect.objectContaining({ | ||
| args: ["--config.engine-strict=false"], | ||
| })); | ||
| }); | ||
|
|
||
| it("should pass --ignore-engines for yarn when ignoreEngines is true", async () => { | ||
| vi.mocked(nypm.detectPackageManager).mockResolvedValue({ name: "yarn", command: "yarn", version: "1.0.0" } as any); | ||
|
|
||
| await updateTriggerPackages(".", { ignoreEngines: true } as any, true, true); | ||
|
|
||
| expect(nypm.installDependencies).toHaveBeenCalledWith(expect.objectContaining({ | ||
| args: ["--ignore-engines"], | ||
| })); | ||
| }); | ||
|
|
||
| it("should NOT pass engine flags if ignoreEngines is false (default)", async () => { | ||
| vi.mocked(nypm.detectPackageManager).mockResolvedValue({ name: "npm", command: "npm", version: "1.0.0" } as any); | ||
|
|
||
| await updateTriggerPackages(".", { ignoreEngines: false } as any, true, true); | ||
|
|
||
| expect(nypm.installDependencies).toHaveBeenCalledWith(expect.objectContaining({ | ||
| args: [], | ||
| })); | ||
| }); | ||
|
Comment on lines
+1
to
+112
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mocks in this test conflict with repo testing policy. This suite relies on extensive As per coding guidelines: Use vitest exclusively for testing and never mock anything - use testcontainers instead. 🤖 Prompt for AI Agents |
||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ import * as semver from "semver"; | |
| export const UpdateCommandOptions = CommonCommandOptions.pick({ | ||
| logLevel: true, | ||
| skipTelemetry: true, | ||
| ignoreEngines: true, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Missing The Click to expandProblemIn export const UpdateCommandOptions = CommonCommandOptions.pick({
logLevel: true,
skipTelemetry: true,
ignoreEngines: true, // This key doesn't exist!
});However, export const CommonCommandOptions = z.object({
apiUrl: z.string().optional(),
logLevel: z.enum([...]).default("log"),
skipTelemetry: z.boolean().default(false),
profile: z.string().default(...),
});ImpactWhen using Zod's Recommendation: Add Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| }); | ||
|
|
||
| export type UpdateCommandOptions = z.infer<typeof UpdateCommandOptions>; | ||
|
|
@@ -257,11 +258,26 @@ export async function updateTriggerPackages( | |
| `Installing new package versions${packageManager ? ` with ${packageManager.name}` : ""}` | ||
| ); | ||
|
|
||
| await installDependencies({ cwd: projectPath, silent: true }); | ||
| const installArgs: string[] = []; | ||
|
|
||
| if (options.ignoreEngines && packageManager) { | ||
| switch (packageManager.name) { | ||
| case "npm": | ||
| installArgs.push("--no-engine-strict"); | ||
| break; | ||
| case "pnpm": | ||
| installArgs.push("--config.engine-strict=false"); | ||
| break; | ||
| case "yarn": | ||
| installArgs.push("--ignore-engines"); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| await installDependencies({ cwd: projectPath, silent: true, args: installArgs }); | ||
| } catch (error) { | ||
| installSpinner.stop( | ||
| `Failed to install new package versions${ | ||
| packageManager ? ` with ${packageManager.name}` : "" | ||
| `Failed to install new package versions${packageManager ? ` with ${packageManager.name}` : "" | ||
| }` | ||
| ); | ||
|
Comment on lines
+261
to
282
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result:
So, instead of npm install --engine-strict=falseAnd to enable it: npm install --engine-strict
# (equivalent to --engine-strict=true)What it does: when References Citations:
🌐 Web query:
💡 Result:
pnpm install --config.engine-strict=false
# (or pnpm add ... --config.engine-strict=false)This The setting itself is documented as # .npmrc
engine-strict=false
``` [2]
**Sources:** [1] [2]
---
🌐 Web query:
`yarn --ignore-engines flag v1 v2 Berry documentation`
💡 Result:
- **Yarn v1 (Classic)** supports `--ignore-engines` (skips the `engines` compatibility check). It’s documented on the Classic `yarn install` page under “`yarn install --ignore-engines`”. [1]
- **Yarn v2+ (Berry / modern Yarn)**: the current `yarn install` docs **do not list** a `--ignore-engines` option. [2] Relatedly, Berry has an open feature request to “return / restore” the old Yarn 1.x-style `engines` check behavior (“Just restore old behavior from 1.x”). [3]
**Sources:**
[1] Yarn Classic `yarn install` docs (includes `--ignore-engines`) ([classic.yarnpkg.com](https://classic.yarnpkg.com/en/docs/cli/install?utm_source=openai))
[2] Yarn (Berry) `yarn install` docs (options list; no `--ignore-engines`) ([yarnpkg.com](https://yarnpkg.com/cli/install?utm_source=openai))
[3] Berry issue: “[Feature] Return ‘engines’ check” (`#1177`) ([github.com](https://github.com/yarnpkg/berry/issues/1177))
Citations:
- 1: https://classic.yarnpkg.com/en/docs/cli/install?utm_source=openai
- 2: https://yarnpkg.com/cli/install?utm_source=openai
- 3: https://github.com/yarnpkg/berry/issues/1177
---
🏁 Script executed:
```shell
# Check if there's any version pinning or nypm configuration in the project
cd packages/cli-v3 && find . -name "package.json" -type f | head -5 | xargs cat | grep -E "(nypm|npm|pnpm|yarn)" | head -20Repository: triggerdotdev/trigger.dev Length of output: 661 🏁 Script executed: # Look for nypm usage and version info
rg "nypm" packages/cli-v3/src/commands/update.ts -B 5 -A 5Repository: triggerdotdev/trigger.dev Length of output: 592 🏁 Script executed: # Check the full context of how packageManager is obtained
rg "packageManager" packages/cli-v3/src/commands/update.ts -B 10 -A 10 | head -50Repository: triggerdotdev/trigger.dev Length of output: 1481 Fix npm and Yarn engine-strict flags; they are incorrect for the current versions.
🤖 Prompt for AI Agents |
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix duplicated word in changelog.
There’s a typo (“checking checking”) in the user-facing release note.
✏️ Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents