From 7163a300a2b7b7218f08592f24911f30ce8eff23 Mon Sep 17 00:00:00 2001 From: ANGkeith Date: Wed, 30 Jul 2025 23:54:13 +0800 Subject: [PATCH] fix: expand variable when parsing cache path --- src/job.ts | 3 ++- tests/test-cases/cache-directives/integration.test.ts | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/job.ts b/src/job.ts index 560380d02..dc0e6d4fa 100644 --- a/src/job.ts +++ b/src/job.ts @@ -1224,7 +1224,8 @@ export class Job { }); endTime = process.hrtime(time); - for (const _path of c.paths) { + for (const __path of c.paths) { + const _path = Utils.expandText(__path, expanded); if (!Utils.isSubpath(_path, this.argv.cwd, this.argv.cwd)) { writeStreams.stdout(chalk`{yellow WARNING: processPath: artifact path is not a subpath of project directory: ${_path}}\n`); continue; diff --git a/tests/test-cases/cache-directives/integration.test.ts b/tests/test-cases/cache-directives/integration.test.ts index cf7288925..53f03e655 100644 --- a/tests/test-cases/cache-directives/integration.test.ts +++ b/tests/test-cases/cache-directives/integration.test.ts @@ -14,8 +14,10 @@ test.concurrent("cache-directives --shell-isolation --needs", async ( await handler({ cwd: "tests/test-cases/cache-directives", job: ["test-job"], + noColor: true, shellIsolation: true, }, writeStreams); await expect(fs.pathExists("tests/test-cases/cache-directives/.gitlab-ci-local/cache/default/cache/file1.txt")).resolves.toBe(true); + expect(writeStreams.stdoutLines.join("\n")).toContain("cache/**.txt: found 1 artifact files and directories"); });