-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat(core): add support for http based caches #30593
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
View your CI Pipeline Execution ↗ for commit 2a84b29.
☁️ Nx Cloud last updated this comment at |
6c1f51d
to
12992ab
Compare
4ff722d
to
4d6674c
Compare
4d6674c
to
fd735f3
Compare
e2e/nx/src/cache.test.ts
Outdated
@@ -19,7 +22,7 @@ import { join } from 'path'; | |||
describe('cache', () => { | |||
beforeEach(() => newProject({ packages: ['@nx/web', '@nx/js'] })); | |||
|
|||
afterEach(() => cleanupProject()); | |||
// afterEach(() => cleanupProject()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bring this back
e2e/nx/src/cache.test.ts
Outdated
const output = runCLI(`build ${projectName}`, { | ||
env: { | ||
NX_SELF_HOSTED_REMOTE_CACHE_SERVER: 'http://localhost:3000', | ||
NX_NATIVE_LOGGING: 'nx::native::cache::http_remote_cache', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
e2e/nx/src/cache.test.ts
Outdated
@@ -461,6 +513,7 @@ describe('cache', () => { | |||
} | |||
} | |||
}); | |||
console.log(lines); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rm
e2e/nx/src/cache.test.ts
Outdated
cacheServer.kill(); | ||
}); | ||
|
||
it('should request cache from remote cache', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('should request cache from remote cache', async () => { | |
it('should PUT and GET cache from remote cache', async () => { |
code_header.set_cksum(); // Ensure the checksum is set correctly | ||
archive | ||
.append_data(&mut code_header, "code", &code.to_be_bytes()[..]) | ||
.unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would this fail? Should we handle that?
trace!("Reading tarball into memory"); | ||
let archive_bytes = archive.into_inner().unwrap(); | ||
let buffer = archive_bytes.finish()?; | ||
// let mut buffer = Vec::new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
trace!("Finished tarball"); | ||
|
||
trace!("Reading tarball into memory"); | ||
let archive_bytes = archive.into_inner().unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use a ? here?
let archive_bytes = archive.into_inner().unwrap(); | |
let archive_bytes = archive.into_inner()?; |
.body(buffer) // Convert the bytes to a Vec<u8> for the request body | ||
.send() | ||
.await | ||
.map_err(|e| anyhow::anyhow!("Failed to send request: {}", e))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure this logs the error/ reponse body so that people know why the remote cache did not upload.
} else { | ||
let path_on_disk = output_dir.join(entry_path); | ||
trace!("Extracting entry to {}", path_on_disk.display()); | ||
fs::create_dir_all(path_on_disk.parent().unwrap())?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use .expect()
abddbf9
to
5625619
Compare
5625619
to
ee96d07
Compare
{% tabs %} | ||
{% tab title="Nx 20.8+" %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs content looks good, other than the single tab issue.
ee96d07
to
61efdbc
Compare
61efdbc
to
018afd8
Compare
018afd8
to
2a84b29
Compare
Implements http based remote caches per the RFC here: #30548