In the bitbucket pipelines file I install the python dependences in the first step and it fails in the next step when I try to run flake8 command:
name: Install dependencies
- pip install -r requirements.txt
name: Test Flake8
- flake8 -v api
In the second step I get the following error:
bash: flake8: command not found
Welcome to the Community!
Pipeline steps are independent, each of them runs in a fresh Docker container. When you run pip install, it not only downloads the dependencies (cache might help here) but also installs it. E.g. puts flake8, for instance, somewhere on the PATH. So even if the cache works, flake8 won't be available in the next step, only in the next commands of the same script within one step.
In addition to this note that caches are saved on successful builds when the cache is empty. This means that when you update dependencies, the cache won't pick them up until it expires (this happens in 1 week from creation date). See this page for details.
Also, you shouldn't rely on caches in any way. They're meant to speed up the build but they shouldn't be required to run it, e.g. they can be emptied at any time.
Hope this helps. Let me know if you have any questions.
Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events