(pipelines): custom step in Java
See original GitHub issueCreating a custom step in the new CDK pipelines API in Java throws a JSIIException
Reproduction Steps
Follow the recommended guidelines for implementing a custom step using the new API: https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/pipelines/README.md#arbitrary-codepipeline-actions
public class LambdaStep extends Step implements ICodePipelineActionFactory {
Function fn;
public ExecEc2ImagePipelineLambdaStep(Construct scope, @NotNull String id) {
super(id);
String fnCode = "exports.handler = async (event) => {console.log('event: ', event)}";
this.fn = Function.Builder.create(this, "Fn")
.runtime(Runtime.NODEJS_14_X)
.handler("index.handler")
.code(Code.fromInline(fnCode).build()
}
@Override
public @NotNull CodePipelineActionFactoryResult produceAction(@NotNull IStage iStage, @NotNull ProduceActionOptions produceActionOptions) {
iStage.addAction(new LambdaInvokeAction(
LambdaInvokeActionProps.builder()
.lambda(this.fn)
.build()));
return CodePipelineActionFactoryResult.builder().runOrdersConsumed(1).build();
}
}
What did you expect to happen?
cdk synth
was successful
What actually happened?
Caused by: software.amazon.jsii.JsiiException: Cannot construct instance of `software.amazon.awscdk.pipelines.ProduceActionOptions` (no Creators, like default constructor, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
at [Source: UNKNOWN; line: -1, column: -1]
Environment
- CDK CLI Version : 1.115.0
- Framework Version:
- Node.js Version: 16 LTS
- OS : Linux Mint
- Language (Version): Java 8
Other
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Pipelines: Configuring the custom step - Bosch IoT Insights
The custom code of your custom step can be either Java 17 or Python 3.9.1. This chapter provides a code example for each...
Read more >Pipeline design pattern implementation - java - Stack Overflow
This way, all of the specific step knowledge is encapsulated in the Pipeline class. In this case, the execute method can perform a...
Read more >Building and deploying applications with pipelines - IBM
This guide will walk you through the steps needed to run a pipeline to build your application, publish the image to a registry,...
Read more >Build a Continuous Deployment Pipeline in Java with Travis CI
In this tutorial you'll start with the basics, learning about CI/CD and the benefits. Then you'll dive into the practical part of the...
Read more >Build Java apps - Azure Pipelines | Microsoft Learn
Go to Pipelines, and then select New pipeline. Perform the steps of the wizard by first selecting GitHub as the location of your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @ryparker I’d be happy to take a look at it over the weekend.
Reasonably comfortable with both languages though not so much with JSII architecture. The actual exception message is from Jackson.
I’ve located the serialization code here for the Java runtime so maybe a good starting point!
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.