-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(codebuild): added validation when using Windows Image #27946
chore(codebuild): added validation when using Windows Image #27946
Conversation
@@ -1965,6 +1965,8 @@ export class WindowsBuildImage implements IBuildImage { | |||
/** | |||
* The standard CodeBuild image `aws/codebuild/windows-base:2.0`, which is | |||
* based off Windows Server Core 2016. | |||
* | |||
* @deprecated `WindowsBuildImage.WIN_SERVER_CORE_2019_BASE_2_0` should be used instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added @deprecated
to WINDOWS_BASE_2_0
.
Since WINDOWS_CONTAINER
type is already deprecated, a new deployment of WINDOWS_BASE_2_0
will result in the following error.
The environment type WINDOWS_CONTAINER is deprecated for new projects or existing project environment updates. Please consider using Windows Server 2019 instead.
I could not find any mention of deprecation in the documentation, but Terraform has already deprecated it.
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/codebuild_project#environment
This is not the main topic of this PR, so if it should be a separate PR, I will do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 👍
Just a small adjustment in my opinion.
Also, the deprecation message for WIN_SERVER_CORE_2016_BASE should be updated as well.
if (buildEnvironment.computeType === ComputeType.SMALL) { | ||
ret.push('Windows images do not support the Small ComputeType'); | ||
} | ||
if (buildEnvironment.computeType === ComputeType.X2_LARGE) { | ||
ret.push('Windows images do not support the 2xLarge ComputeType'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (buildEnvironment.computeType === ComputeType.SMALL) { | |
ret.push('Windows images do not support the Small ComputeType'); | |
} | |
if (buildEnvironment.computeType === ComputeType.X2_LARGE) { | |
ret.push('Windows images do not support the 2xLarge ComputeType'); | |
} | |
if (buildEnvironment.computeType === ComputeType.SMALL || buildEnvironment.computeType === ComputeType.X2_LARGE) { | |
ret.push(`Windows images do not support the '${buildEnvironment.computeType}' compute type`); | |
} |
A bit cleaner.
@lpizzinidev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, this is great! Thank you for your contribution.
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
@Mergifyio update |
✅ Branch has been successfully updated |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
When using `WINDOWS_SERVER_2019_CONTAINER`, only MEDIUM and LARGE computeType is supported. https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html However, currently only ComputeType `SMALL` is validated. This PR modified to generate an error when ComputeType is specified as X2_LARGE in WindowsBuildImage. ```ts new codebuild.Project(this, 'CodeBuildCdk', { source: codebuild.Source.codeCommit({ repository: codecommit.Repository.fromRepositoryName(this, "Repo", "sample") }), environment: { computeType: codebuild.ComputeType.X2_LARGE, // generate error in synth stage buildImage: codebuild.WindowsBuildImage.WINDOWS_BASE_2_0 } }); ``` ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
When using
WINDOWS_SERVER_2019_CONTAINER
, only MEDIUM and LARGE computeType is supported.https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html
However, currently only ComputeType
SMALL
is validated.This PR modified to generate an error when ComputeType is specified as X2_LARGE in WindowsBuildImage.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license