add ruby3 to path during build (#11094)

Add ruby to the path plus some debug code. I'll remove the debug code
after we verify this works.
This commit is contained in:
Sean Massa
2024-01-25 14:16:53 -06:00
committed by GitHub
parent 1f259d5eb9
commit 322c88536d
4 changed files with 23 additions and 7 deletions

View File

@@ -0,0 +1,5 @@
---
"@vercel/ruby": patch
---
add ruby3 to path during build

View File

@@ -857,7 +857,7 @@ test('deploy pnpm twice using pnp and symlink=false', async () => {
page = await fetch(stdout); page = await fetch(stdout);
text = await page.text(); text = await page.text();
expect(text).toBe('cache exists\n'); expect(text).toContain('cache exists\n');
}); });
test('reject deploying with wrong team .vercel config', async () => { test('reject deploying with wrong team .vercel config', async () => {

View File

@@ -48,6 +48,7 @@ async function bundleInstall(
bundlePath: string, bundlePath: string,
bundleDir: string, bundleDir: string,
gemfilePath: string, gemfilePath: string,
rubyPath: string,
runtime: string runtime: string
) { ) {
debug(`running "bundle install --deployment"...`); debug(`running "bundle install --deployment"...`);
@@ -76,7 +77,7 @@ async function bundleInstall(
const bundlerEnv = cloneEnv(process.env, { const bundlerEnv = cloneEnv(process.env, {
// Ensure the correct version of `ruby` is in front of the $PATH // Ensure the correct version of `ruby` is in front of the $PATH
PATH: `${dirname(bundlePath)}:${process.env.PATH}`, PATH: `${dirname(rubyPath)}:${dirname(bundlePath)}:${process.env.PATH}`,
BUNDLE_SILENCE_ROOT_WARNING: '1', BUNDLE_SILENCE_ROOT_WARNING: '1',
BUNDLE_APP_CONFIG: bundleAppConfig, BUNDLE_APP_CONFIG: bundleAppConfig,
BUNDLE_JOBS: '4', BUNDLE_JOBS: '4',
@@ -142,10 +143,8 @@ export const build: BuildV3 = async ({
const gemfileContents = gemfilePath const gemfileContents = gemfilePath
? await readFile(gemfilePath, 'utf8') ? await readFile(gemfilePath, 'utf8')
: ''; : '';
const { gemHome, bundlerPath, vendorPath, runtime } = await installBundler( const { gemHome, bundlerPath, vendorPath, runtime, rubyPath } =
meta, await installBundler(meta, gemfileContents);
gemfileContents
);
process.env.GEM_HOME = gemHome; process.env.GEM_HOME = gemHome;
debug(`Checking existing vendor directory at "${vendorPath}"`); debug(`Checking existing vendor directory at "${vendorPath}"`);
const vendorDir = join(workPath, vendorPath); const vendorDir = join(workPath, vendorPath);
@@ -189,7 +188,13 @@ export const build: BuildV3 = async ({
} else { } else {
// try installing. this won't work if native extesions are required. // try installing. this won't work if native extesions are required.
// if that's the case, gems should be vendored locally before deploying. // if that's the case, gems should be vendored locally before deploying.
await bundleInstall(bundlerPath, bundleDir, gemfilePath, runtime); await bundleInstall(
bundlerPath,
bundleDir,
gemfilePath,
rubyPath,
runtime
);
} }
} }
} else { } else {

View File

@@ -81,6 +81,12 @@ def vc__handler(event:, context:)
payload = JSON.parse(event['body']) payload = JSON.parse(event['body'])
path = payload['path'] path = payload['path']
headers = payload['headers'] headers = payload['headers']
if ENV['VERCEL_DEBUG']
puts 'Request Headers: '
puts headers
end
httpMethod = payload['method'] httpMethod = payload['method']
encoding = payload['encoding'] encoding = payload['encoding']
body = payload['body'] body = payload['body']