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

[remerge] A more spec-compliant/resilient OCI distribution implementation #318

Merged
merged 18 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update auth contract change in utils file
  • Loading branch information
joshspicer committed Dec 2, 2022
commit 20d77741209874e2fc92de95f7dfc57e55ffbccd
9 changes: 6 additions & 3 deletions src/spec-configuration/containerCollectionsOCI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export async function getManifest(output: Log, env: NodeJS.ProcessEnv, url: stri

return manifest;
} catch (e) {
output.write(`(!) Failed to fetch manifest: ${e}`, LogLevel.Error);
return undefined;
}
}
Expand All @@ -243,8 +244,7 @@ async function getBasicAuthCredential(output: Log, registry: string, env: NodeJS
return Buffer.from(userToken).toString('base64');
}

// Error
output.write(`No authentication credentials found for registry '${registry}'.`, LogLevel.Error);
output.write(`No authentication credentials found for registry '${registry}'.`, LogLevel.Warning);
return undefined;
}

Expand All @@ -263,7 +263,10 @@ async function generateScopeTokenCredential(output: Log, registry: string, ociRe
basicAuthTokenBase64 = await getBasicAuthCredential(output, registry, env);
}

headers['authorization'] = `Basic ${basicAuthTokenBase64}`;
if (basicAuthTokenBase64) {
headers['authorization'] = `Basic ${basicAuthTokenBase64}`;
}


const authServer = registry === 'docker.io' ? 'auth.docker.io' : registry;
const registryServer = registry === 'docker.io' ? 'registry.docker.io' : registry;
Expand Down
2 changes: 1 addition & 1 deletion src/spec-node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export async function inspectImageInRegistry(output: Log, name: string, authToke
};

if (auth) {
headers['authorization'] = `Bearer ${auth}`;
headers['authorization'] = auth;
}

const options = {
Expand Down