Skip to content

ENV vars are ignored (sometimes) #241

@evil-shrike

Description

@evil-shrike

I have a repo with app.json.
That app.json contains the "env" section with a variable. After I introduced the variable it worked and it was asked. But during all subsequent runs the variable is ignored (not being asked).

  "env": {
    "USE_GOOGLE_ADS_CONFIG": {
      "description": "Would you like to use a google-ads.yaml (Y) - please upload one, otherewise (N) you'll be asked to enter credentials later",
      "required": true,
      "value": ""
    }
  },

I tried both required true/false, with and without value.
If I rename it, it starts working again. But if I rename it back it stops.

All that I'm doing with the var is checking for its value in my prebuild.sh:

if [[ $USE_GOOGLE_ADS_CONFIG = "Y" || $USE_GOOGLE_ADS_CONFIG = "y" ]]; then
...

It's really weir behavior and can't tell exact reproducing steps.

Here's an example of a deployment log (the var is there, see app.json, but it wasn't promted):

Welcome to Cloud Shell! Type "help" to get started.
To set your Cloud Platform project in this session use “gcloud config set project [PROJECT_ID]”
sergei@cloudshell:~$ cloudshell_open --repo_url "https://github.com/evil-shrike/cloud-run-button-test.git" --page "shell" --force_new_clone
[ ✓ ] Cloned git repository https://github.com/evil-shrike/cloud-run-button-test.git.
[ ✓ ] Queried list of your projects
[ ✓ ] Found 11 projects in your GCP account.
[ ? ] Choose a project or press ctrl-c to create a new project: myproject1
[ ✓ ] Enabled Cloud Run API on project myproject1
[ ? ] Choose a region to deploy this application: us-central1
[ ! ] Running command: ./cloud-run-hooks/prebuild.sh

  • ./cloud-run-hooks/prebuild.sh
    ^C
    sergei@cloudshell:~ (myproject1)$ cd cloud-run-button-test/
    sergei@cloudshell:~/cloud-run-button-test (myproject1)$ cat app.json
    {
    "env": {
    "USE_GOOGLE_ADS_CONFIG": {
    "description": "Would you like to use a google-ads.yaml (Y) - please upload one, otherewise (N) you'll be asked to enter credentials later",
    "required": true,
    "value": ""
    }
    },
    ...
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions