Skip to content

Commit 206f700

Browse files
refactor: Update patch to include logs for potential google-cloud write errors (LLC-1266) (#814)
1 parent 124464c commit 206f700

File tree

2 files changed

+50
-8
lines changed

2 files changed

+50
-8
lines changed

.circleci/config.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,19 @@ jobs:
1616
working_directory: ~/repo
1717
steps:
1818
- checkout
19+
- run:
20+
name: Create hash for patches folder contents
21+
command: cat patches/* | md5sum > patches.hash
1922
- restore_cache:
2023
keys:
21-
- v1-dependencies-{{ checksum "yarn.lock" }}
24+
- v1-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "patches.hash" }}
2225
- run:
2326
name: Installing Dependencies
2427
command: yarn install --ignore-engines --frozen-lockfile
2528
- save_cache:
2629
paths:
2730
- node_modules
28-
key: v1-dependencies-{{ checksum "yarn.lock" }}
31+
key: v1-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "patches.hash" }}
2932
- run:
3033
name: Compiling Code
3134
command: yarn build
@@ -56,9 +59,12 @@ jobs:
5659
working_directory: ~/repo
5760
steps:
5861
- checkout
62+
- run:
63+
name: Create hash for patches folder contents
64+
command: cat patches/* | md5sum > patches.hash
5965
- restore_cache:
6066
keys:
61-
- v1-dependencies-{{ checksum "yarn.lock" }}
67+
- v1-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "patches.hash" }}
6268
- restore_cache:
6369
keys:
6470
- dist-{{ .Branch }}-{{ .Revision }}
@@ -90,9 +96,12 @@ jobs:
9096
working_directory: ~/repo
9197
steps:
9298
- checkout
99+
- run:
100+
name: Create hash for patches folder contents
101+
command: cat patches/* | md5sum > patches.hash
93102
- restore_cache:
94103
keys:
95-
- v1-dependencies-{{ checksum "yarn.lock" }}
104+
- v1-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "patches.hash" }}
96105
- restore_cache:
97106
keys:
98107
- dist-{{ .Branch }}-{{ .Revision }}
@@ -132,9 +141,12 @@ jobs:
132141
working_directory: ~/repo
133142
steps:
134143
- checkout
144+
- run:
145+
name: Create hash for patches folder contents
146+
command: cat patches/* | md5sum > patches.hash
135147
- restore_cache:
136148
keys:
137-
- v1-dependencies-{{ checksum "yarn.lock" }}
149+
- v1-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "patches.hash" }}
138150
- restore_cache:
139151
keys:
140152
- dist-{{ .Branch }}-{{ .Revision }}
@@ -171,9 +183,12 @@ jobs:
171183
working_directory: ~/repo
172184
steps:
173185
- checkout
186+
- run:
187+
name: Create hash for patches folder contents
188+
command: cat patches/* | md5sum > patches.hash
174189
- restore_cache:
175190
keys:
176-
- v1-dependencies-{{ checksum "yarn.lock" }}
191+
- v1-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "patches.hash" }}
177192
- restore_cache:
178193
keys:
179194
- dist-{{ .Branch }}-{{ .Revision }}
@@ -201,9 +216,12 @@ jobs:
201216
- setup_remote_docker:
202217
docker_layer_caching: true
203218
version: 19.03.13
219+
- run:
220+
name: Create hash for patches folder contents
221+
command: cat patches/* | md5sum > patches.hash
204222
- restore_cache:
205223
keys:
206-
- v1-dependencies-{{ checksum "yarn.lock" }}
224+
- v1-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "patches.hash" }}
207225
- restore_cache:
208226
keys:
209227
- dist-{{ .Branch }}-{{ .Revision }}

patches/@google-cloud+common+3.6.0.patch

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/node_modules/@google-cloud/common/build/src/util.js b/node_modules/@google-cloud/common/build/src/util.js
2-
index 4860a5d..022210e 100644
2+
index 4860a5d..e910bb3 100644
33
--- a/node_modules/@google-cloud/common/build/src/util.js
44
+++ b/node_modules/@google-cloud/common/build/src/util.js
55
@@ -49,8 +49,12 @@ class ApiError extends Error {
@@ -15,3 +15,27 @@ index 4860a5d..022210e 100644
1515
}
1616
catch (e) {
1717
this.errors = errorBody.errors;
18+
@@ -214,6 +218,7 @@ class Util {
19+
const writeStream = new ProgressStream();
20+
writeStream.on('progress', evt => dup.emit('progress', evt));
21+
dup.setWritable(writeStream);
22+
+ console.log("makeWritableStream: dup setWritable writeStream");
23+
const defaultReqOpts = {
24+
method: 'POST',
25+
qs: {
26+
@@ -238,6 +243,7 @@ class Util {
27+
options.makeAuthenticatedRequest(reqOpts, {
28+
onAuthenticated(err, authenticatedReqOpts) {
29+
if (err) {
30+
+ console.log("makeWritableStream: onAuthenticated error", err);
31+
dup.destroy(err);
32+
return;
33+
}
34+
@@ -245,6 +251,7 @@ class Util {
35+
request(authenticatedReqOpts, (err, resp, body) => {
36+
util.handleResp(err, resp, body, (err, data) => {
37+
if (err) {
38+
+ console.log("makeWritableStream: onAuthenticated handleResponse error", err);
39+
dup.destroy(err);
40+
return;
41+
}

0 commit comments

Comments
 (0)