aws-cloudformation / aws-cloudformation/cloudformation-cli

Rely on the contract, not the implementation

Aperta
#798 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
336
Fork
172
Merge medio
3g 5m
PR unite (30g)
3

Descrizione

One of the big problems we have with cfn cli is that it heavily depends on the implementation details, rather than contracts. One of the very particular examples here is when we try to publish a type provider that is developed using `provided` runtime - we develop our Lambdas using GraalVM and it required a bit of "hacking" to make it working as CloudFormation type provider ( https://wrzasq.pl/blog/cloudformation-custom-resource-providers-with-any-runtime-any-toolchain-any.html ). Now, trying to just publish the type I can see the following error in the logs published to S3:

```
[2021-07-11T23:59:03Z] DEBUG - Caught exit recommendation
Traceback (most recent call last):
File "/root/.pyenv/versions/3.7.6/lib/python3.7/site-packages/rpdk/core/project.py", line 224, in validate_and_load_resource_settings
SETTINGS_VALIDATOR.validate(raw_settings)
File "/root/.pyenv/versions/3.7.6/lib/python3.7/site-packages/jsonschema/validators.py", line 353, in validate
raise error
jsonschema.exceptions.ValidationError: 'provided.al2' is not one of ['nodejs10.x', 'nodejs12.x', 'go1.x', 'nodejs14.x', 'noexec', 'dotnetcore2.1', 'python3.6', 'python3.7', 'java8', 'python3.8', 'java11']

Failed validating 'enum' in schema['properties']['runtime']:
{'enum': ['nodejs10.x',
'nodejs12.x',
'go1.x',
'nodejs14.x',
'noexec',
'dotnetcore2.1',
'python3.6',
'python3.7',
'java8',
'python3.8',
'java11'],
'type': 'string'}

On instance['runtime']:
'provided.al2'
```

So even though the resource type works on the account, interacting properly with all AWS API interfaces, it fails validation of cfn-cli because it assumes some implementation details (in this case a runtime, but maybe some more things apart of it).

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia in rpdk/core/project.py, in validate_and_load_resource_settings, e riproduci la pubblicazione di un provider usando il runtime provided.al2. Traccia la validazione del runtime rispetto al contratto CloudFormation e analizza i test o gli schemi correlati. Il lavoro è completato quando un runtime del provider valido viene accettato senza essere rifiutato esclusivamente perché si trova al di fuori dell’elenco di implementazioni hard-coded.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
aws, python
Ambito
cli, cloud
Tipo di issue
Bug
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.