Skip to content

Commit 74bec18

Browse files
committed
Fixing ts-node-cache in child pipeline by not inheriting variables from the parent pipeline
1 parent 8387c79 commit 74bec18

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

.gitlab-ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ variables:
55
# Prefer offline node module installation
66
NPM_CONFIG_PREFER_OFFLINE: "true"
77
# `ts-node` has its own cache
8-
TS_CACHED_TRANSPILE_CACHE: "./tmp/ts-node-cache"
8+
# It must use an absolute path, otherwise ts-node calls will CWD
9+
TS_CACHED_TRANSPILE_CACHE: "${CI_PROJECT_DIR}/tmp/ts-node-cache"
10+
TS_CACHED_TRANSPILE_PORTABLE: "true"
911

1012
# Cached directories shared between jobs & pipelines per-branch
1113
cache:
@@ -60,6 +62,12 @@ test-generate:
6062

6163
test:
6264
stage: test
65+
# Don't implicitly inherit top-level variables in child pipeline
66+
# All inherited variables should be explicitly defined here
67+
# Note that variables defined here override any variables defined in the child pipeline
68+
# This causes a bug with $CI_PROJECT_DIR, which is expanded into an empty string
69+
inherit:
70+
variables: false
6371
trigger:
6472
include:
6573
- artifact: tmp/test-pipelines.yml

scripts/test-pipelines.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ variables:
1212
# Prefer offline node module installation
1313
NPM_CONFIG_PREFER_OFFLINE: "true"
1414
# `ts-node` has its own cache
15-
TS_CACHED_TRANSPILE_CACHE: "./tmp/ts-node-cache"
15+
# It must use an absolute path, otherwise ts-node calls will CWD
16+
TS_CACHED_TRANSPILE_CACHE: "${CI_PROJECT_DIR}/tmp/ts-node-cache"
17+
TS_CACHED_TRANSPILE_PORTABLE: "true"
1618
1719
# Cached directories shared between jobs & pipelines per-branch
1820
cache:

0 commit comments

Comments
 (0)