feat: latest Pulumi providers, new Pulumi stack tags, fixes for 5.X aws provider

This commit is contained in:
Stefan Reimer 2022-06-01 13:16:19 +02:00
parent 962ef05714
commit 59308a72d4
6 changed files with 27 additions and 20 deletions

View File

@ -1,6 +1,6 @@
ARG RUNTIME_VERSION="3.8"
ARG DISTRO_VERSION="3.15"
ARG PULUMI_VERSION="3.29.1"
ARG PULUMI_VERSION="3.33.2"
FROM python:${RUNTIME_VERSION}-alpine${DISTRO_VERSION} AS builder
ARG PULUMI_VERSION
@ -35,13 +35,19 @@ COPY . /app
RUN pip install -r requirements.txt
RUN pip install . --no-deps
# minimal pulumi
RUN cd /root/.pulumi/bin && rm -f *dotnet *nodejs *go *java && strip pulumi* || true
# Now build the final runtime
FROM python:${RUNTIME_VERSION}-alpine${DISTRO_VERSION}
# Install GCC (Alpine uses musl but we compile and link dependencies with GCC)
RUN apk add --no-cache \
#cd /etc/apk/keys && \
#echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
#cfssl@testing \
RUN apk upgrade -U --available --no-cache && \
apk add --no-cache \
libstdc++ \
libc6-compat \
ca-certificates \
@ -50,9 +56,8 @@ RUN apk add --no-cache \
COPY --from=builder /venv /venv
COPY --from=builder /root/.pulumi/bin /usr/local/bin
RUN mkdir /workspace && \
cd /usr/bin && ln -s podman docker && \
cd /usr/local/bin && \
rm -f *dotnet *nodejs *go
cd /usr/bin && ln -s podman docker
WORKDIR /workspace
ENV VIRTUAL_ENV=/venv

View File

@ -17,7 +17,7 @@ endif
all: pybuild pytest
dev_setup:
pip install -r dev-requirements.txt --user
pip install -U -r dev-requirements.txt --user
pytest:
flake8 cloudbender tests

View File

@ -113,22 +113,25 @@ def pulumi_init(stack, create=False):
raise ValueError("Missing pulumi.secretsProvider setting!")
# Set tag for stack file name and version
_tags = stack.tags
_tags = {}
try:
_version = stack._pulumi_code.VERSION
except AttributeError:
_version = "undefined"
_tags["zero-downtime.net/cloudbender"] = "{}:{}".format(
# Tag all resources with our metadata, allowing "prune" eventually
_tags["zero-downtime.net/cloudbender/source"] = "{}:{}".format(
os.path.basename(stack._pulumi_code.__file__), _version
)
_tags["zero-downtime.net/cloudbender/owner"] = f"{project_name}.{pulumi_stackname}"
_config = {
"aws:region": stack.region,
"aws:profile": stack.profile,
"aws:defaultTags": {"tags": _tags},
"zdt:region": stack.region,
"zdt:awsAccountId": account_id,
"zdt:projectName": project_name,
"zdt:stackName": pulumi_stackname
}
# inject all parameters as config in the <Conglomerate> namespace

View File

@ -3,10 +3,7 @@ Jinja2
click
pyminifier
cfn-lint>=0.34
# apprise
pulumi>=3.0.0,<4.0.0
pulumi-aws>=4.0.0,<5.0.0
flake8
pytest
twine
pulumi
pulumi-aws
pulumi-aws-native
pulumi_cloudinit

View File

@ -3,9 +3,11 @@ Jinja2>=3.0.0
click
pyminifier
cfn-lint>=0.34
pulumi
pulumi-aws
pulumi-aws-native
pulumi_cloudinit
# apprise
pulumi>=3.0.0,<4.0.0
pulumi-aws>=4.0.0,<5.0.0
# flake8
# pytest

View File

@ -50,7 +50,7 @@ setup(
package_data={ 'cloudbender': ['templates/*.md', 'templates/*.yaml'], },
include_package_data=True,
entry_points={'console_scripts': [ "cloudbender = cloudbender.cli:cli" ]},
install_requires=['boto3', 'Jinja2>=3.0.0', 'click', 'cfn-lint>=0.34', 'pyminifier', 'pulumi>=3.0.0,<4.0.0', 'pulumi-aws>=4.0.0,<5.0.0'], #'apprise'
install_requires=['boto3', 'Jinja2>=3.0.0', 'click', 'cfn-lint>=0.34', 'pyminifier', 'pulumi', 'pulumi-aws'], #'apprise'
tests_require=["pytest-cov", "moto", "mock", 'pytest'],
cmdclass={"test": PyTest},
classifiers=[