quick-wolf-840309/29/2022, 6:03 PM
file. A workflow like this runs: https://github.com/pulumi/actions/blob/master/examples/python-pulumi.yaml But I would like to do something like this:
However, the Pulumi action fails, saying it can't import pulumi. It doesn't use the environment Poetry created. Is there a way to specify your environment to the action?
- id: "setup-python-pulumi" name: "Install Pulumi Python environment" uses: actions/setup-python@v3 with: python-version: '3.10' - id: "get-deployment-deps" name: "Get deployment script deps" working-directory: iac run: | pipx install poetry poetry install - id: 'pulumi-deploy' name: 'Deploy from Pulumi IaC' uses: pulumi/actions@v3 with: command: up stack-name: nocap/dev work-dir: iac refresh: true
(for example), and that fails due to not running in the env with the deps. When running pytest later, I just run
pulumi up --yes --skip-preview --parallel 2147483647 --exec-agent pulumi/actions@v3 --color auto --exec-kind auto.local --stack nocap/dev --non-interactive
to make sure it's using the corrent env. I could also run
poetry run pytest
first to have future command run in that env. I assume this is also a problem for Pipenv.
if you install in a virtualenv. The example uses
to install to the system, which is fine for a disposable runner... Maybe I can just turn it off, like with
pipenv install --system
kind-jelly-6162409/29/2022, 7:08 PM
limited-rainbow-5165009/30/2022, 7:41 AM
which creates the virtual environment folder within the project setup. With that in place, you can use Poetry to manage dependencies, then run Pulumi with the
poetry config virtualenvs.in-project true
folder configured in
quick-wolf-840309/30/2022, 3:15 PM
runtime: name: python options: virtualenv: venv
(just setting it for this project) and made sure
poetry config virtualenvs.in-project true --local
was added to source control.