Skip to content

fix: avoid cfn-lint W1030 on TaskRoleArn when TaskRole is unset - #404

Open
credfeto wants to merge 2 commits into
mainfrom
fix/cfn-lint-w1030-taskrolearn
Open

fix: avoid cfn-lint W1030 on TaskRoleArn when TaskRole is unset#404
credfeto wants to merge 2 commits into
mainfrom
fix/cfn-lint-w1030-taskrolearn

Conversation

@credfeto

@credfeto credfeto commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

cfn-lint's W1030 check was flagging TaskRoleArn in cloudformation.json because it resolves a bare Ref: TaskRole, and TaskRole's default is an empty string, which does not match the IAM Role ARN pattern.

Applied the same fix already merged in funfair-ethereum-proxy-server: added a HasTaskRole condition, and TaskRoleArn now resolves to AWS::NoValue (property omitted) when TaskRole is left at its default, or to the supplied Ref otherwise.

Verified locally with cfn-lint --info --include-checks I --template cloudformation.json: clean, no W1030.

https://claude.ai/code/session_014jXxyHtaWdgBDwrwjMRmns

TaskRoleArn resolved a bare Ref to the TaskRole parameter, whose
default is an empty string. cfn-lint flags this because the resolved
value does not match the IAM Role ARN pattern. Added a HasTaskRole
condition (same fix already applied in funfair-ethereum-proxy-server)
so the property is only set when a TaskRole is actually supplied,
otherwise it resolves to AWS::NoValue.

Prompt: Run Cloud Formation Linter
1s
Run "$CFN_LINT_VENV/bin/cfn-lint" --info --include-checks I --template "$TEMPLATE"
  2026-09-03 20:37:21,269 - cfnlint.runner.template.runner - INFO - Run scan of template /build/runners/agents/build05/_work/BuildBot/BuildBot/cloudformation.json
  W1030 {'Ref': 'TaskRole'} is not a 'AWS::IAM::Role.Arn' with pattern '^arn:aws[a-zA-Z-]*:iam::\d{12}:role/.+$' when 'Ref' is resolved
  /build/runners/agents/build05/_work/BuildBot/BuildBot/cloudformation.json:282:11 we've fixed this in other repos can you apply the same fix eg. funfair-etherum-proxy-server

Claude-Session: https://claude.ai/code/session_014jXxyHtaWdgBDwrwjMRmns
@credfeto credfeto self-assigned this Sep 3, 2026
@credfeto
credfeto marked this pull request as ready for review September 3, 2026 18:56
@credfeto
credfeto requested a review from a team as a code owner September 3, 2026 18:56
@credfeto
credfeto enabled auto-merge September 3, 2026 18:56
@credfeto

credfeto commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

Roslyn analyzer findings

Source Rule Level File Line Suppressed Message
DotNet IL2026 error src/BuildBot/Helpers/Endpoints.CloudFormation.cs 26 yes Using member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPost(IEndpointRouteBuilder, String, Delegate)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. This API may perform reflection on the supplied delegate and its parameters. These types may be trimmed if not directly referenced.
DotNet CA2000 error src/BuildBot/Helpers/ServerStartup.cs 127 yes Call System.IDisposable.Dispose on object created by 'CreateLogger()' before all references to it are out of scope
DotNet IL2026 error src/BuildBot/Helpers/Endpoints.Watchtower.cs 19 yes Using member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPost(IEndpointRouteBuilder, String, Delegate)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. This API may perform reflection on the supplied delegate and its parameters. These types may be trimmed if not directly referenced.
DotNet IL2026 error src/BuildBot/Helpers/Endpoints.GitHub.cs 19 yes Using member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPost(IEndpointRouteBuilder, String, Delegate)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. This API may perform reflection on the supplied delegate and its parameters. These types may be trimmed if not directly referenced.
DotNet IL2026 error src/BuildBot/Helpers/Endpoints.GitHub.cs 29 yes Using member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPost(IEndpointRouteBuilder, String, Delegate)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. This API may perform reflection on the supplied delegate and its parameters. These types may be trimmed if not directly referenced.
DotNet IL2026 error src/BuildBot/Helpers/Endpoints.GitHub.cs 39 yes Using member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPost(IEndpointRouteBuilder, String, Delegate)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. This API may perform reflection on the supplied delegate and its parameters. These types may be trimmed if not directly referenced.
DotNet IL2026 error src/BuildBot/Helpers/Endpoints.Test.cs 22 yes Using member 'Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapGet(IEndpointRouteBuilder, String, Delegate)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. This API may perform reflection on the supplied delegate and its parameters. These types may be trimmed if not directly referenced.
DotNet IL2026 error src/BuildBot/obj/Release/net10.0/Microsoft.AspNetCore.Http.RequestDelegateGenerator/Microsoft.AspNetCore.Http.RequestDelegateGenerator.RequestDelegateGenerator/GeneratedRouteBuilderExtensions.g.cs 1014 yes Using member 'Microsoft.AspNetCore.Http.HttpResponseJsonExtensions.WriteAsJsonAsync(HttpResponse, TValue, JsonSerializerOptions, CancellationToken)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

@credfeto

credfeto commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

Super-linter summary

Language Validation result
CLOUDFORMATION Pass ✅
JSON Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant