Skip to content

Commit

Permalink
Use REPO_ROOT to set working directory and absolute paths
Browse files Browse the repository at this point in the history
  • Loading branch information
brianseeders committed Jun 8, 2021
1 parent d6add4b commit d0fbb4d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/dev/build/lib/version_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import execa from 'execa';
import fs from 'fs';
import { join } from 'path';
import { REPO_ROOT } from '@kbn/utils';
import { getBuildNumber } from './get_build_number';

interface Options {
Expand All @@ -28,8 +30,8 @@ export async function getVersionInfo({ isRelease, versionQualifier, pkg }: Optio
isRelease ? '' : '-SNAPSHOT'
);

const buildSha = fs.existsSync('.git')
? (await execa('git', ['rev-parse', 'HEAD'])).stdout
const buildSha = fs.existsSync(join(REPO_ROOT, '.git'))
? (await execa('git', ['rev-parse', 'HEAD'], { cwd: REPO_ROOT })).stdout
: process.env.GIT_COMMIT || process.env.BUILDKITE_COMMIT || '';

return {
Expand Down

0 comments on commit d0fbb4d

Please sign in to comment.