Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.25.1 - Fix regression in requestResolveHeaders #302

Merged
merged 3 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Notable changes.

## November 2022

### [0.25.1]
samruddhikhandale marked this conversation as resolved.
Show resolved Hide resolved
- Fix regression in https://github.com/devcontainers/cli/pull/298

### [0.25.0]

- `features test`: Respect image label metadata. (https://github.com/devcontainers/cli/pull/288)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@devcontainers/cli",
"description": "Dev Containers CLI",
"version": "0.25.0",
"version": "0.25.1",
"bin": {
"devcontainer": "devcontainer.js"
},
Expand Down
6 changes: 3 additions & 3 deletions src/spec-configuration/containerCollectionsOCIPush.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ async function putManifestWithTags(output: Log, manifestStr: string, ociRef: OCI
data: Buffer.from(manifestStr),
};

let { statusCode, resHeaders } = await requestResolveHeaders(options);
let { statusCode, resHeaders } = await requestResolveHeaders(options, output);

// Retry logic: when request fails with HTTP 429: too many requests
if (statusCode === 429) {
output.write(`Failed to PUT manifest for tag ${tag} due to too many requests. Retrying...`, LogLevel.Warning);
await delay(2000);

let response = await requestResolveHeaders(options);
let response = await requestResolveHeaders(options, output);
statusCode = response.statusCode;
resHeaders = response.resHeaders;
}
Expand Down Expand Up @@ -212,7 +212,7 @@ async function putBlob(output: Log, pathToBlob: string, blobPutLocationUriPath:

output.write(`Crafted blob url: ${url}`, LogLevel.Trace);

const { statusCode } = await requestResolveHeaders({ type: 'PUT', url, headers, data: await readLocalFile(pathToBlob) });
const { statusCode } = await requestResolveHeaders({ type: 'PUT', url, headers, data: await readLocalFile(pathToBlob) }, output);
if (statusCode !== 201) {
output.write(`${statusCode}: Failed to upload blob '${pathToBlob}' to '${url}'`, LogLevel.Error);
return false;
Expand Down
11 changes: 7 additions & 4 deletions src/spec-utils/httpRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,13 @@ export function requestResolveHeaders(options: { type: string; url: string; head
resBody: Buffer.concat(chunks)
});
});
if (options.data) {
req.write(options.data);
}
req.end();
});

if (options.data) {
req.write(options.data);
}

req.on('error', reject);
req.end();
});
}