Circleci v2 suddenly fails to recognize environment variable?

I’ve been running tests for a Flask app for a couple years now without incident. Suddenly today, the tests started failing because it is trying to run the development server as opposed to the test server. After a bit of debugging, it is clear that despite the environment variable for FLASK_CONFIG being set correctly, it is trying to find the url for a MySQL database which is listed under the development server config.

How can I debug this further or figure out what is going on? Nothing has changed on my end that would affect this…

Config is as follows:

version: 2
    working_directory: ~/repo
    - image: circleci/python:3.5
          FLASK_CONFIG: testing

    - run:
        name: run tests
        command: |
          . venv/bin/activate
          python3 test

Have there been any upstream changes to your base image circleci/python:3.5? You can see the SHA of this image in the “Spin up Environment” section of a run. Compare it between the new broken state and the other working state.

I have the same issue: suddenly docker environment variables are not injected anymore and so docker images ignored their configuration.
There wasn’t any change, build was OK and then suddeny failing. Docker image is the same, CircleCI config is the same.
Here you can see twice the same build, the first one succeed, the second one failed. No change between both build:

1 Like

Old (working) version:

Status: Image is up to date for circleci/python:3.5
  using image circleci/python@sha256:c8d8e642612872e5a9882c042341c35cbecf9e13d948e3a3bfcb99ecbaf003e7

New (broken) version:

Status: Downloaded newer image for circleci/python:3.5
  using image circleci/python@sha256:bc92eef1a022b1fb31be7fbe71440cb5c4cdae3f0ddc2d2a78352a3c1a589c72

So yes, it does look like that probably caused the issue! Is this the same for you @noirbizarre? Is there a way to use an older image?

Yes @dhhagan, just use circleci/python@sha256:c8d8e642612872e5a9882c042341c35cbecf9e13d948e3a3bfcb99ecbaf003e7 in your config. This is called “pinning to hash”.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.