feat: latest Pulumi providers, new Pulumi stack tags, fixes for 5.X aws provider
All checks were successful
ZeroDownTime/CloudBender/pipeline/head This commit looks good

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 RUNTIME_VERSION="3.8"
ARG DISTRO_VERSION="3.15" 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 FROM python:${RUNTIME_VERSION}-alpine${DISTRO_VERSION} AS builder
ARG PULUMI_VERSION ARG PULUMI_VERSION
@ -35,13 +35,19 @@ COPY . /app
RUN pip install -r requirements.txt RUN pip install -r requirements.txt
RUN pip install . --no-deps 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 # Now build the final runtime
FROM python:${RUNTIME_VERSION}-alpine${DISTRO_VERSION} FROM python:${RUNTIME_VERSION}-alpine${DISTRO_VERSION}
# Install GCC (Alpine uses musl but we compile and link dependencies with GCC) #cd /etc/apk/keys && \
RUN apk add --no-cache \ #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++ \ libstdc++ \
libc6-compat \ libc6-compat \
ca-certificates \ ca-certificates \
@ -50,9 +56,8 @@ RUN apk add --no-cache \
COPY --from=builder /venv /venv COPY --from=builder /venv /venv
COPY --from=builder /root/.pulumi/bin /usr/local/bin COPY --from=builder /root/.pulumi/bin /usr/local/bin
RUN mkdir /workspace && \ RUN mkdir /workspace && \
cd /usr/bin && ln -s podman docker && \ cd /usr/bin && ln -s podman docker
cd /usr/local/bin && \
rm -f *dotnet *nodejs *go
WORKDIR /workspace WORKDIR /workspace
ENV VIRTUAL_ENV=/venv ENV VIRTUAL_ENV=/venv

View File

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

View File

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

View File

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

View File

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

View File

@ -50,7 +50,7 @@ setup(
package_data={ 'cloudbender': ['templates/*.md', 'templates/*.yaml'], }, package_data={ 'cloudbender': ['templates/*.md', 'templates/*.yaml'], },
include_package_data=True, include_package_data=True,
entry_points={'console_scripts': [ "cloudbender = cloudbender.cli:cli" ]}, 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'], tests_require=["pytest-cov", "moto", "mock", 'pytest'],
cmdclass={"test": PyTest}, cmdclass={"test": PyTest},
classifiers=[ classifiers=[