question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add an environment variable during the build process.

See original GitHub issue

Proposed change

I’d like to see an environment variable to the tune of REPO2DOCKER=1 (or maybe just the current version of repo2docker?). The reason for this is to enable some specific setup for a Julia package if it’s being built as part of repo2docker, specifically for Binder (see this GitHub issue for more context).

Alternative options

Status quo.

Who would use this feature?

How much effort will adding it take?

All of about twenty seconds (add a line to the base buildpack class).

Who can do this work?

I’m happy to make a PR if this sounds okay.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
betatimcommented, Oct 29, 2019

I’m not mad keen. I think asking users to install the extension explicitly is more in line with our goal of trying to reduce the amount of magic/special casing. The goal of repo2docker is to automate best practices (not invent new ones). One thing this means is that we’d want it to be possible for someone to look at a repo that repo2docker can build and more or less quickly figure out what commands they’d have to type by hand to achieve the same goal. Packages/installers behaving differently when run inside a docker build by repo2docker (but not other docker builds) seems counter to that desire. So I think it would be better to require people to install the extension explicitly via a postBuild. This is a common pattern for other notebook extensions. The other common pattern is that installing the extensions package also installs the extension.

What do you think?

1reaction
travigdcommented, Oct 25, 2019

One thing that will make this trickier is that you need to find a balance between making the env variable available early enough to build steps but late enough so that you only invalidate the cache that actually needs invalidating (just because the version of repo2docker has changed doesn’t mean a large number of layers have become invalid).

That’s a great point! I only suggested the version as the value so that it’s semantically meaningful, but it might make more sense to just set it equal to 1 (kind of like how you have CI=1 in CI environments) and not expose the version for exactly that cache invalidation problem. Another solution might just be to have minor versions (e.g. 1.2 instead of 1.2.3) since that changes less often.

Otherwise, I think the latest it could be set (and still work for my own personal goals) is right before installing packages.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding Custom Environment Variables | Create React App
Environment variables are embedded into the build, meaning anyone can view them by inspecting your app's files. The environment variables are ...
Read more >
Pass Docker Environment Variables During The Image Build
To set environment variables during your image build, you will need either ENV or ARG and ENV at the same time. Docker ENV...
Read more >
Build environment variables | Netlify Docs
Identify environment variables available in the build environment, set your own environment variables, and use environment variables during builds.
Read more >
How to: Use Environment Variables in a Build - MSBuild
Learn how to access environment variables in MSBuild project files, and use environment variables to set build options without modifying the ...
Read more >
What Are Environment Variables and How Can I Use Them ...
Netlify and environment variables​​ To add one, you can simply navigate to the Environment section of your project's Build & deploy settings page ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found