pulumi / pulumi-docker

A Docker Pulumi resource package, providing multi-language access to Docker resources and building images.
85 stars 14 forks source link

pulumi_docker.docker.ResourceError: No digest available for image #399

Closed garyyang6 closed 2 years ago

garyyang6 commented 2 years ago

What happened?

pulumi up

versions: pulumi==3.40.1 pulumi-aws==5.15.0 pulumi-docker==3.4.1 python-dotenv==0.21.0


     Type                   Name                         Plan       Info
     pulumi:pulumi:Stack    abcdef-staging-1234567890987             1 error; 1 message
     ├─ docker:image:Image  cloud/abcd-svc
 +   └─ aws:ssm:Parameter   ABCD_APP_MYSQL_DB_HOST        create

Diagnostics:
  pulumi:pulumi:Stack (abcdef-staging-1234567890987):
    error: Program failed with an unhandled exception:
    Traceback (most recent call last):
      File "/home/ubuntu/.pulumi/bin/pulumi-language-python-exec", line 179, in <module>
        loop.run_until_complete(coro)
      File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
        return future.result()
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/stack.py", line 126, in run_in_stack
        await run_pulumi_func(lambda: Stack(func))
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/stack.py", line 51, in run_pulumi_func
        await wait_for_rpcs()
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/stack.py", line 73, in wait_for_rpcs
        await RPC_MANAGER.rpcs.pop()
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc_manager.py", line 68, in rpc_wrapper
        result = await rpc
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 99, in is_value_known
        return await is_known and not contains_unknowns(await future)
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 99, in is_value_known
        return await is_known and not contains_unknowns(await future)
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 99, in is_value_known
        return await is_known and not contains_unknowns(await future)
      [Previous line repeated 25 more times]
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 514, in do_register
        resolver = await prepare_resource(res, ty, custom, remote, props, opts, typ)
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 124, in prepare_resource
        serialized_props = await rpc.serialize_properties(
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 207, in serialize_properties
        result = await serialize_property(
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 375, in serialize_property
        is_known = await output._is_known
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc_manager.py", line 68, in rpc_wrapper
        result = await rpc
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 99, in is_value_known
        return await is_known and not contains_unknowns(await future)
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 99, in is_value_known
        return await is_known and not contains_unknowns(await future)
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 99, in is_value_known
        return await is_known and not contains_unknowns(await future)
      [Previous line repeated 20 more times]
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 514, in do_register
        resolver = await prepare_resource(res, ty, custom, remote, props, opts, typ)
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 124, in prepare_resource
        serialized_props = await rpc.serialize_properties(
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 207, in serialize_properties
        result = await serialize_property(
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 378, in serialize_property
        value = await serialize_property(
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 361, in serialize_property
        future_return = await asyncio.ensure_future(awaitable)
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 124, in get_value
        val = await self._future
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 170, in run
        value = await self._future
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 451, in gather_futures
        return await _gather_from_dict(value_futures_dict)
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 630, in _gather_from_dict
        results = await asyncio.gather(*tasks.values())
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc_manager.py", line 68, in rpc_wrapper
        result = await rpc
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 124, in get_value
        val = await self._future
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 685, in do_register_resource_outputs
        serialized_props = await rpc.serialize_properties(outputs, {})
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 207, in serialize_properties
        result = await serialize_property(
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 375, in serialize_property
        is_known = await output._is_known
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 168, in run
        is_known = await self._is_known
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 99, in is_value_known
        return await is_known and not contains_unknowns(await future)
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi/output.py", line 215, in run
        return await cast(Awaitable[U], transformed)
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi_docker/docker.py", line 243, in build_and_push_image
        build_result = await build_image(base_image_name, path_or_build, log_resource, cache_from)
      File "/home/ubuntu/works/cloud/deployment/src/abcdef/venv/lib/python3.9/site-packages/pulumi_docker/docker.py", line 444, in build_image
        raise ResourceError(
    pulumi_docker.docker.ResourceError: No digest available for image 1234567890987.dkr.ecr.us-west-2.amazonaws.com/cloud/abcd-svc-4c4ac5e

    E1011 06:09:05.598323428   59188 fork_posix.cc:76]           Other threads are currently calling into gRPC, skipping fork() handlers

Steps to reproduce

import logging
import pulumi_aws as aws
from _infra_common.pulumi_fargate_web import PulumiFargateWeb

logger = logging.getLogger("infra_logger")

IDENTITY_NAME = "abcdapp-svc"
DIRECTORY_NAME = "abcdapp"
PARAMETER_STORE_CLUSTER_NAME = "APP_CLUSTER_NAME"

PORT = 80  # default port
HEALTH_CHECK_ENDPOINT = "/index.html"   # noc app landing page entry

# This is a list of the parameter store values that need to be used in noc_app
ENVIRONMENT_VAR_NAMES = [
    "ENVIRONMENT_NAME",
    "ABCD_APP_MYSQL_DB_DBNAME",
    "ABCD_APP_MYSQL_DB_HOST",
    "ABCD_APP_MYSQL_DB_PORT",
    "ABCD_APP_MYSQL_DB_USERNAME",
    "ABCD_APP_MYSQL_DB_PASSWORD",
]

class Nocapp(PulumiFargateWeb):
    def __del__(self):
        pass

    def __init__(self):
        super().__init__(
            IDENTITY_NAME, DIRECTORY_NAME, PARAMETER_STORE_CLUSTER_NAME,
            ENVIRONMENT_VAR_NAMES, PORT, HEALTH_CHECK_ENDPOINT
        )

    def main(self):
        """
        function to build a fargate noc_app instance based on environment variables.
        Returns:
        """

        _ = super().main()

        # mysql security group
        mysql_security_group = aws.ec2.SecurityGroup(
            f"{self.service_name}-secgrp-db",
            vpc_id=self.default_vpc.id,
            description="Enable Mysql Access",
            ingress=[
                aws.ec2.SecurityGroupIngressArgs(
                    protocol="tcp", from_port=3306, to_port=3306, cidr_blocks=["0.0.0.0/0"]
                ),
            ],
        )

        # noc_app needs a persistent database to store users, connection info, etc.
        mysql_rds = aws.rds.Instance(
            f"{self.service_name}-rds",
            allocated_storage=20,
            backup_retention_period=10,
            engine="mysql",
            engine_version="8.0.28",
            instance_class="db.t3.micro",
            auto_minor_version_upgrade=True,
            publicly_accessible=False,
            db_name=aws.ssm.get_parameter("ABCD_APP_MYSQL_DB_DBNAME").value,
            password=aws.ssm.get_parameter("ABCD_APP_MYSQL_DB_PASSWORD").value,
            skip_final_snapshot=True,
            username=aws.ssm.get_parameter("ABCD_APP_MYSQL_DB_USERNAME").value,
            vpc_security_group_ids=[self.security_group.id, mysql_security_group.id]
        )
        # update the ABCD_APP_MYSQL_DB_HOST in ssm with the newly created rds endpoint
        _ = aws.ssm.Parameter(
            "ABCD_APP_MYSQL_DB_HOST",
            name="ABCD_APP_MYSQL_DB_HOST",
            type="String",
            value=mysql_rds.endpoint,
            overwrite=True
        )
        return True

if __name__ == "__main__":
    Abcdapp().main()

Expected Behavior

Create database

Actual Behavior

pulumi_docker.docker.ResourceError: No digest available for image 1234567890987.dkr.ecr.us-west-2.amazonaws.com/cloud/abcd-svc-4c4ac5e

Output of pulumi about

CLI
Version      3.41.1
Go Version   go1.19.1
Go Compiler  gc

Plugins
NAME    VERSION
aws     5.15.0
docker  3.4.1
python  unknown

Host
OS       ubuntu
Version  20.04
Arch     x86_64

This project is written in python: executable='/home/ubuntu/works/cloud/deployment/src/abcdapp/venv/bin/python3' version='3.9.5
'

TYPE                                               URN
pulumi:pulumi:Stack                                urn:pulumi:staging-accountid::abcdapp::pulumi:pulumi:Stack::abcdapp-staging-accountid
pulumi:providers:aws                               urn:pulumi:staging-accountid::abcdapp::pulumi:providers:aws::default
docker:image:Image                                 urn:pulumi:staging-accountid::abcdapp::docker:image:Image::cloud/abcdapp-svc
pulumi:providers:aws                               urn:pulumi:staging-accountid::abcdapp::pulumi:providers:aws::default_5_15_0
aws:ecr/repository:Repository                      urn:pulumi:staging-accountid::abcdapp::aws:ecr/repository:Repository::cloud/abcdapp-svc
aws:cloudwatch/logGroup:LogGroup                   urn:pulumi:staging-accountid::abcdapp::aws:cloudwatch/logGroup:LogGroup::/ecs/abcdapp-svc
aws:ecr/lifecyclePolicy:LifecyclePolicy            urn:pulumi:staging-accountid::abcdapp::aws:ecr/lifecyclePolicy:LifecyclePolicy::abcdapp-svc-lifecycle-policy
aws:lb/targetGroup:TargetGroup                     urn:pulumi:staging-accountid::abcdapp::aws:lb/targetGroup:TargetGroup::tg-abcdapp-svc
aws:iam/role:Role                                  urn:pulumi:staging-accountid::abcdapp::aws:iam/role:Role::abcdapp-svc-exec-role
aws:iam/role:Role                                  urn:pulumi:staging-accountid::abcdapp::aws:iam/role:Role::abcdapp-svc-task-role
aws:iam/rolePolicyAttachment:RolePolicyAttachment  urn:pulumi:staging-accountid::abcdapp::aws:iam/rolePolicyAttachment:RolePolicyAttachment::abcdapp-svc-exec-policy
aws:iam/rolePolicyAttachment:RolePolicyAttachment  urn:pulumi:staging-accountid::abcdapp::aws:iam/rolePolicyAttachment:RolePolicyAttachment::abcdapp-svc-exec-ssm-access-policy
aws:iam/rolePolicyAttachment:RolePolicyAttachment  urn:pulumi:staging-accountid::abcdapp::aws:iam/rolePolicyAttachment:RolePolicyAttachment::abcdapp-svc-ecs-access-policy
aws:ec2/securityGroup:SecurityGroup                urn:pulumi:staging-accountid::abcdapp::aws:ec2/securityGroup:SecurityGroup::abcdapp-svc-secgrp
aws:iam/rolePolicyAttachment:RolePolicyAttachment  urn:pulumi:staging-accountid::abcdapp::aws:iam/rolePolicyAttachment:RolePolicyAttachment::abcdapp-svc-ssm-access-policy
aws:ec2/securityGroup:SecurityGroup                urn:pulumi:staging-accountid::abcdapp::aws:ec2/securityGroup:SecurityGroup::abcdapp-svc-secgrp-db
aws:lb/loadBalancer:LoadBalancer                   urn:pulumi:staging-accountid::abcdapp::aws:lb/loadBalancer:LoadBalancer::lb-abcdapp-svc
aws:lb/listener:Listener                           urn:pulumi:staging-accountid::abcdapp::aws:lb/listener:Listener::lis-abcdapp-svc
aws:rds/instance:Instance                          urn:pulumi:staging-accountid::abcdapp::aws:rds/instance:Instance::abcdapp-svc-rds

Backend
Name           pulumi.com
URL            https://app.pulumi.com/garyyang6
User           garyyang6
Organizations  garyyang6

Dependencies:
NAME              VERSION
common-variables  1.4.4
coverage          6.4.4
deployment        1.4.0
mock              4.0.3
pip               22.2.2
pkg_resources     0.0.0
pytest            7.1.3
requests          2.28.1
setuptools        65.3.0
wheel             0.37.1

Pulumi locates its logs in /tmp by default

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

viveklak commented 2 years ago

On first look this looks to be a duplicate of #352

viveklak commented 2 years ago

Tracked in https://github.com/pulumi/pulumi-docker/issues/352

garyyang6 commented 2 years ago

@viveklak , 3.1.0 does not work for me. I got,

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. deployment 1.4.0 requires pulumi-docker==3.4.1, but you have pulumi-docker 3.1.0 which is incompatible.