PR version of envVarGroup is missing keys that have sync: false

Hi all. I have an env group defined in my render.yaml. Something like this:

previewsEnabled: true

  - name: staging
      - key: ELIXIR_VERSION
        value: 1.11.4
      - key: MAILGUN_API_KEY
        sync: false

The group is created, I set the MAILGUN_API_KEY value manually in the web UI. Everything was working OK. For preview environments, the group was copied correctly and MAILGUN_API_KEY was included with the value I set manually. This is the desired behavior.

Then I created another PR and changed the value of the ELIXIR_VERSION env var there and the env var group copied for that PR doesn’t include the MAILGUN_API_KEY env var (or none with the sync: false set). This is not desired and I am wondering if it’s some bug or is it the intended behavior that I have just discovered?

Thanks a lot for your help.

Hi Stefan,

When you view this PR in the Github UI, and click on the “files changed” tab, do you see the expected render.yaml content there?

Yes, it’s there.

Does your render.yaml include a reference to the env group?

- name: my-service
  - fromGroup: staging

If you already have that “fromGroup” parameter set, then you might need to try defining the env group in the UI, but still referencing it in the render.yaml file. Does that work for you?

I’ll try to create simplest possible repo to replicate this bug and post a link here.

OK, I got it.


Service ID

Steps I did:

  1. Render web UI → YAML → New From YAML → selected the repo mentioned above
  2. EXAMPLE_ENV_VAR_GROUP was created but without the NOT_SYNCED_ENV_VAR - that is what I expected
  3. added NOT_SYNCED_ENV_VAR with some arbitrary value into the EXAMPLE_ENV_VAR_GROUP
  4. created a PR on the render_plug repository
  5. preview environment was created along with EXAMPLE_ENV_VAR_GROUP PR #1, but that doesn’t contain the NOT_SYNCED_ENV_VAR

Expected result:
EXAMPLE_ENV_VAR_GROUP PR #1 to contain the NOT_SYNCED_ENV_VAR with the value I set manually in the Render web UI.

Thanks a lot for your help, @Aaron_Gruberg :slight_smile:

Can you try removing this section envVarGroups from your yaml, and setting this env group in the UI via the Env Groups page? This may be necessary for env groups that contain variables set to sync: false.

If I remove the envVarGroups section from my render.yaml file, there will be no sync: false, and then it will become completely different scenario.

I read the docs and the information there regarding sync: false seems to be contradicting your advice.

Environment groups

  • Environment groups can be used to propagate sync: false environment variables to preview environments.

Or maybe I don’t understand the sentence I am quoting above. Could you please elaborate a bit?

I don’t want to set my env groups through UI, because it won’t be an infrastructure as code anymore. I want to keep it in the render.yaml to track changes in GIT among other things.

Sorry for the confusion there, environment groups are actually used to replace sync:false variables. This is necessary because sync:false requires manual input, while the PR previews are automatic. The environment group can still be referenced in your yaml as you are already doing, it’s just not created in the yaml.

      - fromGroup: staging