@catladder/pipeline 1.154.3 → 1.156.0
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.
- package/dist/build/base/writeDotEnv.js +8 -0
- package/dist/build/node/cache.d.ts +3 -2
- package/dist/build/node/cache.js +12 -3
- package/dist/bundles/catladder-gitlab/index.js +2 -2
- package/dist/constants.js +1 -1
- package/dist/context/getBuildInfoVariables.d.ts +2 -3
- package/dist/context/getBuildInfoVariables.js +43 -17
- package/dist/context/getEnvironmentVariables.d.ts +0 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/examples/__snapshots__/cloud-run-with-sql.ts.snap +56 -24
- package/examples/__snapshots__/native-app.ts.snap +0 -12
- package/package.json +1 -1
- package/src/build/base/writeDotEnv.ts +4 -0
- package/src/build/node/buildJob.ts +6 -1
- package/src/build/node/cache.ts +15 -1
- package/src/build/node/testJob.ts +1 -0
- package/src/context/getBuildInfoVariables.ts +25 -30
|
@@ -21,6 +21,13 @@ exports[`matches snapshot 1`] = `
|
|
|
21
21
|
],
|
|
22
22
|
"policy": "pull-push",
|
|
23
23
|
},
|
|
24
|
+
{
|
|
25
|
+
"key": "myWorkspace-turbo",
|
|
26
|
+
"paths": [
|
|
27
|
+
".turbo",
|
|
28
|
+
],
|
|
29
|
+
"policy": "pull-push",
|
|
30
|
+
},
|
|
24
31
|
],
|
|
25
32
|
"image": "path/to/docker/jobs-default:the-version",
|
|
26
33
|
"interruptible": true,
|
|
@@ -88,6 +95,13 @@ exports[`matches snapshot 1`] = `
|
|
|
88
95
|
],
|
|
89
96
|
"policy": "pull-push",
|
|
90
97
|
},
|
|
98
|
+
{
|
|
99
|
+
"key": "myWorkspace-turbo",
|
|
100
|
+
"paths": [
|
|
101
|
+
".turbo",
|
|
102
|
+
],
|
|
103
|
+
"policy": "pull-push",
|
|
104
|
+
},
|
|
91
105
|
{
|
|
92
106
|
"key": "myWorkspace-next-cache",
|
|
93
107
|
"paths": [
|
|
@@ -115,9 +129,6 @@ exports[`matches snapshot 1`] = `
|
|
|
115
129
|
ENV_SHORT=dev
|
|
116
130
|
APP_DIR=api
|
|
117
131
|
ENV_TYPE=dev
|
|
118
|
-
BUILD_INFO_BUILD_ID=$(git describe --tags 2>/dev/null || git rev-parse HEAD)
|
|
119
|
-
BUILD_INFO_BUILD_TIME=$CI_JOB_STARTED_AT
|
|
120
|
-
BUILD_INFO_CURRENT_VERSION=$(tag=$(git ls-remote origin "refs/tags/v*[0-9]" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags\\/v//'); [ -z "$tag" ] && echo "0.0.0" || echo "$tag")
|
|
121
132
|
HOST=$(printf %s "pan-test-app-dev-api-$CL_dev_api_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
122
133
|
ROOT_URL=https://$(printf %s "pan-test-app-dev-api-$CL_dev_api_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
123
134
|
HOST_INTERNAL=$(printf %s "pan-test-app-dev-api-$CL_dev_api_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
@@ -143,9 +154,6 @@ EOF",
|
|
|
143
154
|
ENV_SHORT=dev
|
|
144
155
|
APP_DIR=www
|
|
145
156
|
ENV_TYPE=dev
|
|
146
|
-
BUILD_INFO_BUILD_ID=$(git describe --tags 2>/dev/null || git rev-parse HEAD)
|
|
147
|
-
BUILD_INFO_BUILD_TIME=$CI_JOB_STARTED_AT
|
|
148
|
-
BUILD_INFO_CURRENT_VERSION=$(tag=$(git ls-remote origin "refs/tags/v*[0-9]" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags\\/v//'); [ -z "$tag" ] && echo "0.0.0" || echo "$tag")
|
|
149
157
|
HOST=$(printf %s "pan-test-app-dev-www-$CL_dev_www_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
150
158
|
ROOT_URL=https://$(printf %s "pan-test-app-dev-www-$CL_dev_www_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
151
159
|
HOST_INTERNAL=$(printf %s "pan-test-app-dev-www-$CL_dev_www_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
@@ -222,6 +230,13 @@ EOF",
|
|
|
222
230
|
],
|
|
223
231
|
"policy": "pull-push",
|
|
224
232
|
},
|
|
233
|
+
{
|
|
234
|
+
"key": "myWorkspace-turbo",
|
|
235
|
+
"paths": [
|
|
236
|
+
".turbo",
|
|
237
|
+
],
|
|
238
|
+
"policy": "pull-push",
|
|
239
|
+
},
|
|
225
240
|
],
|
|
226
241
|
"image": "path/to/docker/jobs-testing-chrome:the-version",
|
|
227
242
|
"interruptible": true,
|
|
@@ -963,6 +978,13 @@ EOF
|
|
|
963
978
|
],
|
|
964
979
|
"policy": "pull-push",
|
|
965
980
|
},
|
|
981
|
+
{
|
|
982
|
+
"key": "myWorkspace-turbo",
|
|
983
|
+
"paths": [
|
|
984
|
+
".turbo",
|
|
985
|
+
],
|
|
986
|
+
"policy": "pull-push",
|
|
987
|
+
},
|
|
966
988
|
],
|
|
967
989
|
"image": "path/to/docker/jobs-default:the-version",
|
|
968
990
|
"interruptible": true,
|
|
@@ -1030,6 +1052,13 @@ EOF
|
|
|
1030
1052
|
],
|
|
1031
1053
|
"policy": "pull-push",
|
|
1032
1054
|
},
|
|
1055
|
+
{
|
|
1056
|
+
"key": "myWorkspace-turbo",
|
|
1057
|
+
"paths": [
|
|
1058
|
+
".turbo",
|
|
1059
|
+
],
|
|
1060
|
+
"policy": "pull-push",
|
|
1061
|
+
},
|
|
1033
1062
|
{
|
|
1034
1063
|
"key": "myWorkspace-next-cache",
|
|
1035
1064
|
"paths": [
|
|
@@ -1057,9 +1086,6 @@ EOF
|
|
|
1057
1086
|
ENV_SHORT=review
|
|
1058
1087
|
APP_DIR=api
|
|
1059
1088
|
ENV_TYPE=review
|
|
1060
|
-
BUILD_INFO_BUILD_ID=$(git describe --tags 2>/dev/null || git rev-parse HEAD)
|
|
1061
|
-
BUILD_INFO_BUILD_TIME=$CI_JOB_STARTED_AT
|
|
1062
|
-
BUILD_INFO_CURRENT_VERSION=$(tag=$(git ls-remote origin "refs/tags/v*[0-9]" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags\\/v//'); [ -z "$tag" ] && echo "0.0.0" || echo "$tag")
|
|
1063
1089
|
HOST=$(printf %s "pan-test-app-review-$([ -n "$CI_MERGE_REQUEST_IID" ] && echo "mr$CI_MERGE_REQUEST_IID" || { [ -n "$CI_COMMIT_REF_SLUG" ] && echo "$CI_COMMIT_REF_SLUG" || echo "unknown"; })-api-$CL_review_api_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
1064
1090
|
ROOT_URL=https://$(printf %s "pan-test-app-review-$([ -n "$CI_MERGE_REQUEST_IID" ] && echo "mr$CI_MERGE_REQUEST_IID" || { [ -n "$CI_COMMIT_REF_SLUG" ] && echo "$CI_COMMIT_REF_SLUG" || echo "unknown"; })-api-$CL_review_api_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
1065
1091
|
HOST_INTERNAL=$(printf %s "pan-test-app-review-$([ -n "$CI_MERGE_REQUEST_IID" ] && echo "mr$CI_MERGE_REQUEST_IID" || { [ -n "$CI_COMMIT_REF_SLUG" ] && echo "$CI_COMMIT_REF_SLUG" || echo "unknown"; })-api-$CL_review_api_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
@@ -1085,9 +1111,6 @@ EOF",
|
|
|
1085
1111
|
ENV_SHORT=review
|
|
1086
1112
|
APP_DIR=www
|
|
1087
1113
|
ENV_TYPE=review
|
|
1088
|
-
BUILD_INFO_BUILD_ID=$(git describe --tags 2>/dev/null || git rev-parse HEAD)
|
|
1089
|
-
BUILD_INFO_BUILD_TIME=$CI_JOB_STARTED_AT
|
|
1090
|
-
BUILD_INFO_CURRENT_VERSION=$(tag=$(git ls-remote origin "refs/tags/v*[0-9]" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags\\/v//'); [ -z "$tag" ] && echo "0.0.0" || echo "$tag")
|
|
1091
1114
|
HOST=$(printf %s "pan-test-app-review-$([ -n "$CI_MERGE_REQUEST_IID" ] && echo "mr$CI_MERGE_REQUEST_IID" || { [ -n "$CI_COMMIT_REF_SLUG" ] && echo "$CI_COMMIT_REF_SLUG" || echo "unknown"; })-www-$CL_review_www_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
1092
1115
|
ROOT_URL=https://$(printf %s "pan-test-app-review-$([ -n "$CI_MERGE_REQUEST_IID" ] && echo "mr$CI_MERGE_REQUEST_IID" || { [ -n "$CI_COMMIT_REF_SLUG" ] && echo "$CI_COMMIT_REF_SLUG" || echo "unknown"; })-www-$CL_review_www_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
1093
1116
|
HOST_INTERNAL=$(printf %s "pan-test-app-review-$([ -n "$CI_MERGE_REQUEST_IID" ] && echo "mr$CI_MERGE_REQUEST_IID" || { [ -n "$CI_COMMIT_REF_SLUG" ] && echo "$CI_COMMIT_REF_SLUG" || echo "unknown"; })-www-$CL_review_www_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
@@ -1164,6 +1187,13 @@ EOF",
|
|
|
1164
1187
|
],
|
|
1165
1188
|
"policy": "pull-push",
|
|
1166
1189
|
},
|
|
1190
|
+
{
|
|
1191
|
+
"key": "myWorkspace-turbo",
|
|
1192
|
+
"paths": [
|
|
1193
|
+
".turbo",
|
|
1194
|
+
],
|
|
1195
|
+
"policy": "pull-push",
|
|
1196
|
+
},
|
|
1167
1197
|
],
|
|
1168
1198
|
"image": "path/to/docker/jobs-testing-chrome:the-version",
|
|
1169
1199
|
"interruptible": true,
|
|
@@ -1941,6 +1971,13 @@ EOF
|
|
|
1941
1971
|
],
|
|
1942
1972
|
"policy": "pull-push",
|
|
1943
1973
|
},
|
|
1974
|
+
{
|
|
1975
|
+
"key": "myWorkspace-turbo",
|
|
1976
|
+
"paths": [
|
|
1977
|
+
".turbo",
|
|
1978
|
+
],
|
|
1979
|
+
"policy": "pull-push",
|
|
1980
|
+
},
|
|
1944
1981
|
{
|
|
1945
1982
|
"key": "myWorkspace-next-cache",
|
|
1946
1983
|
"paths": [
|
|
@@ -1968,9 +2005,6 @@ EOF
|
|
|
1968
2005
|
ENV_SHORT=prod
|
|
1969
2006
|
APP_DIR=api
|
|
1970
2007
|
ENV_TYPE=prod
|
|
1971
|
-
BUILD_INFO_BUILD_ID=$(git describe --tags 2>/dev/null || git rev-parse HEAD)
|
|
1972
|
-
BUILD_INFO_BUILD_TIME=$CI_JOB_STARTED_AT
|
|
1973
|
-
BUILD_INFO_CURRENT_VERSION=$(tag=$(git ls-remote origin "refs/tags/v*[0-9]" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags\\/v//'); [ -z "$tag" ] && echo "0.0.0" || echo "$tag")
|
|
1974
2008
|
HOST=$(printf %s "pan-test-app-prod-api-$CL_prod_api_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
1975
2009
|
ROOT_URL=https://$(printf %s "pan-test-app-prod-api-$CL_prod_api_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
1976
2010
|
HOST_INTERNAL=$(printf %s "pan-test-app-prod-api-$CL_prod_api_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
@@ -1996,9 +2030,6 @@ EOF",
|
|
|
1996
2030
|
ENV_SHORT=prod
|
|
1997
2031
|
APP_DIR=www
|
|
1998
2032
|
ENV_TYPE=prod
|
|
1999
|
-
BUILD_INFO_BUILD_ID=$(git describe --tags 2>/dev/null || git rev-parse HEAD)
|
|
2000
|
-
BUILD_INFO_BUILD_TIME=$CI_JOB_STARTED_AT
|
|
2001
|
-
BUILD_INFO_CURRENT_VERSION=$(tag=$(git ls-remote origin "refs/tags/v*[0-9]" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags\\/v//'); [ -z "$tag" ] && echo "0.0.0" || echo "$tag")
|
|
2002
2033
|
HOST=$(printf %s "pan-test-app-prod-www-$CL_prod_www_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
2003
2034
|
ROOT_URL=https://$(printf %s "pan-test-app-prod-www-$CL_prod_www_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
2004
2035
|
HOST_INTERNAL=$(printf %s "pan-test-app-prod-www-$CL_prod_www_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
@@ -2064,6 +2095,13 @@ EOF",
|
|
|
2064
2095
|
],
|
|
2065
2096
|
"policy": "pull-push",
|
|
2066
2097
|
},
|
|
2098
|
+
{
|
|
2099
|
+
"key": "myWorkspace-turbo",
|
|
2100
|
+
"paths": [
|
|
2101
|
+
".turbo",
|
|
2102
|
+
],
|
|
2103
|
+
"policy": "pull-push",
|
|
2104
|
+
},
|
|
2067
2105
|
{
|
|
2068
2106
|
"key": "myWorkspace-next-cache",
|
|
2069
2107
|
"paths": [
|
|
@@ -2091,9 +2129,6 @@ EOF",
|
|
|
2091
2129
|
ENV_SHORT=stage
|
|
2092
2130
|
APP_DIR=api
|
|
2093
2131
|
ENV_TYPE=stage
|
|
2094
|
-
BUILD_INFO_BUILD_ID=$(git describe --tags 2>/dev/null || git rev-parse HEAD)
|
|
2095
|
-
BUILD_INFO_BUILD_TIME=$CI_JOB_STARTED_AT
|
|
2096
|
-
BUILD_INFO_CURRENT_VERSION=$(tag=$(git ls-remote origin "refs/tags/v*[0-9]" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags\\/v//'); [ -z "$tag" ] && echo "0.0.0" || echo "$tag")
|
|
2097
2132
|
HOST=$(printf %s "pan-test-app-stage-api-$CL_stage_api_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
2098
2133
|
ROOT_URL=https://$(printf %s "pan-test-app-stage-api-$CL_stage_api_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
2099
2134
|
HOST_INTERNAL=$(printf %s "pan-test-app-stage-api-$CL_stage_api_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
@@ -2119,9 +2154,6 @@ EOF",
|
|
|
2119
2154
|
ENV_SHORT=stage
|
|
2120
2155
|
APP_DIR=www
|
|
2121
2156
|
ENV_TYPE=stage
|
|
2122
|
-
BUILD_INFO_BUILD_ID=$(git describe --tags 2>/dev/null || git rev-parse HEAD)
|
|
2123
|
-
BUILD_INFO_BUILD_TIME=$CI_JOB_STARTED_AT
|
|
2124
|
-
BUILD_INFO_CURRENT_VERSION=$(tag=$(git ls-remote origin "refs/tags/v*[0-9]" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags\\/v//'); [ -z "$tag" ] && echo "0.0.0" || echo "$tag")
|
|
2125
2157
|
HOST=$(printf %s "pan-test-app-stage-www-$CL_stage_www_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
2126
2158
|
ROOT_URL=https://$(printf %s "pan-test-app-stage-www-$CL_stage_www_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
2127
2159
|
HOST_INTERNAL=$(printf %s "pan-test-app-stage-www-$CL_stage_www_GCLOUD_RUN_canonicalHostSuffix" | awk '{print tolower($0)}')
|
|
@@ -647,9 +647,6 @@ EOF
|
|
|
647
647
|
ENV_SHORT=dev
|
|
648
648
|
APP_DIR=app
|
|
649
649
|
ENV_TYPE=dev
|
|
650
|
-
BUILD_INFO_BUILD_ID=$(git describe --tags 2>/dev/null || git rev-parse HEAD)
|
|
651
|
-
BUILD_INFO_BUILD_TIME=$CI_JOB_STARTED_AT
|
|
652
|
-
BUILD_INFO_CURRENT_VERSION=$(tag=$(git ls-remote origin "refs/tags/v*[0-9]" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags\\/v//'); [ -z "$tag" ] && echo "0.0.0" || echo "$tag")
|
|
653
650
|
HOST=unknown-host.example.com
|
|
654
651
|
ROOT_URL=https://unknown-host.example.com
|
|
655
652
|
HOST_INTERNAL=unknown-host.example.com
|
|
@@ -1605,9 +1602,6 @@ EOF
|
|
|
1605
1602
|
ENV_SHORT=review
|
|
1606
1603
|
APP_DIR=app
|
|
1607
1604
|
ENV_TYPE=review
|
|
1608
|
-
BUILD_INFO_BUILD_ID=$(git describe --tags 2>/dev/null || git rev-parse HEAD)
|
|
1609
|
-
BUILD_INFO_BUILD_TIME=$CI_JOB_STARTED_AT
|
|
1610
|
-
BUILD_INFO_CURRENT_VERSION=$(tag=$(git ls-remote origin "refs/tags/v*[0-9]" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags\\/v//'); [ -z "$tag" ] && echo "0.0.0" || echo "$tag")
|
|
1611
1605
|
HOST=unknown-host.example.com
|
|
1612
1606
|
ROOT_URL=https://unknown-host.example.com
|
|
1613
1607
|
HOST_INTERNAL=unknown-host.example.com
|
|
@@ -2722,9 +2716,6 @@ EOF
|
|
|
2722
2716
|
ENV_SHORT=prod
|
|
2723
2717
|
APP_DIR=app
|
|
2724
2718
|
ENV_TYPE=prod
|
|
2725
|
-
BUILD_INFO_BUILD_ID=$(git describe --tags 2>/dev/null || git rev-parse HEAD)
|
|
2726
|
-
BUILD_INFO_BUILD_TIME=$CI_JOB_STARTED_AT
|
|
2727
|
-
BUILD_INFO_CURRENT_VERSION=$(tag=$(git ls-remote origin "refs/tags/v*[0-9]" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags\\/v//'); [ -z "$tag" ] && echo "0.0.0" || echo "$tag")
|
|
2728
2719
|
HOST=unknown-host.example.com
|
|
2729
2720
|
ROOT_URL=https://unknown-host.example.com
|
|
2730
2721
|
HOST_INTERNAL=unknown-host.example.com
|
|
@@ -2851,9 +2842,6 @@ EOF",
|
|
|
2851
2842
|
ENV_SHORT=stage
|
|
2852
2843
|
APP_DIR=app
|
|
2853
2844
|
ENV_TYPE=stage
|
|
2854
|
-
BUILD_INFO_BUILD_ID=$(git describe --tags 2>/dev/null || git rev-parse HEAD)
|
|
2855
|
-
BUILD_INFO_BUILD_TIME=$CI_JOB_STARTED_AT
|
|
2856
|
-
BUILD_INFO_CURRENT_VERSION=$(tag=$(git ls-remote origin "refs/tags/v*[0-9]" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags\\/v//'); [ -z "$tag" ] && echo "0.0.0" || echo "$tag")
|
|
2857
2845
|
HOST=unknown-host.example.com
|
|
2858
2846
|
ROOT_URL=https://unknown-host.example.com
|
|
2859
2847
|
HOST_INTERNAL=unknown-host.example.com
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isNil } from "lodash";
|
|
2
2
|
import type { ComponentContext } from "../../types";
|
|
3
3
|
import { collapseableSection } from "../../utils/gitlab";
|
|
4
|
+
import { ALL_BUILD_VARIABLES } from "../../context/getBuildInfoVariables";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* writes a .env file in the components folder
|
|
@@ -14,6 +15,9 @@ export const writeDotEnv = (context: ComponentContext) => {
|
|
|
14
15
|
const keyValueString = Object.entries(envVars)
|
|
15
16
|
// filter out null and undefined values
|
|
16
17
|
.filter(([, value]) => !isNil(value))
|
|
18
|
+
// filter out build variables, since they may interfer with caching like turbo
|
|
19
|
+
// build variables are rarely used anyway and we may treat them differently in the future
|
|
20
|
+
.filter(([key]) => !ALL_BUILD_VARIABLES.includes(key))
|
|
17
21
|
.map(
|
|
18
22
|
([key, value]) => `${key}=${value?.toString().replaceAll("\n", "\\n")}`,
|
|
19
23
|
)
|
|
@@ -15,7 +15,12 @@ import type { DockerBuildJobDefinition } from "../docker";
|
|
|
15
15
|
import { getDockerBuildScriptWithBuiltInDockerFile } from "../docker";
|
|
16
16
|
import type { BuildConfigDocker } from "../types";
|
|
17
17
|
import { isOfBuildType } from "../types";
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
getNextCache,
|
|
20
|
+
getNodeCache,
|
|
21
|
+
getWorkspaceDefaultCaches,
|
|
22
|
+
getYarnCache,
|
|
23
|
+
} from "./cache";
|
|
19
24
|
import { NODE_RUNNER_BUILD_VARIABLES } from "./constants";
|
|
20
25
|
import { getDockerAppCopyAndBuildScript, getYarnInstall } from "./yarn";
|
|
21
26
|
|
package/src/build/node/cache.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { uniq } from "lodash";
|
|
2
2
|
import { join } from "path";
|
|
3
3
|
import slugify from "slugify";
|
|
4
|
-
import type { Context } from "../../types/context";
|
|
4
|
+
import type { Context, WorkspaceContext } from "../../types/context";
|
|
5
5
|
import type { GitlabJobCache } from "../../types/gitlab-types";
|
|
6
6
|
|
|
7
7
|
export const getYarnCache = (
|
|
@@ -63,6 +63,7 @@ export const getNodeCache = (
|
|
|
63
63
|
return [
|
|
64
64
|
...getYarnCache(context, policy),
|
|
65
65
|
...getNodeModulesCache(context, policy),
|
|
66
|
+
...(context.type === "workspace" ? getWorkspaceDefaultCaches(context) : []),
|
|
66
67
|
];
|
|
67
68
|
};
|
|
68
69
|
|
|
@@ -80,3 +81,16 @@ export const getNextCache = (context: Context): GitlabJobCache[] => {
|
|
|
80
81
|
},
|
|
81
82
|
];
|
|
82
83
|
};
|
|
84
|
+
|
|
85
|
+
export const getWorkspaceDefaultCaches = (
|
|
86
|
+
context: WorkspaceContext,
|
|
87
|
+
): GitlabJobCache[] => {
|
|
88
|
+
return [
|
|
89
|
+
{
|
|
90
|
+
// turbo repo
|
|
91
|
+
key: context.name + "-turbo",
|
|
92
|
+
policy: "pull-push",
|
|
93
|
+
paths: [join(context.build.dir, ".turbo")],
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
};
|
|
@@ -1,41 +1,36 @@
|
|
|
1
1
|
import { BashExpression } from "../bash/BashExpression";
|
|
2
2
|
import type { BashExpressionPerPipelineType } from "../bash/bashExpressionPerPipelineType";
|
|
3
3
|
import { getBashExpressionPerPipelineType } from "../bash/bashExpressionPerPipelineType";
|
|
4
|
-
import type { BuildConfig } from "../build";
|
|
5
4
|
import type { EnvironmentContext } from "../types/environmentContext";
|
|
6
5
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
const BUILD_VARIABLES = {
|
|
7
|
+
BUILD_INFO_BUILD_ID: {
|
|
8
|
+
default: new BashExpression(
|
|
9
|
+
`$(git describe --tags 2>/dev/null || git rev-parse HEAD)`,
|
|
10
|
+
),
|
|
11
|
+
},
|
|
12
|
+
BUILD_INFO_BUILD_TIME: {
|
|
13
|
+
default: "unknown-build-time",
|
|
14
|
+
gitlab: new BashExpression(`$CI_JOB_STARTED_AT`),
|
|
15
|
+
},
|
|
16
|
+
BUILD_INFO_CURRENT_VERSION: {
|
|
17
|
+
default: new BashExpression(
|
|
18
|
+
// because we do shallow fetch, we need to ask the origin
|
|
19
|
+
`$(tag=$(git ls-remote origin "refs/tags/v*[0-9]" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags\\/v//'); [ -z "$tag" ] && echo "0.0.0" || echo "$tag")`,
|
|
20
|
+
),
|
|
21
|
+
},
|
|
22
|
+
} satisfies {
|
|
23
|
+
[key: string]: BashExpressionPerPipelineType;
|
|
22
24
|
};
|
|
23
25
|
|
|
26
|
+
export const ALL_BUILD_VARIABLES = Object.keys(BUILD_VARIABLES);
|
|
24
27
|
export const getBuildInfoVariables = (ctx: EnvironmentContext) => {
|
|
25
28
|
const { pipelineType } = ctx;
|
|
26
29
|
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
pipelineType,
|
|
31
|
-
),
|
|
32
|
-
|
|
33
|
-
BUILD_TIME,
|
|
34
|
-
pipelineType,
|
|
35
|
-
),
|
|
36
|
-
BUILD_INFO_CURRENT_VERSION: getBashExpressionPerPipelineType(
|
|
37
|
-
CURRENT_VERSION,
|
|
38
|
-
pipelineType,
|
|
39
|
-
),
|
|
40
|
-
};
|
|
30
|
+
return Object.fromEntries(
|
|
31
|
+
Object.entries(BUILD_VARIABLES).map(([key, value]) => [
|
|
32
|
+
key,
|
|
33
|
+
getBashExpressionPerPipelineType(value, pipelineType),
|
|
34
|
+
]),
|
|
35
|
+
);
|
|
41
36
|
};
|