Commit 0042518
Harish Senthilkumar
Grant CloudWatch Logs export permission on the release artifacts bucket
The LogsPuller CodeBuild project exports build logs to the release artifacts
bucket via `aws logs create-export-task`. That call is made by the CloudWatch
Logs service (not the CodeBuild role), so the destination bucket must grant the
logs service principal s3:GetBucketAcl and s3:PutObject via a bucket policy. The
(externally-managed) release bucket had no such policy, so every export failed
with "AccessDeniedException ... CreateExportTask: GetBucketAcl call on the given
bucket failed."
Add an AWS::S3::BucketPolicy for the release artifacts bucket granting the
CloudWatch Logs service principal GetBucketAcl + PutObject, scoped with
aws:SourceAccount and aws:SourceArn (the CodeBuild log group). The bucket has
ACLs disabled (BucketOwnerEnforced), so no s3:x-amz-acl condition is used.
Also harden buildspecs/pull-logs.yml: fail the build when a log export task
cannot be created (empty task id) or ends FAILED/CANCELLED. Previously these
errors were swallowed and the build reported SUCCEEDED while exporting zero logs.
Signed-off-by: Harish Senthilkumar <harishxr@amazon.com>1 parent 6cda0b4 commit 0042518
2 files changed
Lines changed: 53 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
899 | 899 | | |
900 | 900 | | |
901 | 901 | | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
902 | 939 | | |
903 | 940 | | |
904 | 941 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
60 | 68 | | |
61 | 69 | | |
62 | 70 | | |
63 | 71 | | |
64 | 72 | | |
65 | 73 | | |
66 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
67 | 82 | | |
68 | 83 | | |
69 | 84 | | |
| |||
82 | 97 | | |
83 | 98 | | |
84 | 99 | | |
85 | | - | |
| 100 | + | |
86 | 101 | | |
0 commit comments