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

Documentation for configuring renovate through environment variables #26

Closed
janjagusch opened this issue Jun 12, 2020 · 8 comments
Closed
Labels
documentation Improvements or additions to documentation

Comments

@janjagusch
Copy link

Which Renovate are you using?

Renovate Open Source CLI

Which platform are you using?

GitLab.com

What would you like to do?

Is there an exhaustive documentation on which environment variables to use to configure renovate? For example, renovatebot/renovate#4984 indicates that you can set a RENOVATE_HOST_RULES env var. Also, GITHUB_COM_TOKEN and RENOVATE_TOKEN seem like valid options here.

However, I cannot find any documentation on this. I checked configuration options, self-hosted configuration options and pretty much every other site in the documentation. Am I missing something?

I am particularly interested in knowing how to set the repositories property, as described here.

@rarkins rarkins transferred this issue from renovatebot/config-help Jun 12, 2020
@rarkins
Copy link
Contributor

rarkins commented Jun 12, 2020

We generate our documentation site from this repo, so I have transferred the issue.

It would be helpful if we auto-generated a new page with has a table of all options supported by CLI and/or env and what their exact names are.

Re: repositories, can you try something like RENOVATE_REPOSITORIES=abc/def,abc/xyz ?

@janjagusch
Copy link
Author

janjagusch commented Jun 12, 2020

We generate our documentation site from this repo, so I have transferred the issue.

It would be helpful if we auto-generated a new page with has a table of all options supported by CLI and/or env and what their exact names are.

Re: repositories, can you try something like RENOVATE_REPOSITORIES=abc/def,abc/xyz ?

Can confirm that RENOVATE_REPOSITORIES=abc/def,abc/xyz does the job, thanks @rarkins!

A full documentation on this would be amazing. We want to run renovate in a container and its just much nicer to pass env vars rather than binding a volume. Also makes it easier to separate values and secrets in a kubernetes deployment.

@rarkins
Copy link
Contributor

rarkins commented Jun 12, 2020

Did you guess how the environment variables work though? i.e. they always start with RENOVATE_ and then you uppercase them and split words with _

@janjagusch
Copy link
Author

janjagusch commented Jun 12, 2020

Did you guess how the environment variables work though? i.e. they always start with RENOVATE_ and then you uppercase them and split words with _

Yeah, prefixing with RENOVATE_ would have been my first guess, too. It just seems that there are some exceptions, like e.g. GITHUB_COM_TOKEN. Also, this doesn't work with nested objects, like e.g. RENOVATE_HOST_RULES, where you essentially need to provide the entire JSON.

I just think that specifying config through env vars is a really useful and some added documentation on it would definitely help!

@rarkins
Copy link
Contributor

rarkins commented Jun 12, 2020

GITHUB_TOKEN is no longer used, but maybe you mean GITHUB_COM_TOKEN?

Providing the full JSON array for RENOVATE_HOST_RULES was the only way we could think to get it to work.

@janjagusch
Copy link
Author

GITHUB_TOKEN is no longer used, but maybe you mean GITHUB_COM_TOKEN?

Was typing too fast, changed it to GITHUB_COM_TOKEN.

Providing the full JSON array for RENOVATE_HOST_RULES was the only way we could think to get it to work.

One option would be to describe hostRules as an object rather than an array. Then you could define the unnested properties as env vars, similar to how poetry does it (renovatebot/renovate#6488).

Example:

hostRules: {
    'myrule': {
        'baseUrl': 'myurl',
        'username': 'myuser',
        'password': 'mypwd'
    }
}

could be expressed as

export RENOVATE_HOST_RULES_MYRULE_BASE_URL="myurl"
export RENOVATE_HOST_RULES_MYRULE_USERNAME="myuser"
export RENOVATE_HOST_RULES_MYRULE_PASSWORD="mypwd"

@MatthiasWinzeler
Copy link

if any lost soul ever stumbles upon this and tries to apply this to github actions on a self-hosted Github: the following snippet makes it work:

  renovate:
    name: renovate
    ...
    steps:
      - uses: actions/checkout@v2
      - name: Renovate
        uses: renovatebot/github-action@v25.49.3
        env:
          RENOVATE_HOST_RULES: '[{"hostType": "github", "domainName": "github.com", "token": "${{ secrets.RENOVATE_GITHUB_COM_TOKEN }}"}]'
          RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
          RENOVATE_ENDPOINT: 'https://<hostname-of-your-github-instance>/api/v3'
          RENOVATE_AUTODISCOVER: "false"
          RENOVATE_CONFIG_FILE: renovate.json

where RENOVATE_GITHUB_COM_TOKEN is a github.com personal access token and RENOVATE_TOKEN a technical user's PAT of the local github instance (both configured in the Github project's settings).

@viceice
Copy link
Member

viceice commented Mar 25, 2022

@viceice viceice closed this as completed Mar 25, 2022
@viceice viceice added documentation Improvements or additions to documentation and removed status:ready labels Mar 25, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants