Repository: PrefectHQ/prefect

Issue:
Pass private registry creds to Fargate agent (non-programmatic approach)
## Current behavior

I'm trying to execute flows, configured without explicit specification of environment (e.g. `FargateEnvironment`) through the generic agent as specified below:

```yaml
  my-agent:
    image: prefecthq/prefect:${PREFECT_VERSION}
    environment:
      - PREFECT__BACKEND=server
      - PREFECT__SERVER__HOST=http://x.x.x.x
      - PREFECT__LOGGING__LEVEL=DEBUG
      - PREFECT__FLOWS__CHECKPOINTING=true
      - AWS_ACCESS_KEY_ID=...
      - AWS_SECRET_ACCESS_KEY=...
      - REGION_NAME=eu-central-1
      - containerDefinitions_logConfiguration={"logDriver":"awslogs","options":{"awslogs-group":"npn/prefect","awslogs-region":"eu-central-1","awslogs-stream-prefix":"flow-runs"}}
    restart: always
    command: >
      prefect agent start fargate
        --name my-test-agent
        --show-flow-logs
        -l fargate
        -v
        cpu=256
        memory=512
        executionRoleArn=arn:aws:iam::********:role/ecsTaskExecutionRole
        cluster=npn-ecs1
        networkConfiguration="{'awsvpcConfiguration': {'assignPublicIp': 'DISABLED', 'subnets': ['subnet-*******'], 'securityGroups': ['sg-*******']}}"
```

Everything works as expected excepting pulling image from our private docker registry. The documentation for Fargate and Boto3 suggests to put access token into AWS Secret Manager (done) and pass it in the following structure:

```python
containerDefinitions = {
   "repositoryCredentials": {
        "credentialsParameter":"arn:aws:secretsmanager:eu-central-1:*****:secret:<my secret>"}
}
```

But I couldn't find a way to pass such a parameter via environment variables or **kwargs to agent as CLI parameters.

## Proposed behavior

Would it be possible to add support for credentials in the same way how it works for `containerDefinitions_logConfiguration` or `networkConfiguration`?

E.g.:
```yaml
    environment:
      - PREFECT__BACKEND=server
      - PREFECT__SERVER__HOST=http://x.x.x.x
      - PREFECT__LOGGING__LEVEL=DEBUG
      - PREFECT__FLOWS__CHECKPOINTING=true
      - AWS_ACCESS_KEY_ID=...
      - AWS_SECRET_ACCESS_KEY=...
      - REGION_NAME=eu-central-1
      - containerDefinitions_logConfiguration={"logDriver":"awslogs","options":{"awslogs-group":"npn/prefect","awslogs-region":"eu-central-1","awslogs-stream-prefix":"flow-runs"}}
      - containerDefinitions_repositoryCredentials={"credentialsParameter":"arn:aws:secretsmanager:eu-central-1:*****:secret:<my secret>"}
```




Discussion:

Resolving patch:
diff --git a/src/prefect/agent/fargate/agent.py b/src/prefect/agent/fargate/agent.py
--- a/src/prefect/agent/fargate/agent.py
+++ b/src/prefect/agent/fargate/agent.py
@@ -326,6 +326,7 @@ def _parse_kwargs(self, user_kwargs: dict, check_envars: bool = False) -> tuple:
             "secrets",
             "environment",
             "logConfiguration",
+            "repositoryCredentials",
         ]
 
         task_definition_kwargs = {}


Test patch:
diff --git a/tests/agent/test_fargate_agent.py b/tests/agent/test_fargate_agent.py
--- a/tests/agent/test_fargate_agent.py
+++ b/tests/agent/test_fargate_agent.py
@@ -168,6 +168,7 @@ def test_parse_container_definition_kwargs(monkeypatch, runner_token):
                 "secrets": "test",
                 "mountPoints": "test",
                 "logConfiguration": "test",
+                "repositoryCredentials": "repo",
             }
         ]
     }
@@ -183,6 +184,7 @@ def test_parse_container_definition_kwargs(monkeypatch, runner_token):
         "secrets": "test",
         "mountPoints": "test",
         "logConfiguration": "test",
+        "repositoryCredentials": "repo",
     }