diff --git a/Dockerfile b/Dockerfile index fe1c6ab..e665dfd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/Makefile b/Makefile index b159182..b5ab0b9 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/cloudbender/pulumi.py b/cloudbender/pulumi.py index 560184b..4da19d1 100644 --- a/cloudbender/pulumi.py +++ b/cloudbender/pulumi.py @@ -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 namespace diff --git a/dev-requirements.txt b/dev-requirements.txt index bde4577..6d06d55 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -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 diff --git a/requirements.txt b/requirements.txt index e1569e1..88bbd77 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/setup.py b/setup.py index 5dbdab7..64b2eac 100644 --- a/setup.py +++ b/setup.py @@ -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=[