-
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
CodeBuild buildspec should support YAML FileAsset and project file name #1138
Comments
I think the issue not that you can't use JSON, because YAML is a superset of JSON, but because I'll rename this issue to add support for assets, as it seems like a useful feature. We will probably end up with something like something like buildspec: codebuild.BuildSpec.asset('path/to/asset')
// or
buildspec: codebuild.BuildSpec.inline({
<strong-typed-schema>
})
// or (this is also supported today by CFN):
buildspec: codebuild.BuildSpec.projectFile('my-buildspec.yaml') |
this would be a good feature |
Please reopen if this is still desirable |
I still think this is useful and couldn't find any solution to easily use an asset as CodeBuild buildspec. Did I overlook something? Or is it just not possible? How am I supposed to put buildspecs in a CDK library? |
@jostick you're right - we had that functionality before, but we removed it. Can you describe your use case for this? I'll be re-opening the issue either way. Thanks, |
We are using CDK to provide resources and build steps common in all our CodePipeline projects, e.g. cloning code from a version control system (no CodeCommit unfortunately). Cloning the repository is implemented using CodeBuild. It would be nice if it would be possible to include the buildspec for this step as an asset in the library. There are other shared build steps (like self-updating the pipeline) that would also be easier if the buildspec could be provide das FileAsset. Our current workaround is parse the buildspec.yml and then inline it with |
That's helpful, thanks @jostick ! |
This is what I need, currently trying to work with cdk and one of the problems I have now is using inline buildspecs. |
True, I also need this feature. |
I have a buildspec YAML file that I just what to inline into the CDK .NET generated stacks at synth time. What I am looking for but not finding in BuildSpec is The closest I found is Is there a supporting .NET library people use that can parse/deserialize YAML files into this (We need to inline the buildspec because CodeBuild doesn't support the buildspec being in a secondary git source, so @markreyndev in #17178 had a similar request to have a better wait to create an inline BuildSpec than having to transform YAML to IDictionary<String, Object> but the discussion only address specifying a file in Git source, with doesn't allow my use case for loading a file from CDK project to inline in stack. |
@whereisaaron I believe what you want is to read the file with a YAML parser, get it in the form of a bunch of nested Dictionaries, and then use |
Thanks @skinny85, that would be a workaround, but I don't think that - ideally - CDK users should have to do all that? The canonical type of a CodeBuild buildspec is YAML. CDK should support YAML for both in-source file and inline. The different language versions of CDK have different, loosely typed, internal representations whether And since I haven't rocked up with a pull request, I'll do the workaround 😄 |
Implementing something like that would require deep changes in JSII, the technology CDK uses for multi-language support - it's definitely not just a simple PR. So, I would suggest going with the workaround for now 😉. |
See #17178 for pipelines use-case. |
Adds `fromAsset` to the `BuildSpec` class to allow referencing local files as a project's buildspec. Uploads the file to s3 and references the object arn in the `buildSpec` property of `Codebuild.Project`. `isImmediate` is true for AssetBuildSpec because it's actual meaning is not can be defined at synth time, but it exsists somewhere other than the project's source code, which in this case is true. Requires referencing of the project so adds `scope` as an optional parameter to `toBuildSpec` method. fixes: #1138
Adds `fromAsset` to the `BuildSpec` class to allow referencing local files as a project's buildspec. Uploads the file to s3 and references the object arn in the `buildSpec` property of `Codebuild.Project`. `isImmediate` is true for AssetBuildSpec because it's actual meaning is not can be defined at synth time, but it exsists somewhere other than the project's source code, which in this case is true. Requires referencing of the project so adds `scope` as an optional parameter to `toBuildSpec` method. fixes: #1138
Adds `fromAsset` to the `BuildSpec` class to allow referencing local files as a project's buildspec. Uploads the file to s3 and references the object arn in the `buildSpec` property of `Codebuild.Project`. `isImmediate` is true for AssetBuildSpec because it's actual meaning is not can be defined at synth time, but it exsists somewhere other than the project's source code, which in this case is true. Requires referencing of the project so adds `scope` as an optional parameter to `toBuildSpec` method. fixes: #1138
Adds `fromAsset` to the `BuildSpec` class to allow referencing local files as a project's buildspec. Uploads the file to s3 and references the object arn in the `buildSpec` property of `Codebuild.Project`. `isImmediate` is true for AssetBuildSpec because it's actual meaning is not can be defined at synth time, but it exsists somewhere other than the project's source code, which in this case is true. Requires referencing of the project so adds `scope` as an optional parameter to `toBuildSpec` method. fixes: #1138
Adds `fromAsset` to the `BuildSpec` class to allow referencing local files as a project's buildspec. Uploads the file to s3 and references the object arn in the `buildSpec` property of `Codebuild.Project`. `isImmediate` is true for AssetBuildSpec because it's actual meaning is not can be defined at synth time, but it exsists somewhere other than the project's source code, which in this case is true. Requires referencing of the project so adds `scope` as an optional parameter to `toBuildSpec` method. fixes: #1138 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Adds `fromAsset` to the `BuildSpec` class to allow referencing local files as a project's buildspec. Uploads the file to s3 and references the object arn in the `buildSpec` property of `Codebuild.Project`. `isImmediate` is true for AssetBuildSpec because it's actual meaning is not can be defined at synth time, but it exsists somewhere other than the project's source code, which in this case is true. Requires referencing of the project so adds `scope` as an optional parameter to `toBuildSpec` method. fixes: #1138 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Adds `fromAsset` to the `BuildSpec` class to allow referencing local files as a project's buildspec. Uploads the file to s3 and references the object arn in the `buildSpec` property of `Codebuild.Project`. `isImmediate` is true for AssetBuildSpec because it's actual meaning is not can be defined at synth time, but it exsists somewhere other than the project's source code, which in this case is true. Requires referencing of the project so adds `scope` as an optional parameter to `toBuildSpec` method. fixes: aws#1138 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Adds `fromAsset` to the `BuildSpec` class to allow referencing local files as a project's buildspec. Uploads the file to s3 and references the object arn in the `buildSpec` property of `Codebuild.Project`. `isImmediate` is true for AssetBuildSpec because it's actual meaning is not can be defined at synth time, but it exsists somewhere other than the project's source code, which in this case is true. Requires referencing of the project so adds `scope` as an optional parameter to `toBuildSpec` method. fixes: aws#1138 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Adds `fromAsset` to the `BuildSpec` class to allow referencing local files as a project's buildspec. Uploads the file to s3 and references the object arn in the `buildSpec` property of `Codebuild.Project`. `isImmediate` is true for AssetBuildSpec because it's actual meaning is not can be defined at synth time, but it exsists somewhere other than the project's source code, which in this case is true. Requires referencing of the project so adds `scope` as an optional parameter to `toBuildSpec` method. fixes: aws#1138 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
A CodeBuild project currently calls JSON.stringify on the contents of a FileAsset to make CodeBuild recognize the buildspec as inline. However, CodeBuild uses YAML files exclusively in the documentation. Attempting to use JSON also does not work.
The text was updated successfully, but these errors were encountered: