Repository: PrefectHQ/prefect

Issue:
Deprecation warning missing from some blocks 
### First check

- [X] I added a descriptive title to this issue.
- [X] I used the GitHub search to find a similar issue and didn't find it.
- [X] I searched the Prefect documentation for this issue.
- [X] I checked that this issue is related to Prefect and not one of its dependencies.

### Bug summary

Several blocks show a deprecation warning in the UI. Jowever, several blocks that I believe should have a deprecation warning are missing it:

1. ECS Task
1. Vertex AI Custom Training Job
1. GCP Cloud Run Job
1. Azure Container Instance Job
1. Docker Registry

Example:
![Screenshot 2024-05-08 at 4 23 41 PM](https://github.com/PrefectHQ/prefect/assets/7703961/6461e6c4-53ed-4d30-9c3e-a1e03cc1fc65)


### Reproduction

```python3
See example above.
```


### Error

_No response_

### Versions

```Text
Many of my integration libraries and their block types are updated as of Prefect Cloud May 8, 2024.
```

cc: @desertaxle 


Discussion:

Resolving patch:
diff --git a/src/prefect/server/models/block_registration.py b/src/prefect/server/models/block_registration.py
--- a/src/prefect/server/models/block_registration.py
+++ b/src/prefect/server/models/block_registration.py
@@ -163,20 +163,35 @@ async def _register_collection_blocks(session: sa.orm.Session):
         for collection in collections_blocks_data["collections"].values()
         for block_type in collection["block_types"].values()
     ]
-    for block_type in block_types:
-        # each block schema gets its own transaction
-        async with session.begin():
-            block_schemas = block_type.pop("block_schemas", [])
+
+    # due to schema reference dependencies, we need to register all block types first
+    # and then register all block schemas
+    block_schemas: dict[str, dict] = {}
+
+    async with session.begin():
+        for block_type in block_types:
+            block_schema = block_type.pop("block_schema", None)
+            if not block_schema:
+                raise RuntimeError(
+                    f"Block schema not found for block type {block_type.get('slug')!r}"
+                )
             block_type_id = await register_block_type(
                 session=session,
                 block_type=schemas.core.BlockType.model_validate(block_type),
             )
-            for block_schema in block_schemas:
+            block_schema["block_type_id"] = block_type_id
+            block_schemas[block_type["slug"]] = block_schema
+
+    async with session.begin():
+        for block_type_slug, block_schema in block_schemas.items():
+            try:
                 await register_block_schema(
                     session=session,
-                    block_schema=schemas.core.BlockSchema.model_validate(
-                        {**block_schema, "block_type_id": block_type_id}
-                    ),
+                    block_schema=schemas.core.BlockSchema.model_validate(block_schema),
+                )
+            except Exception:
+                logger.exception(
+                    f"Failed to register block schema for block type {block_type_slug}"
                 )
 
 


Test patch: