Can't access Build environment variables

Yup - bit of a chicken and egg problem around API deploys that need to know the ID:

  • you need to create a deploy
  • to get the ID,
  • and you need to know the checksums of all your source files to create a deploy,

…so there is no time when you know the ID and can still change the files. This is quite different in our build environment of course.

Perhaps you’d be able to take a hybrid approach:

  1. Build 99% of your app in your CI.
  2. Commit resultant build to git.
  3. we get notified by git and start a “build” (that isn’t a build)
  4. during that “build”, have us “massage” the files to add the deploy ID, with a build command like this:

sed -i s/PLACEHOLDER/${DEPLOY_PRIME_URL}/g file1.html && sed -i s/PLACEHOLDER/${DEPLOY_PRIME_URL}/g file2.js && ls -l index.html

What does that do?

  1. Search and replaces your placeholder with the “real” per-url deploy
  2. makes sure there is an index.html (so we don’t accidentally deploy an empty site if something goes wrong during the copy/massage)
  3. publishes effectively what you built, with that substring interpolated.

Not super direct, but may help you achieve your goals.

1 Like