Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependabot environment variables #4660

Open
trent-abc opened this issue Jan 24, 2022 · 6 comments
Open

Dependabot environment variables #4660

trent-abc opened this issue Jan 24, 2022 · 6 comments
Labels
T: feature-request Requests for new features

Comments

@trent-abc
Copy link

I would like to specify an environment variable during dependabot runs.

I'm attempting to authenticate against a private cloudsmith python repository. I arrived at a working configuration here. However, this working configuration means my Pipfile looks like so:

[[source]]
url = "https://dl.cloudsmith.io/basic/company/repo/python/index/"
verify_ssl = true
name = "cloudsmith"

While this works for dependabot given the yml in the aforementioned ticket, it doesn't work for local development. For local development our pipfile looks like so:

[[source]]
url = "https://dl.cloudsmith.io/${CLOUDSMITH_KEY}/company/repo/python/index/"
verify_ssl = true
name = "cloudsmith"

So if I'm just able to set the environment variable ${CLOUDSMITH_KEY} to "basic" my problem is solved.

version: 2
updates:
  - package-ecosystem: "pip"
  ...
    env:
      CLOUDSMITH_KEY: basic
  ...

Unfortunately it's unsupported:

Screen Shot 2022-01-24 at 3 28 54 PM

Is there another way around this, or am I missing something? I would have thought setting some environment variables was a common use-case.

@trent-abc trent-abc added the T: feature-request Requests for new features label Jan 24, 2022
@nwalsh1995
Copy link

nwalsh1995 commented Feb 3, 2022

I would like this feature as well.

The local paths in our dependency files are relative to the top level folder and not the project folder. Dependabot assumes the paths are relative to the project folder so it cannot follow dependencies. We can solve this issue because Python pip requirements.txt supports environment variables. So we specify the environment variable different for local dev and another for dependabot execution. This maintains compatibility with the two workflows if environment variables could be supported.

@davidblewett
Copy link

As another point: we're hitting an issue where Dependabot can't correctly handle a Rust dependency via Cargo's Git implementation. We need to be able to set this: https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli , but can't due to missing environment variables for Dependabot.

@Vadorequest
Copy link

In my case, I'd like to grant access to some of our ENV variables that are already set in the GitHub repo, that would be even better than duplicating those for Dependabot specifically.

@Vadorequest
Copy link

I found this article: https://danielabaron.me/blog/dependabot-secrets/#dependabot-secrets

And on my repo, I can set Dependabot secrets at https://github.com/UnlyEd/github-action-deploy-on-vercel/settings/secrets/dependabot

@trent-abc I believe this might solve your issue.

@jeffwidman
Copy link
Member

Related:

Although that one could also be solved by allowing passing in composer-specific config, or changing how we clone.

jeffwidman added a commit that referenced this issue Jul 31, 2023
This removes explicitly catching errors about missing env vars.

This is likely a bit controversial, so here's my thinking:

1. Dependabot at GitHub doesn't support injecting custom env vars. And
   for security reasons is unlikey to anytime soon:
   #4660
2. The primary use case was for `ACF Pro`, but that is no longer
   relevant since they now support private `composer` auth natively:
   #2001 (comment)
3. In general we've told users that if they need custom env vars for
   authentication reasons, they should instead ask their upstream
   providers to use the standard `composer` tooling, rather than a
   workaround. We aren't going to go out of our way to support
   non-standard tooling practices.
4. Setting env vars is still relevant for anyone who runs Dependabot
   standalone, but those are typically power users who are very
   comfortable debugging / reading the logs to realize the error is the
   lack of an env var.
5. Technically this could cause more internal alerts because removing
   this error changes those updates from being seen as "well-known user
   errors" to "unknown service errors" (which we internally alert on).
   However, I strongly suspect that very few users actually hit this
   problem... so if just a couple of repos are hitting it, that
   shouldn't be unduly affecting our metrics.
6. Currently unknown `composer` errors are hidden, but we should resolve
   that with a systemic solution rather than one-off-solutions for
   specific packages, which turns into a game of whack-a-mole:
   #6290
7. Composer error handling is a big mess in our code... it's copy/pasted
   several places, with `TODO` notes saying we should refactor/cleanup
   our error handling code. And we don't even know what's still relevant
   once we drop `composer` `1` as the error messages changed a bit. So
   any cleanup / simplification we can do of the error handling code
   makes our future refactoring easier.

If we needed this generic error for other ecosystems, that'd make sense,
but so far it's `composer` specific so until we need that, let's just
remove it.
@felixlut
Copy link

Any status on this? Currently we are limited in our usage of Dependabot as it doesn't support Environment level secrets and variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: feature-request Requests for new features
Projects
None yet
Development

No branches or pull requests

6 participants