EAS Build step Read app config fails - CI environment variables unset?

We’re on managed workflow
We’re using eas-cli/0.52.0 linux-x64 node-v16.15.0

We’re submitting to EAS build an iOS application and relying on the EAS environment variables set to configure the app via app.config.ts during the build process (specifically CI=1, EAS_BUILD=true as per Environment variables and secrets - Expo Documentation).

Can you please confirm that during all the steps the requisite, expected EAS build environment variables are actually set?

During the “Read app config” step the build fails as follows:

fatal: not a git repository (or any of the parent directories): .git

Error reading Expo config at /Users/expo/workingdir/build/app.config.ts: Command failed: git rev-parse --short=7 HEAD fatal: not a git repository (or any of the parent directories): .git

And it appears that the expected environment variables aren’t set and we’re falling back to our default behaviour of checking with git.

The function concerned lives in app.config.ts and looks like this:

function getGitHash(): string {
  if (ci.isCI) {
    if (ci.EAS_BUILD) {
      return (
        process.env?.EAS_BUILD_GIT_COMMIT_HASH?.substring(0, 7) ?? 'unknown'
      )
    } else if (ci.CIRCLE) {
      return process.env?.CIRCLE_SHA1?.substring(0, 7) ?? 'unknown'
    }
  }
  return (
    execSync('git rev-parse --short=7 HEAD').toString('utf-8').trim() ??
    'unknown'
  )
}

We’re using the ci-info library (v3.3.1) from NPM to detect the condition.

Thanks in advance,
Brett

It looks like it’s a bug in docs of ci-info

I think you should check for ci.EAS instead ci-info/vendors.json at master · watson/ci-info · GitHub

That looks like it! - thanks @wkozyra !

fixed this in the README: fix(readme): Fix README for EAS constant by brentvatne · Pull Request #77 · watson/ci-info · GitHub

wow they are fast at merging :joy:

1 Like

They were extremely helpful, as was everyone who responded here.

1 Like