()
| 181 | } |
| 182 | |
| 183 | async function createProjectInUserAccount() { |
| 184 | using codebuild = disposable( |
| 185 | () => new CodeBuildClient(sdkConfig), |
| 186 | (client) => client.destroy(), |
| 187 | ); |
| 188 | try { |
| 189 | const ret = await codebuild.send( |
| 190 | new CreateProjectCommand({ |
| 191 | name: projectName, |
| 192 | serviceRole: roleArn, |
| 193 | source: { |
| 194 | type: "NO_SOURCE", |
| 195 | buildspec: [ |
| 196 | "version: 0.2", |
| 197 | "phases:", |
| 198 | " build:", |
| 199 | " commands:", |
| 200 | " - curl -fsSL https://ion.sst.dev/install | bash", |
| 201 | ].join("\n"), |
| 202 | }, |
| 203 | artifacts: { type: "NO_ARTIFACTS" }, |
| 204 | environment: { |
| 205 | computeType: { |
| 206 | small: "BUILD_GENERAL1_SMALL" as const, |
| 207 | medium: "BUILD_GENERAL1_MEDIUM" as const, |
| 208 | large: "BUILD_GENERAL1_LARGE" as const, |
| 209 | xlarge: "BUILD_GENERAL1_XLARGE" as const, |
| 210 | "2xlarge": "BUILD_GENERAL1_2XLARGE" as const, |
| 211 | }[compute] as ComputeType, |
| 212 | image, |
| 213 | type: |
| 214 | architecture === "x86_64" |
| 215 | ? "LINUX_CONTAINER" |
| 216 | : "ARM_CONTAINER", |
| 217 | privilegedMode: true, |
| 218 | }, |
| 219 | vpcConfig: vpc && { |
| 220 | vpcId: vpc.id, |
| 221 | subnets: vpc.subnets, |
| 222 | securityGroupIds: vpc.securityGroups, |
| 223 | }, |
| 224 | timeoutInMinutes: 60, |
| 225 | logsConfig: { |
| 226 | cloudWatchLogs: { |
| 227 | status: "ENABLED", |
| 228 | }, |
| 229 | }, |
| 230 | cache: { type: "NO_CACHE" }, |
| 231 | }), |
| 232 | ); |
| 233 | return ret.project?.arn!; |
| 234 | } catch (e: any) { |
| 235 | if ( |
| 236 | e.name === "InvalidInputException" && |
| 237 | e.message === `Region ${region} is not supported for ARM_CONTAINER` |
| 238 | ) |
| 239 | throw new Error( |
| 240 | `AWS CodeBuild does not support ARM architecture in ${region} region`, |
no test coverage detected