dry-journalist-60579
03/14/2023, 9:47 PMruntime:
name: python
options:
virtualenv: venv
in my Pulumi.yaml because locally we use poetry run pulumi up
and poetry uses the correct virtualenv automatically.
Side note: we are using a custom docker image for deployments because we’re using python 3.10 so I built one:
# based on <https://github.com/pulumi/pulumi-docker-containers/blob/main/docker/pulumi/Dockerfile>
FROM python:3.10-slim
RUN apt-get update -y && \
apt-get install -y \
curl
# Passing --build-arg PULUMI_VERSION=vX.Y.Z will use that version
# of the SDK. Otherwise, we use whatever <http://get.pulumi.com|get.pulumi.com> thinks is
# the latest
ARG PULUMI_VERSION
# Install the Pulumi SDK, including the CLI and language runtimes.
RUN curl -fsSL <https://get.pulumi.com/> | bash -s -- --version $PULUMI_VERSION
# Install Poetry
ENV POETRY_HOME=/usr/local
RUN curl -sSL <https://install.python-poetry.org> | python3 -
# Create wrappers such that pulumi commands always run with poetry
COPY ./create-poetry-wrappers.sh /usr/local/bin
RUN create-poetry-wrappers.sh
ENTRYPOINT ["/bin/bash", "-c"]
CMD [ "/bin/bash" ]
I thought that I could create some wrapper scripts to force poetry run …
on pulumi, but it seems like the /pulumi-deploy-executor
is not ? somehow? using the pulumi located in the container’s $PATH?/usr/bin/pulumi-language-python-exec
<= where is this file coming from…? It’s not in my image. I’m installing to ~/.pulumi/bin
and wrappers in /usr/local/bin
…red-match-15116
03/14/2023, 10:21 PMpulumi-language-python-exec
should be installed along with the pulumi python SDK when you run poetry install
for your project.dry-journalist-60579
03/14/2023, 10:22 PMcurl -fsSL <https://get.pulumi.com/> | bash -s -- --version $PULUMI_VERSION
red-match-15116
03/14/2023, 10:25 PMdry-journalist-60579
03/14/2023, 10:29 PMred-match-15116
03/14/2023, 10:30 PMdry-journalist-60579
03/14/2023, 10:30 PMcurl -H "Authorization: token $PULUMI_ACCESS_TOKEN" "$PULUMI_SERVICE_URL/preview/deployments/executor" |gzip -d >/pulumi-deploy-executor && chmod +x /pulumi-deploy-executor
red-match-15116
03/14/2023, 10:31 PMModuleNotFoundError: No module named pulumi
?dry-journalist-60579
03/14/2023, 10:31 PMred-match-15116
03/14/2023, 10:35 PMdry-journalist-60579
03/14/2023, 10:36 PM#!/bin/bash
for file_path in ~/.pulumi/bin/*; do
file_name=$(basename "$file_path")
wrapper_path="/usr/bin/$file_name"
cat <<EOF > "$wrapper_path"
#!/bin/bash
echo poetry run "$file_path" "\$@"
EOF
chmod +x "$wrapper_path"
done
/usr/bin/pulumi-language-python-exec
that just does poetry run
echo poetry run
to confirm it was being calledred-match-15116
03/14/2023, 10:38 PMpoetry run
should wrap /pulumi-deploy-executor
instead?dry-journalist-60579
03/14/2023, 10:39 PMred-match-15116
03/14/2023, 10:41 PMdry-journalist-60579
03/14/2023, 10:44 PMlimited-rainbow-51650
03/15/2023, 7:31 AMpoetry run ...
way of doing things.dry-journalist-60579
03/15/2023, 2:40 PMpoetry run…