Commit a160096
authored
feat: add support for ECR credentials suffixed by account ID (#208)
* feat: add support for ECR credentials suffixed by account and region
Introduced an opt-in mechanism to use AWS credentials stored with account ID and region suffixes for ECR registries. This enhances flexibility, allowing users to specify credentials for multiple accounts and regions directly via environment variables. Updated documentation and added tests to validate the new functionality.
* chore: golangci-lint pass
* ci: add a [pre-commit-config.yaml] file
* feat: simplified the custom AWS credentials provider to only suffix with AccountID
* feat: enhance getRoleArn to support account-specific role ARNs
Refactored `getRoleArn` to accept an account parameter, enabling retrieval of account-specific role ARNs through suffixed environment variables. Added unit tests to verify expected behavior and prioritize suffixed variables over default ones. This change improves flexibility for multi-account setups.
* feat: add custom retryer to AWS SDK configuration
Configured the AWS SDK with a custom retryer to handle retries more effectively. This includes setting a maximum of 10 attempts and a maximum backoff delay of 30 seconds for improved resilience.
* feat: add debug mode control for diagnostic output
Introduce a new environment variable `DOCKER_CREDENTIAL_ENV_DEBUG` to control debug logging. This ensures diagnostic output is only printed if explicitly enabled, improving clarity and reducing unnecessary noise.
* docs: added docstrings to unexported funcs in `env.go`
* feat: simplify ECR token retrieval by removing unused hostname.
Refactored `getEcrToken` to exclude the unnecessary `hostname` parameter and updated relevant logic to focus on `account` and `region`. Improved error handling in `getRoleArn` and updated tests to reflect the changes. Updated README to remove mention of suffixed AWS credentials for ECR.
* feat: refactor getRoleArn to simplify error handling.
Removed unnecessary error handling in getRoleArn for cleaner code. Updated related logic and tests to reflect the changes, ensuring consistency and maintaining expected behavior.
* feat: refactor to replace `accountEnv` with `ecrContext`.
This change renames `accountEnv` to `ecrContext` to improve clarity and consistency in naming. It also updates related parameter structures and method calls, streamlining the handling of AWS credentials for ECR. Test cases and error messages1 parent b1ef599 commit a160096
File tree
7 files changed
+462
-42
lines changed7 files changed
+462
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | | - | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
24 | 38 | | |
25 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
26 | 42 | | |
27 | 43 | | |
28 | 44 | | |
| |||
41 | 57 | | |
42 | 58 | | |
43 | 59 | | |
44 | | - | |
| 60 | + | |
| 61 | + | |
45 | 62 | | |
46 | 63 | | |
47 | 64 | | |
| |||
72 | 89 | | |
73 | 90 | | |
74 | 91 | | |
75 | | - | |
| 92 | + | |
76 | 93 | | |
77 | 94 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
83 | 101 | | |
84 | 102 | | |
85 | 103 | | |
86 | 104 | | |
87 | 105 | | |
88 | 106 | | |
89 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
90 | 124 | | |
91 | 125 | | |
92 | 126 | | |
93 | 127 | | |
94 | 128 | | |
95 | 129 | | |
96 | 130 | | |
97 | | - | |
98 | 131 | | |
99 | 132 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
18 | | - | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | | - | |
22 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
23 | 29 | | |
24 | 30 | | |
25 | 31 | | |
| |||
28 | 34 | | |
29 | 35 | | |
30 | 36 | | |
| 37 | + | |
31 | 38 | | |
32 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
33 | 48 | | |
34 | 49 | | |
35 | 50 | | |
| |||
39 | 54 | | |
40 | 55 | | |
41 | 56 | | |
42 | | - | |
43 | | - | |
| 57 | + | |
| 58 | + | |
44 | 59 | | |
45 | 60 | | |
46 | 61 | | |
| |||
49 | 64 | | |
50 | 65 | | |
51 | 66 | | |
52 | | - | |
| 67 | + | |
53 | 68 | | |
54 | 69 | | |
55 | 70 | | |
| |||
59 | 74 | | |
60 | 75 | | |
61 | 76 | | |
62 | | - | |
| 77 | + | |
63 | 78 | | |
64 | 79 | | |
65 | 80 | | |
66 | 81 | | |
67 | | - | |
| 82 | + | |
68 | 83 | | |
69 | 84 | | |
70 | 85 | | |
| |||
80 | 95 | | |
81 | 96 | | |
82 | 97 | | |
83 | | - | |
84 | | - | |
85 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
86 | 105 | | |
87 | 106 | | |
88 | 107 | | |
89 | 108 | | |
90 | 109 | | |
91 | 110 | | |
92 | | - | |
| 111 | + | |
93 | 112 | | |
94 | 113 | | |
95 | 114 | | |
| |||
98 | 117 | | |
99 | 118 | | |
100 | 119 | | |
| 120 | + | |
101 | 121 | | |
102 | 122 | | |
103 | 123 | | |
| |||
110 | 130 | | |
111 | 131 | | |
112 | 132 | | |
| 133 | + | |
| 134 | + | |
113 | 135 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
| 136 | + | |
119 | 137 | | |
120 | 138 | | |
121 | 139 | | |
| |||
124 | 142 | | |
125 | 143 | | |
126 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
127 | 148 | | |
128 | 149 | | |
129 | 150 | | |
| |||
140 | 161 | | |
141 | 162 | | |
142 | 163 | | |
143 | | - | |
144 | | - | |
145 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
146 | 200 | | |
147 | 201 | | |
148 | 202 | | |
149 | 203 | | |
150 | | - | |
| 204 | + | |
| 205 | + | |
151 | 206 | | |
152 | 207 | | |
153 | 208 | | |
| |||
160 | 215 | | |
161 | 216 | | |
162 | 217 | | |
163 | | - | |
164 | | - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
165 | 230 | | |
166 | 231 | | |
167 | 232 | | |
168 | 233 | | |
169 | 234 | | |
170 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
171 | 241 | | |
172 | 242 | | |
173 | 243 | | |
174 | 244 | | |
175 | 245 | | |
176 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
177 | 267 | | |
178 | 268 | | |
179 | 269 | | |
| |||
0 commit comments