quick-wolf-8403
09/29/2022, 6:03 PMrequirements.txt
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:
- 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
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?pulumi up --yes --skip-preview --parallel 2147483647 --exec-agent pulumi/actions@v3 --color auto --exec-kind auto.local --stack nocap/dev --non-interactive
(for example), and that fails due to not running in the env with the deps.
When running pytest later, I just run poetry run pytest
to make sure it's using the corrent env.
I could also run poetry shell
first to have future command run in that env.
I assume this is also a problem for Pipenv.pip
if you install in a virtualenv. The example uses pip
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-61624
09/29/2022, 7:08 PMlimited-rainbow-51650
09/30/2022, 7:41 AMpoetry config virtualenvs.in-project true
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 venv
folder configured in Pulumi.yaml
.quick-wolf-8403
09/30/2022, 3:15 PMruntime:
name: python
options:
virtualenv: venv
And ran poetry config virtualenvs.in-project true --local
(just setting it for this project) and made sure poetry.toml
was added to source control.