@actions/artifact 1.1.2 → 2.0.1
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/README.md +116 -173
- package/lib/artifact.d.ts +6 -0
- package/lib/artifact.js +23 -0
- package/lib/artifact.js.map +1 -0
- package/lib/generated/google/protobuf/timestamp.d.ts +145 -0
- package/lib/generated/google/protobuf/timestamp.js +136 -0
- package/lib/generated/google/protobuf/timestamp.js.map +1 -0
- package/lib/generated/google/protobuf/wrappers.d.ts +307 -0
- package/lib/generated/google/protobuf/wrappers.js +609 -0
- package/lib/generated/google/protobuf/wrappers.js.map +1 -0
- package/lib/generated/index.d.ts +4 -0
- package/lib/generated/index.js +21 -0
- package/lib/generated/index.js.map +1 -0
- package/lib/generated/results/api/v1/artifact.d.ts +286 -0
- package/lib/generated/results/api/v1/artifact.js +588 -0
- package/lib/generated/results/api/v1/artifact.js.map +1 -0
- package/lib/generated/results/api/v1/artifact.twirp.d.ts +43 -0
- package/lib/generated/results/api/v1/artifact.twirp.js +416 -0
- package/lib/generated/results/api/v1/artifact.twirp.js.map +1 -0
- package/lib/internal/client.d.ts +61 -0
- package/lib/internal/client.js +121 -0
- package/lib/internal/client.js.map +1 -0
- package/lib/internal/download/download-artifact.d.ts +4 -0
- package/lib/internal/download/download-artifact.js +205 -0
- package/lib/internal/download/download-artifact.js.map +1 -0
- package/lib/internal/find/get-artifact.d.ts +3 -0
- package/lib/internal/find/get-artifact.js +118 -0
- package/lib/internal/find/get-artifact.js.map +1 -0
- package/lib/internal/find/list-artifacts.d.ts +3 -0
- package/lib/internal/find/list-artifacts.js +139 -0
- package/lib/internal/find/list-artifacts.js.map +1 -0
- package/lib/internal/find/retry-options.d.ts +7 -0
- package/lib/internal/find/retry-options.js +50 -0
- package/lib/internal/find/retry-options.js.map +1 -0
- package/lib/internal/shared/artifact-twirp-client.d.ts +6 -0
- package/lib/internal/shared/artifact-twirp-client.js +153 -0
- package/lib/internal/shared/artifact-twirp-client.js.map +1 -0
- package/lib/internal/shared/config.d.ts +6 -0
- package/lib/internal/shared/config.js +55 -0
- package/lib/internal/shared/config.js.map +1 -0
- package/lib/internal/shared/errors.d.ts +22 -0
- package/lib/internal/shared/errors.js +70 -0
- package/lib/internal/shared/errors.js.map +1 -0
- package/lib/internal/shared/interfaces.d.ts +136 -0
- package/lib/internal/{contracts.js → shared/interfaces.js} +1 -1
- package/lib/internal/shared/interfaces.js.map +1 -0
- package/lib/internal/shared/user-agent.d.ts +4 -0
- package/lib/internal/shared/user-agent.js +13 -0
- package/lib/internal/shared/user-agent.js.map +1 -0
- package/lib/internal/shared/util.d.ts +5 -0
- package/lib/internal/shared/util.js +81 -0
- package/lib/internal/shared/util.js.map +1 -0
- package/lib/internal/upload/blob-upload.d.ts +12 -0
- package/lib/internal/upload/blob-upload.js +87 -0
- package/lib/internal/upload/blob-upload.js.map +1 -0
- package/lib/internal/upload/path-and-artifact-name-validation.d.ts +8 -0
- package/lib/internal/{path-and-artifact-name-validation.js → upload/path-and-artifact-name-validation.js} +11 -11
- package/lib/internal/upload/path-and-artifact-name-validation.js.map +1 -0
- package/lib/internal/upload/retention.d.ts +2 -0
- package/lib/internal/upload/retention.js +54 -0
- package/lib/internal/upload/retention.js.map +1 -0
- package/lib/internal/upload/upload-artifact.d.ts +2 -0
- package/lib/internal/upload/upload-artifact.js +103 -0
- package/lib/internal/upload/upload-artifact.js.map +1 -0
- package/lib/internal/upload/upload-zip-specification.d.ts +21 -0
- package/lib/internal/{upload-specification.js → upload/upload-zip-specification.js} +44 -36
- package/lib/internal/upload/upload-zip-specification.js.map +1 -0
- package/lib/internal/upload/zip.d.ts +9 -0
- package/lib/internal/upload/zip.js +113 -0
- package/lib/internal/upload/zip.js.map +1 -0
- package/package.json +26 -12
- package/lib/artifact-client.d.ts +0 -10
- package/lib/artifact-client.js +0 -12
- package/lib/artifact-client.js.map +0 -1
- package/lib/internal/artifact-client.d.ts +0 -41
- package/lib/internal/artifact-client.js +0 -182
- package/lib/internal/artifact-client.js.map +0 -1
- package/lib/internal/config-variables.d.ts +0 -12
- package/lib/internal/config-variables.js +0 -77
- package/lib/internal/config-variables.js.map +0 -1
- package/lib/internal/contracts.d.ts +0 -67
- package/lib/internal/contracts.js.map +0 -1
- package/lib/internal/crc64.d.ts +0 -21
- package/lib/internal/crc64.js +0 -303
- package/lib/internal/crc64.js.map +0 -1
- package/lib/internal/download-http-client.d.ts +0 -39
- package/lib/internal/download-http-client.js +0 -296
- package/lib/internal/download-http-client.js.map +0 -1
- package/lib/internal/download-options.d.ts +0 -7
- package/lib/internal/download-options.js +0 -3
- package/lib/internal/download-options.js.map +0 -1
- package/lib/internal/download-response.d.ts +0 -10
- package/lib/internal/download-response.js +0 -3
- package/lib/internal/download-response.js.map +0 -1
- package/lib/internal/download-specification.d.ts +0 -19
- package/lib/internal/download-specification.js +0 -78
- package/lib/internal/download-specification.js.map +0 -1
- package/lib/internal/http-manager.d.ts +0 -12
- package/lib/internal/http-manager.js +0 -32
- package/lib/internal/http-manager.js.map +0 -1
- package/lib/internal/path-and-artifact-name-validation.d.ts +0 -8
- package/lib/internal/path-and-artifact-name-validation.js.map +0 -1
- package/lib/internal/requestUtils.d.ts +0 -3
- package/lib/internal/requestUtils.js +0 -92
- package/lib/internal/requestUtils.js.map +0 -1
- package/lib/internal/status-reporter.d.ts +0 -21
- package/lib/internal/status-reporter.js +0 -52
- package/lib/internal/status-reporter.js.map +0 -1
- package/lib/internal/upload-gzip.d.ts +0 -14
- package/lib/internal/upload-gzip.js +0 -147
- package/lib/internal/upload-gzip.js.map +0 -1
- package/lib/internal/upload-http-client.d.ts +0 -48
- package/lib/internal/upload-http-client.js +0 -415
- package/lib/internal/upload-http-client.js.map +0 -1
- package/lib/internal/upload-options.d.ts +0 -34
- package/lib/internal/upload-options.js +0 -3
- package/lib/internal/upload-options.js.map +0 -1
- package/lib/internal/upload-response.d.ts +0 -19
- package/lib/internal/upload-response.js +0 -3
- package/lib/internal/upload-response.js.map +0 -1
- package/lib/internal/upload-specification.d.ts +0 -11
- package/lib/internal/upload-specification.js.map +0 -1
- package/lib/internal/utils.d.ts +0 -71
- package/lib/internal/utils.js +0 -292
- package/lib/internal/utils.js.map +0 -1
package/lib/internal/crc64.js
DELETED
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* CRC64: cyclic redundancy check, 64-bits
|
|
4
|
-
*
|
|
5
|
-
* In order to validate that artifacts are not being corrupted over the wire, this redundancy check allows us to
|
|
6
|
-
* validate that there was no corruption during transmission. The implementation here is based on Go's hash/crc64 pkg,
|
|
7
|
-
* but without the slicing-by-8 optimization: https://cs.opensource.google/go/go/+/master:src/hash/crc64/crc64.go
|
|
8
|
-
*
|
|
9
|
-
* This implementation uses a pregenerated table based on 0x9A6C9329AC4BC9B5 as the polynomial, the same polynomial that
|
|
10
|
-
* is used for Azure Storage: https://github.com/Azure/azure-storage-net/blob/cbe605f9faa01bfc3003d75fc5a16b2eaccfe102/Lib/Common/Core/Util/Crc64.cs#L27
|
|
11
|
-
*/
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
// when transpile target is >= ES2020 (after dropping node 12) these can be changed to bigint literals - ts(2737)
|
|
14
|
-
const PREGEN_POLY_TABLE = [
|
|
15
|
-
BigInt('0x0000000000000000'),
|
|
16
|
-
BigInt('0x7F6EF0C830358979'),
|
|
17
|
-
BigInt('0xFEDDE190606B12F2'),
|
|
18
|
-
BigInt('0x81B31158505E9B8B'),
|
|
19
|
-
BigInt('0xC962E5739841B68F'),
|
|
20
|
-
BigInt('0xB60C15BBA8743FF6'),
|
|
21
|
-
BigInt('0x37BF04E3F82AA47D'),
|
|
22
|
-
BigInt('0x48D1F42BC81F2D04'),
|
|
23
|
-
BigInt('0xA61CECB46814FE75'),
|
|
24
|
-
BigInt('0xD9721C7C5821770C'),
|
|
25
|
-
BigInt('0x58C10D24087FEC87'),
|
|
26
|
-
BigInt('0x27AFFDEC384A65FE'),
|
|
27
|
-
BigInt('0x6F7E09C7F05548FA'),
|
|
28
|
-
BigInt('0x1010F90FC060C183'),
|
|
29
|
-
BigInt('0x91A3E857903E5A08'),
|
|
30
|
-
BigInt('0xEECD189FA00BD371'),
|
|
31
|
-
BigInt('0x78E0FF3B88BE6F81'),
|
|
32
|
-
BigInt('0x078E0FF3B88BE6F8'),
|
|
33
|
-
BigInt('0x863D1EABE8D57D73'),
|
|
34
|
-
BigInt('0xF953EE63D8E0F40A'),
|
|
35
|
-
BigInt('0xB1821A4810FFD90E'),
|
|
36
|
-
BigInt('0xCEECEA8020CA5077'),
|
|
37
|
-
BigInt('0x4F5FFBD87094CBFC'),
|
|
38
|
-
BigInt('0x30310B1040A14285'),
|
|
39
|
-
BigInt('0xDEFC138FE0AA91F4'),
|
|
40
|
-
BigInt('0xA192E347D09F188D'),
|
|
41
|
-
BigInt('0x2021F21F80C18306'),
|
|
42
|
-
BigInt('0x5F4F02D7B0F40A7F'),
|
|
43
|
-
BigInt('0x179EF6FC78EB277B'),
|
|
44
|
-
BigInt('0x68F0063448DEAE02'),
|
|
45
|
-
BigInt('0xE943176C18803589'),
|
|
46
|
-
BigInt('0x962DE7A428B5BCF0'),
|
|
47
|
-
BigInt('0xF1C1FE77117CDF02'),
|
|
48
|
-
BigInt('0x8EAF0EBF2149567B'),
|
|
49
|
-
BigInt('0x0F1C1FE77117CDF0'),
|
|
50
|
-
BigInt('0x7072EF2F41224489'),
|
|
51
|
-
BigInt('0x38A31B04893D698D'),
|
|
52
|
-
BigInt('0x47CDEBCCB908E0F4'),
|
|
53
|
-
BigInt('0xC67EFA94E9567B7F'),
|
|
54
|
-
BigInt('0xB9100A5CD963F206'),
|
|
55
|
-
BigInt('0x57DD12C379682177'),
|
|
56
|
-
BigInt('0x28B3E20B495DA80E'),
|
|
57
|
-
BigInt('0xA900F35319033385'),
|
|
58
|
-
BigInt('0xD66E039B2936BAFC'),
|
|
59
|
-
BigInt('0x9EBFF7B0E12997F8'),
|
|
60
|
-
BigInt('0xE1D10778D11C1E81'),
|
|
61
|
-
BigInt('0x606216208142850A'),
|
|
62
|
-
BigInt('0x1F0CE6E8B1770C73'),
|
|
63
|
-
BigInt('0x8921014C99C2B083'),
|
|
64
|
-
BigInt('0xF64FF184A9F739FA'),
|
|
65
|
-
BigInt('0x77FCE0DCF9A9A271'),
|
|
66
|
-
BigInt('0x08921014C99C2B08'),
|
|
67
|
-
BigInt('0x4043E43F0183060C'),
|
|
68
|
-
BigInt('0x3F2D14F731B68F75'),
|
|
69
|
-
BigInt('0xBE9E05AF61E814FE'),
|
|
70
|
-
BigInt('0xC1F0F56751DD9D87'),
|
|
71
|
-
BigInt('0x2F3DEDF8F1D64EF6'),
|
|
72
|
-
BigInt('0x50531D30C1E3C78F'),
|
|
73
|
-
BigInt('0xD1E00C6891BD5C04'),
|
|
74
|
-
BigInt('0xAE8EFCA0A188D57D'),
|
|
75
|
-
BigInt('0xE65F088B6997F879'),
|
|
76
|
-
BigInt('0x9931F84359A27100'),
|
|
77
|
-
BigInt('0x1882E91B09FCEA8B'),
|
|
78
|
-
BigInt('0x67EC19D339C963F2'),
|
|
79
|
-
BigInt('0xD75ADABD7A6E2D6F'),
|
|
80
|
-
BigInt('0xA8342A754A5BA416'),
|
|
81
|
-
BigInt('0x29873B2D1A053F9D'),
|
|
82
|
-
BigInt('0x56E9CBE52A30B6E4'),
|
|
83
|
-
BigInt('0x1E383FCEE22F9BE0'),
|
|
84
|
-
BigInt('0x6156CF06D21A1299'),
|
|
85
|
-
BigInt('0xE0E5DE5E82448912'),
|
|
86
|
-
BigInt('0x9F8B2E96B271006B'),
|
|
87
|
-
BigInt('0x71463609127AD31A'),
|
|
88
|
-
BigInt('0x0E28C6C1224F5A63'),
|
|
89
|
-
BigInt('0x8F9BD7997211C1E8'),
|
|
90
|
-
BigInt('0xF0F5275142244891'),
|
|
91
|
-
BigInt('0xB824D37A8A3B6595'),
|
|
92
|
-
BigInt('0xC74A23B2BA0EECEC'),
|
|
93
|
-
BigInt('0x46F932EAEA507767'),
|
|
94
|
-
BigInt('0x3997C222DA65FE1E'),
|
|
95
|
-
BigInt('0xAFBA2586F2D042EE'),
|
|
96
|
-
BigInt('0xD0D4D54EC2E5CB97'),
|
|
97
|
-
BigInt('0x5167C41692BB501C'),
|
|
98
|
-
BigInt('0x2E0934DEA28ED965'),
|
|
99
|
-
BigInt('0x66D8C0F56A91F461'),
|
|
100
|
-
BigInt('0x19B6303D5AA47D18'),
|
|
101
|
-
BigInt('0x980521650AFAE693'),
|
|
102
|
-
BigInt('0xE76BD1AD3ACF6FEA'),
|
|
103
|
-
BigInt('0x09A6C9329AC4BC9B'),
|
|
104
|
-
BigInt('0x76C839FAAAF135E2'),
|
|
105
|
-
BigInt('0xF77B28A2FAAFAE69'),
|
|
106
|
-
BigInt('0x8815D86ACA9A2710'),
|
|
107
|
-
BigInt('0xC0C42C4102850A14'),
|
|
108
|
-
BigInt('0xBFAADC8932B0836D'),
|
|
109
|
-
BigInt('0x3E19CDD162EE18E6'),
|
|
110
|
-
BigInt('0x41773D1952DB919F'),
|
|
111
|
-
BigInt('0x269B24CA6B12F26D'),
|
|
112
|
-
BigInt('0x59F5D4025B277B14'),
|
|
113
|
-
BigInt('0xD846C55A0B79E09F'),
|
|
114
|
-
BigInt('0xA72835923B4C69E6'),
|
|
115
|
-
BigInt('0xEFF9C1B9F35344E2'),
|
|
116
|
-
BigInt('0x90973171C366CD9B'),
|
|
117
|
-
BigInt('0x1124202993385610'),
|
|
118
|
-
BigInt('0x6E4AD0E1A30DDF69'),
|
|
119
|
-
BigInt('0x8087C87E03060C18'),
|
|
120
|
-
BigInt('0xFFE938B633338561'),
|
|
121
|
-
BigInt('0x7E5A29EE636D1EEA'),
|
|
122
|
-
BigInt('0x0134D92653589793'),
|
|
123
|
-
BigInt('0x49E52D0D9B47BA97'),
|
|
124
|
-
BigInt('0x368BDDC5AB7233EE'),
|
|
125
|
-
BigInt('0xB738CC9DFB2CA865'),
|
|
126
|
-
BigInt('0xC8563C55CB19211C'),
|
|
127
|
-
BigInt('0x5E7BDBF1E3AC9DEC'),
|
|
128
|
-
BigInt('0x21152B39D3991495'),
|
|
129
|
-
BigInt('0xA0A63A6183C78F1E'),
|
|
130
|
-
BigInt('0xDFC8CAA9B3F20667'),
|
|
131
|
-
BigInt('0x97193E827BED2B63'),
|
|
132
|
-
BigInt('0xE877CE4A4BD8A21A'),
|
|
133
|
-
BigInt('0x69C4DF121B863991'),
|
|
134
|
-
BigInt('0x16AA2FDA2BB3B0E8'),
|
|
135
|
-
BigInt('0xF86737458BB86399'),
|
|
136
|
-
BigInt('0x8709C78DBB8DEAE0'),
|
|
137
|
-
BigInt('0x06BAD6D5EBD3716B'),
|
|
138
|
-
BigInt('0x79D4261DDBE6F812'),
|
|
139
|
-
BigInt('0x3105D23613F9D516'),
|
|
140
|
-
BigInt('0x4E6B22FE23CC5C6F'),
|
|
141
|
-
BigInt('0xCFD833A67392C7E4'),
|
|
142
|
-
BigInt('0xB0B6C36E43A74E9D'),
|
|
143
|
-
BigInt('0x9A6C9329AC4BC9B5'),
|
|
144
|
-
BigInt('0xE50263E19C7E40CC'),
|
|
145
|
-
BigInt('0x64B172B9CC20DB47'),
|
|
146
|
-
BigInt('0x1BDF8271FC15523E'),
|
|
147
|
-
BigInt('0x530E765A340A7F3A'),
|
|
148
|
-
BigInt('0x2C608692043FF643'),
|
|
149
|
-
BigInt('0xADD397CA54616DC8'),
|
|
150
|
-
BigInt('0xD2BD67026454E4B1'),
|
|
151
|
-
BigInt('0x3C707F9DC45F37C0'),
|
|
152
|
-
BigInt('0x431E8F55F46ABEB9'),
|
|
153
|
-
BigInt('0xC2AD9E0DA4342532'),
|
|
154
|
-
BigInt('0xBDC36EC59401AC4B'),
|
|
155
|
-
BigInt('0xF5129AEE5C1E814F'),
|
|
156
|
-
BigInt('0x8A7C6A266C2B0836'),
|
|
157
|
-
BigInt('0x0BCF7B7E3C7593BD'),
|
|
158
|
-
BigInt('0x74A18BB60C401AC4'),
|
|
159
|
-
BigInt('0xE28C6C1224F5A634'),
|
|
160
|
-
BigInt('0x9DE29CDA14C02F4D'),
|
|
161
|
-
BigInt('0x1C518D82449EB4C6'),
|
|
162
|
-
BigInt('0x633F7D4A74AB3DBF'),
|
|
163
|
-
BigInt('0x2BEE8961BCB410BB'),
|
|
164
|
-
BigInt('0x548079A98C8199C2'),
|
|
165
|
-
BigInt('0xD53368F1DCDF0249'),
|
|
166
|
-
BigInt('0xAA5D9839ECEA8B30'),
|
|
167
|
-
BigInt('0x449080A64CE15841'),
|
|
168
|
-
BigInt('0x3BFE706E7CD4D138'),
|
|
169
|
-
BigInt('0xBA4D61362C8A4AB3'),
|
|
170
|
-
BigInt('0xC52391FE1CBFC3CA'),
|
|
171
|
-
BigInt('0x8DF265D5D4A0EECE'),
|
|
172
|
-
BigInt('0xF29C951DE49567B7'),
|
|
173
|
-
BigInt('0x732F8445B4CBFC3C'),
|
|
174
|
-
BigInt('0x0C41748D84FE7545'),
|
|
175
|
-
BigInt('0x6BAD6D5EBD3716B7'),
|
|
176
|
-
BigInt('0x14C39D968D029FCE'),
|
|
177
|
-
BigInt('0x95708CCEDD5C0445'),
|
|
178
|
-
BigInt('0xEA1E7C06ED698D3C'),
|
|
179
|
-
BigInt('0xA2CF882D2576A038'),
|
|
180
|
-
BigInt('0xDDA178E515432941'),
|
|
181
|
-
BigInt('0x5C1269BD451DB2CA'),
|
|
182
|
-
BigInt('0x237C997575283BB3'),
|
|
183
|
-
BigInt('0xCDB181EAD523E8C2'),
|
|
184
|
-
BigInt('0xB2DF7122E51661BB'),
|
|
185
|
-
BigInt('0x336C607AB548FA30'),
|
|
186
|
-
BigInt('0x4C0290B2857D7349'),
|
|
187
|
-
BigInt('0x04D364994D625E4D'),
|
|
188
|
-
BigInt('0x7BBD94517D57D734'),
|
|
189
|
-
BigInt('0xFA0E85092D094CBF'),
|
|
190
|
-
BigInt('0x856075C11D3CC5C6'),
|
|
191
|
-
BigInt('0x134D926535897936'),
|
|
192
|
-
BigInt('0x6C2362AD05BCF04F'),
|
|
193
|
-
BigInt('0xED9073F555E26BC4'),
|
|
194
|
-
BigInt('0x92FE833D65D7E2BD'),
|
|
195
|
-
BigInt('0xDA2F7716ADC8CFB9'),
|
|
196
|
-
BigInt('0xA54187DE9DFD46C0'),
|
|
197
|
-
BigInt('0x24F29686CDA3DD4B'),
|
|
198
|
-
BigInt('0x5B9C664EFD965432'),
|
|
199
|
-
BigInt('0xB5517ED15D9D8743'),
|
|
200
|
-
BigInt('0xCA3F8E196DA80E3A'),
|
|
201
|
-
BigInt('0x4B8C9F413DF695B1'),
|
|
202
|
-
BigInt('0x34E26F890DC31CC8'),
|
|
203
|
-
BigInt('0x7C339BA2C5DC31CC'),
|
|
204
|
-
BigInt('0x035D6B6AF5E9B8B5'),
|
|
205
|
-
BigInt('0x82EE7A32A5B7233E'),
|
|
206
|
-
BigInt('0xFD808AFA9582AA47'),
|
|
207
|
-
BigInt('0x4D364994D625E4DA'),
|
|
208
|
-
BigInt('0x3258B95CE6106DA3'),
|
|
209
|
-
BigInt('0xB3EBA804B64EF628'),
|
|
210
|
-
BigInt('0xCC8558CC867B7F51'),
|
|
211
|
-
BigInt('0x8454ACE74E645255'),
|
|
212
|
-
BigInt('0xFB3A5C2F7E51DB2C'),
|
|
213
|
-
BigInt('0x7A894D772E0F40A7'),
|
|
214
|
-
BigInt('0x05E7BDBF1E3AC9DE'),
|
|
215
|
-
BigInt('0xEB2AA520BE311AAF'),
|
|
216
|
-
BigInt('0x944455E88E0493D6'),
|
|
217
|
-
BigInt('0x15F744B0DE5A085D'),
|
|
218
|
-
BigInt('0x6A99B478EE6F8124'),
|
|
219
|
-
BigInt('0x224840532670AC20'),
|
|
220
|
-
BigInt('0x5D26B09B16452559'),
|
|
221
|
-
BigInt('0xDC95A1C3461BBED2'),
|
|
222
|
-
BigInt('0xA3FB510B762E37AB'),
|
|
223
|
-
BigInt('0x35D6B6AF5E9B8B5B'),
|
|
224
|
-
BigInt('0x4AB846676EAE0222'),
|
|
225
|
-
BigInt('0xCB0B573F3EF099A9'),
|
|
226
|
-
BigInt('0xB465A7F70EC510D0'),
|
|
227
|
-
BigInt('0xFCB453DCC6DA3DD4'),
|
|
228
|
-
BigInt('0x83DAA314F6EFB4AD'),
|
|
229
|
-
BigInt('0x0269B24CA6B12F26'),
|
|
230
|
-
BigInt('0x7D0742849684A65F'),
|
|
231
|
-
BigInt('0x93CA5A1B368F752E'),
|
|
232
|
-
BigInt('0xECA4AAD306BAFC57'),
|
|
233
|
-
BigInt('0x6D17BB8B56E467DC'),
|
|
234
|
-
BigInt('0x12794B4366D1EEA5'),
|
|
235
|
-
BigInt('0x5AA8BF68AECEC3A1'),
|
|
236
|
-
BigInt('0x25C64FA09EFB4AD8'),
|
|
237
|
-
BigInt('0xA4755EF8CEA5D153'),
|
|
238
|
-
BigInt('0xDB1BAE30FE90582A'),
|
|
239
|
-
BigInt('0xBCF7B7E3C7593BD8'),
|
|
240
|
-
BigInt('0xC399472BF76CB2A1'),
|
|
241
|
-
BigInt('0x422A5673A732292A'),
|
|
242
|
-
BigInt('0x3D44A6BB9707A053'),
|
|
243
|
-
BigInt('0x759552905F188D57'),
|
|
244
|
-
BigInt('0x0AFBA2586F2D042E'),
|
|
245
|
-
BigInt('0x8B48B3003F739FA5'),
|
|
246
|
-
BigInt('0xF42643C80F4616DC'),
|
|
247
|
-
BigInt('0x1AEB5B57AF4DC5AD'),
|
|
248
|
-
BigInt('0x6585AB9F9F784CD4'),
|
|
249
|
-
BigInt('0xE436BAC7CF26D75F'),
|
|
250
|
-
BigInt('0x9B584A0FFF135E26'),
|
|
251
|
-
BigInt('0xD389BE24370C7322'),
|
|
252
|
-
BigInt('0xACE74EEC0739FA5B'),
|
|
253
|
-
BigInt('0x2D545FB4576761D0'),
|
|
254
|
-
BigInt('0x523AAF7C6752E8A9'),
|
|
255
|
-
BigInt('0xC41748D84FE75459'),
|
|
256
|
-
BigInt('0xBB79B8107FD2DD20'),
|
|
257
|
-
BigInt('0x3ACAA9482F8C46AB'),
|
|
258
|
-
BigInt('0x45A459801FB9CFD2'),
|
|
259
|
-
BigInt('0x0D75ADABD7A6E2D6'),
|
|
260
|
-
BigInt('0x721B5D63E7936BAF'),
|
|
261
|
-
BigInt('0xF3A84C3BB7CDF024'),
|
|
262
|
-
BigInt('0x8CC6BCF387F8795D'),
|
|
263
|
-
BigInt('0x620BA46C27F3AA2C'),
|
|
264
|
-
BigInt('0x1D6554A417C62355'),
|
|
265
|
-
BigInt('0x9CD645FC4798B8DE'),
|
|
266
|
-
BigInt('0xE3B8B53477AD31A7'),
|
|
267
|
-
BigInt('0xAB69411FBFB21CA3'),
|
|
268
|
-
BigInt('0xD407B1D78F8795DA'),
|
|
269
|
-
BigInt('0x55B4A08FDFD90E51'),
|
|
270
|
-
BigInt('0x2ADA5047EFEC8728')
|
|
271
|
-
];
|
|
272
|
-
class CRC64 {
|
|
273
|
-
constructor() {
|
|
274
|
-
this._crc = BigInt(0);
|
|
275
|
-
}
|
|
276
|
-
update(data) {
|
|
277
|
-
const buffer = typeof data === 'string' ? Buffer.from(data) : data;
|
|
278
|
-
let crc = CRC64.flip64Bits(this._crc);
|
|
279
|
-
for (const dataByte of buffer) {
|
|
280
|
-
const crcByte = Number(crc & BigInt(0xff));
|
|
281
|
-
crc = PREGEN_POLY_TABLE[crcByte ^ dataByte] ^ (crc >> BigInt(8));
|
|
282
|
-
}
|
|
283
|
-
this._crc = CRC64.flip64Bits(crc);
|
|
284
|
-
}
|
|
285
|
-
digest(encoding) {
|
|
286
|
-
switch (encoding) {
|
|
287
|
-
case 'hex':
|
|
288
|
-
return this._crc.toString(16).toUpperCase();
|
|
289
|
-
case 'base64':
|
|
290
|
-
return this.toBuffer().toString('base64');
|
|
291
|
-
default:
|
|
292
|
-
return this.toBuffer();
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
toBuffer() {
|
|
296
|
-
return Buffer.from([0, 8, 16, 24, 32, 40, 48, 56].map(s => Number((this._crc >> BigInt(s)) & BigInt(0xff))));
|
|
297
|
-
}
|
|
298
|
-
static flip64Bits(n) {
|
|
299
|
-
return (BigInt(1) << BigInt(64)) - BigInt(1) - n;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
exports.default = CRC64;
|
|
303
|
-
//# sourceMappingURL=crc64.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crc64.js","sourceRoot":"","sources":["../../src/internal/crc64.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAEH,iHAAiH;AACjH,MAAM,iBAAiB,GAAG;IACxB,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAA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C,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;YAC3C;gBACE,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAA;SACzB;IACH,CAAC;IAEO,QAAQ;QACd,OAAO,MAAM,CAAC,IAAI,CAChB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CACrC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAChD,CACF,CAAA;IACH,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,CAAS;QACzB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;IAClD,CAAC;CACF;AAED,kBAAe,KAAK,CAAA"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import { ListArtifactsResponse, QueryArtifactResponse } from './contracts';
|
|
4
|
-
import { HttpClientResponse } from '@actions/http-client';
|
|
5
|
-
import { DownloadItem } from './download-specification';
|
|
6
|
-
export declare class DownloadHttpClient {
|
|
7
|
-
private downloadHttpManager;
|
|
8
|
-
private statusReporter;
|
|
9
|
-
constructor();
|
|
10
|
-
/**
|
|
11
|
-
* Gets a list of all artifacts that are in a specific container
|
|
12
|
-
*/
|
|
13
|
-
listArtifacts(): Promise<ListArtifactsResponse>;
|
|
14
|
-
/**
|
|
15
|
-
* Fetches a set of container items that describe the contents of an artifact
|
|
16
|
-
* @param artifactName the name of the artifact
|
|
17
|
-
* @param containerUrl the artifact container URL for the run
|
|
18
|
-
*/
|
|
19
|
-
getContainerItems(artifactName: string, containerUrl: string): Promise<QueryArtifactResponse>;
|
|
20
|
-
/**
|
|
21
|
-
* Concurrently downloads all the files that are part of an artifact
|
|
22
|
-
* @param downloadItems information about what items to download and where to save them
|
|
23
|
-
*/
|
|
24
|
-
downloadSingleArtifact(downloadItems: DownloadItem[]): Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* Downloads an individual file
|
|
27
|
-
* @param httpClientIndex the index of the http client that is used to make all of the calls
|
|
28
|
-
* @param artifactLocation origin location where a file will be downloaded from
|
|
29
|
-
* @param downloadPath destination location for the file being downloaded
|
|
30
|
-
*/
|
|
31
|
-
private downloadIndividualFile;
|
|
32
|
-
/**
|
|
33
|
-
* Pipes the response from downloading an individual file to the appropriate destination stream while decoding gzip content if necessary
|
|
34
|
-
* @param response the http response received when downloading a file
|
|
35
|
-
* @param destinationStream the stream where the file should be written to
|
|
36
|
-
* @param isGzip a boolean denoting if the content is compressed using gzip and if we need to decode it
|
|
37
|
-
*/
|
|
38
|
-
pipeResponseToFile(response: HttpClientResponse, destinationStream: fs.WriteStream, isGzip: boolean): Promise<void>;
|
|
39
|
-
}
|
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.DownloadHttpClient = void 0;
|
|
36
|
-
const fs = __importStar(require("fs"));
|
|
37
|
-
const core = __importStar(require("@actions/core"));
|
|
38
|
-
const zlib = __importStar(require("zlib"));
|
|
39
|
-
const utils_1 = require("./utils");
|
|
40
|
-
const url_1 = require("url");
|
|
41
|
-
const status_reporter_1 = require("./status-reporter");
|
|
42
|
-
const perf_hooks_1 = require("perf_hooks");
|
|
43
|
-
const http_manager_1 = require("./http-manager");
|
|
44
|
-
const config_variables_1 = require("./config-variables");
|
|
45
|
-
const requestUtils_1 = require("./requestUtils");
|
|
46
|
-
class DownloadHttpClient {
|
|
47
|
-
constructor() {
|
|
48
|
-
this.downloadHttpManager = new http_manager_1.HttpManager((0, config_variables_1.getDownloadFileConcurrency)(), '@actions/artifact-download');
|
|
49
|
-
// downloads are usually significantly faster than uploads so display status information every second
|
|
50
|
-
this.statusReporter = new status_reporter_1.StatusReporter(1000);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Gets a list of all artifacts that are in a specific container
|
|
54
|
-
*/
|
|
55
|
-
listArtifacts() {
|
|
56
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
const artifactUrl = (0, utils_1.getArtifactUrl)();
|
|
58
|
-
// use the first client from the httpManager, `keep-alive` is not used so the connection will close immediately
|
|
59
|
-
const client = this.downloadHttpManager.getClient(0);
|
|
60
|
-
const headers = (0, utils_1.getDownloadHeaders)('application/json');
|
|
61
|
-
const response = yield (0, requestUtils_1.retryHttpClientRequest)('List Artifacts', () => __awaiter(this, void 0, void 0, function* () { return client.get(artifactUrl, headers); }));
|
|
62
|
-
const body = yield response.readBody();
|
|
63
|
-
return JSON.parse(body);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Fetches a set of container items that describe the contents of an artifact
|
|
68
|
-
* @param artifactName the name of the artifact
|
|
69
|
-
* @param containerUrl the artifact container URL for the run
|
|
70
|
-
*/
|
|
71
|
-
getContainerItems(artifactName, containerUrl) {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
// the itemPath search parameter controls which containers will be returned
|
|
74
|
-
const resourceUrl = new url_1.URL(containerUrl);
|
|
75
|
-
resourceUrl.searchParams.append('itemPath', artifactName);
|
|
76
|
-
// use the first client from the httpManager, `keep-alive` is not used so the connection will close immediately
|
|
77
|
-
const client = this.downloadHttpManager.getClient(0);
|
|
78
|
-
const headers = (0, utils_1.getDownloadHeaders)('application/json');
|
|
79
|
-
const response = yield (0, requestUtils_1.retryHttpClientRequest)('Get Container Items', () => __awaiter(this, void 0, void 0, function* () { return client.get(resourceUrl.toString(), headers); }));
|
|
80
|
-
const body = yield response.readBody();
|
|
81
|
-
return JSON.parse(body);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Concurrently downloads all the files that are part of an artifact
|
|
86
|
-
* @param downloadItems information about what items to download and where to save them
|
|
87
|
-
*/
|
|
88
|
-
downloadSingleArtifact(downloadItems) {
|
|
89
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
const DOWNLOAD_CONCURRENCY = (0, config_variables_1.getDownloadFileConcurrency)();
|
|
91
|
-
// limit the number of files downloaded at a single time
|
|
92
|
-
core.debug(`Download file concurrency is set to ${DOWNLOAD_CONCURRENCY}`);
|
|
93
|
-
const parallelDownloads = [...new Array(DOWNLOAD_CONCURRENCY).keys()];
|
|
94
|
-
let currentFile = 0;
|
|
95
|
-
let downloadedFiles = 0;
|
|
96
|
-
core.info(`Total number of files that will be downloaded: ${downloadItems.length}`);
|
|
97
|
-
this.statusReporter.setTotalNumberOfFilesToProcess(downloadItems.length);
|
|
98
|
-
this.statusReporter.start();
|
|
99
|
-
yield Promise.all(parallelDownloads.map((index) => __awaiter(this, void 0, void 0, function* () {
|
|
100
|
-
while (currentFile < downloadItems.length) {
|
|
101
|
-
const currentFileToDownload = downloadItems[currentFile];
|
|
102
|
-
currentFile += 1;
|
|
103
|
-
const startTime = perf_hooks_1.performance.now();
|
|
104
|
-
yield this.downloadIndividualFile(index, currentFileToDownload.sourceLocation, currentFileToDownload.targetPath);
|
|
105
|
-
if (core.isDebug()) {
|
|
106
|
-
core.debug(`File: ${++downloadedFiles}/${downloadItems.length}. ${currentFileToDownload.targetPath} took ${(perf_hooks_1.performance.now() - startTime).toFixed(3)} milliseconds to finish downloading`);
|
|
107
|
-
}
|
|
108
|
-
this.statusReporter.incrementProcessedCount();
|
|
109
|
-
}
|
|
110
|
-
})))
|
|
111
|
-
.catch(error => {
|
|
112
|
-
throw new Error(`Unable to download the artifact: ${error}`);
|
|
113
|
-
})
|
|
114
|
-
.finally(() => {
|
|
115
|
-
this.statusReporter.stop();
|
|
116
|
-
// safety dispose all connections
|
|
117
|
-
this.downloadHttpManager.disposeAndReplaceAllClients();
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Downloads an individual file
|
|
123
|
-
* @param httpClientIndex the index of the http client that is used to make all of the calls
|
|
124
|
-
* @param artifactLocation origin location where a file will be downloaded from
|
|
125
|
-
* @param downloadPath destination location for the file being downloaded
|
|
126
|
-
*/
|
|
127
|
-
downloadIndividualFile(httpClientIndex, artifactLocation, downloadPath) {
|
|
128
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
-
let retryCount = 0;
|
|
130
|
-
const retryLimit = (0, config_variables_1.getRetryLimit)();
|
|
131
|
-
let destinationStream = fs.createWriteStream(downloadPath);
|
|
132
|
-
const headers = (0, utils_1.getDownloadHeaders)('application/json', true, true);
|
|
133
|
-
// a single GET request is used to download a file
|
|
134
|
-
const makeDownloadRequest = () => __awaiter(this, void 0, void 0, function* () {
|
|
135
|
-
const client = this.downloadHttpManager.getClient(httpClientIndex);
|
|
136
|
-
return yield client.get(artifactLocation, headers);
|
|
137
|
-
});
|
|
138
|
-
// check the response headers to determine if the file was compressed using gzip
|
|
139
|
-
const isGzip = (incomingHeaders) => {
|
|
140
|
-
return ('content-encoding' in incomingHeaders &&
|
|
141
|
-
incomingHeaders['content-encoding'] === 'gzip');
|
|
142
|
-
};
|
|
143
|
-
// Increments the current retry count and then checks if the retry limit has been reached
|
|
144
|
-
// If there have been too many retries, fail so the download stops. If there is a retryAfterValue value provided,
|
|
145
|
-
// it will be used
|
|
146
|
-
const backOff = (retryAfterValue) => __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
retryCount++;
|
|
148
|
-
if (retryCount > retryLimit) {
|
|
149
|
-
return Promise.reject(new Error(`Retry limit has been reached. Unable to download ${artifactLocation}`));
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
this.downloadHttpManager.disposeAndReplaceClient(httpClientIndex);
|
|
153
|
-
if (retryAfterValue) {
|
|
154
|
-
// Back off by waiting the specified time denoted by the retry-after header
|
|
155
|
-
core.info(`Backoff due to too many requests, retry #${retryCount}. Waiting for ${retryAfterValue} milliseconds before continuing the download`);
|
|
156
|
-
yield (0, utils_1.sleep)(retryAfterValue);
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
// Back off using an exponential value that depends on the retry count
|
|
160
|
-
const backoffTime = (0, utils_1.getExponentialRetryTimeInMilliseconds)(retryCount);
|
|
161
|
-
core.info(`Exponential backoff for retry #${retryCount}. Waiting for ${backoffTime} milliseconds before continuing the download`);
|
|
162
|
-
yield (0, utils_1.sleep)(backoffTime);
|
|
163
|
-
}
|
|
164
|
-
core.info(`Finished backoff for retry #${retryCount}, continuing with download`);
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
const isAllBytesReceived = (expected, received) => {
|
|
168
|
-
// be lenient, if any input is missing, assume success, i.e. not truncated
|
|
169
|
-
if (!expected ||
|
|
170
|
-
!received ||
|
|
171
|
-
process.env['ACTIONS_ARTIFACT_SKIP_DOWNLOAD_VALIDATION']) {
|
|
172
|
-
core.info('Skipping download validation.');
|
|
173
|
-
return true;
|
|
174
|
-
}
|
|
175
|
-
return parseInt(expected) === received;
|
|
176
|
-
};
|
|
177
|
-
const resetDestinationStream = (fileDownloadPath) => __awaiter(this, void 0, void 0, function* () {
|
|
178
|
-
destinationStream.close();
|
|
179
|
-
// await until file is created at downloadpath; node15 and up fs.createWriteStream had not created a file yet
|
|
180
|
-
yield new Promise(resolve => {
|
|
181
|
-
destinationStream.on('close', resolve);
|
|
182
|
-
if (destinationStream.writableFinished) {
|
|
183
|
-
resolve();
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
yield (0, utils_1.rmFile)(fileDownloadPath);
|
|
187
|
-
destinationStream = fs.createWriteStream(fileDownloadPath);
|
|
188
|
-
});
|
|
189
|
-
// keep trying to download a file until a retry limit has been reached
|
|
190
|
-
while (retryCount <= retryLimit) {
|
|
191
|
-
let response;
|
|
192
|
-
try {
|
|
193
|
-
response = yield makeDownloadRequest();
|
|
194
|
-
}
|
|
195
|
-
catch (error) {
|
|
196
|
-
// if an error is caught, it is usually indicative of a timeout so retry the download
|
|
197
|
-
core.info('An error occurred while attempting to download a file');
|
|
198
|
-
// eslint-disable-next-line no-console
|
|
199
|
-
console.log(error);
|
|
200
|
-
// increment the retryCount and use exponential backoff to wait before making the next request
|
|
201
|
-
yield backOff();
|
|
202
|
-
continue;
|
|
203
|
-
}
|
|
204
|
-
let forceRetry = false;
|
|
205
|
-
if ((0, utils_1.isSuccessStatusCode)(response.message.statusCode)) {
|
|
206
|
-
// The body contains the contents of the file however calling response.readBody() causes all the content to be converted to a string
|
|
207
|
-
// which can cause some gzip encoded data to be lost
|
|
208
|
-
// Instead of using response.readBody(), response.message is a readableStream that can be directly used to get the raw body contents
|
|
209
|
-
try {
|
|
210
|
-
const isGzipped = isGzip(response.message.headers);
|
|
211
|
-
yield this.pipeResponseToFile(response, destinationStream, isGzipped);
|
|
212
|
-
if (isGzipped ||
|
|
213
|
-
isAllBytesReceived(response.message.headers['content-length'], yield (0, utils_1.getFileSize)(downloadPath))) {
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
forceRetry = true;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
catch (error) {
|
|
221
|
-
// retry on error, most likely streams were corrupted
|
|
222
|
-
forceRetry = true;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
if (forceRetry || (0, utils_1.isRetryableStatusCode)(response.message.statusCode)) {
|
|
226
|
-
core.info(`A ${response.message.statusCode} response code has been received while attempting to download an artifact`);
|
|
227
|
-
resetDestinationStream(downloadPath);
|
|
228
|
-
// if a throttled status code is received, try to get the retryAfter header value, else differ to standard exponential backoff
|
|
229
|
-
(0, utils_1.isThrottledStatusCode)(response.message.statusCode)
|
|
230
|
-
? yield backOff((0, utils_1.tryGetRetryAfterValueTimeInMilliseconds)(response.message.headers))
|
|
231
|
-
: yield backOff();
|
|
232
|
-
}
|
|
233
|
-
else {
|
|
234
|
-
// Some unexpected response code, fail immediately and stop the download
|
|
235
|
-
(0, utils_1.displayHttpDiagnostics)(response);
|
|
236
|
-
return Promise.reject(new Error(`Unexpected http ${response.message.statusCode} during download for ${artifactLocation}`));
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Pipes the response from downloading an individual file to the appropriate destination stream while decoding gzip content if necessary
|
|
243
|
-
* @param response the http response received when downloading a file
|
|
244
|
-
* @param destinationStream the stream where the file should be written to
|
|
245
|
-
* @param isGzip a boolean denoting if the content is compressed using gzip and if we need to decode it
|
|
246
|
-
*/
|
|
247
|
-
pipeResponseToFile(response, destinationStream, isGzip) {
|
|
248
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
249
|
-
yield new Promise((resolve, reject) => {
|
|
250
|
-
if (isGzip) {
|
|
251
|
-
const gunzip = zlib.createGunzip();
|
|
252
|
-
response.message
|
|
253
|
-
.on('error', error => {
|
|
254
|
-
core.info(`An error occurred while attempting to read the response stream`);
|
|
255
|
-
gunzip.close();
|
|
256
|
-
destinationStream.close();
|
|
257
|
-
reject(error);
|
|
258
|
-
})
|
|
259
|
-
.pipe(gunzip)
|
|
260
|
-
.on('error', error => {
|
|
261
|
-
core.info(`An error occurred while attempting to decompress the response stream`);
|
|
262
|
-
destinationStream.close();
|
|
263
|
-
reject(error);
|
|
264
|
-
})
|
|
265
|
-
.pipe(destinationStream)
|
|
266
|
-
.on('close', () => {
|
|
267
|
-
resolve();
|
|
268
|
-
})
|
|
269
|
-
.on('error', error => {
|
|
270
|
-
core.info(`An error occurred while writing a downloaded file to ${destinationStream.path}`);
|
|
271
|
-
reject(error);
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
else {
|
|
275
|
-
response.message
|
|
276
|
-
.on('error', error => {
|
|
277
|
-
core.info(`An error occurred while attempting to read the response stream`);
|
|
278
|
-
destinationStream.close();
|
|
279
|
-
reject(error);
|
|
280
|
-
})
|
|
281
|
-
.pipe(destinationStream)
|
|
282
|
-
.on('close', () => {
|
|
283
|
-
resolve();
|
|
284
|
-
})
|
|
285
|
-
.on('error', error => {
|
|
286
|
-
core.info(`An error occurred while writing a downloaded file to ${destinationStream.path}`);
|
|
287
|
-
reject(error);
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
return;
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
exports.DownloadHttpClient = DownloadHttpClient;
|
|
296
|
-
//# sourceMappingURL=download-http-client.js.map
|