Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

fix(java): fixed sample code and created CI job to validate #264

Merged
merged 2 commits into from
Sep 11, 2021

Conversation

ryparker
Copy link
Contributor

@ryparker ryparker commented Aug 12, 2021

Summary

This PR implements CI workflows that verify changes do not break builds.

  • Fix Java sample code so that it works with cdk synth
  • GitHub Workflows that synths the Java sample code
  • Update Java workshop instructions to reflect the fixes I was required to implement

Fixes #259, #189, #152


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@mergify
Copy link
Contributor

mergify bot commented Aug 12, 2021

"### Pull Request Checklist * [ ] Testing - Unit test added (prefer not to modify an existing test, otherwise, it's probably a breaking change) * [ ] Title and Description - Change type: title prefixed with fix, feat and module name in parens, which will appear in changelog - Title: use lower-case and doesn't end with a period - Breaking?: last paragraph: 'BREAKING CHANGE: <describe what changed + link for details>' - Issues: Indicate issues fixed via: 'Fixes #xxx' or 'Closes #xxx'"

@mergify
Copy link
Contributor

mergify bot commented Aug 12, 2021

Title does not follow the guidelines of Conventional Commits. Please adjust title before merge.

@ryparker ryparker changed the title fix(java) fixed sample code and created CI job to validate fix(java): fixed sample code and created CI job to validate Aug 13, 2021
@ryparker ryparker self-assigned this Aug 13, 2021

import software.amazon.awscdk.services.codepipeline.actions.CodeCommitSourceAction;

public class WorkshopPipelineStack extends Stack {
Copy link
Contributor Author

@ryparker ryparker Aug 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Java would throw an error if the class did not match the filename. To resolve this I renamed the class to PipelineStack.


public final CfnOutput hcViewerUrl;
public final CfnOutput hcEndpoint;

public WorkshopPipelineStage(final Construct scope, final String id) {
Copy link
Contributor Author

@ryparker ryparker Aug 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as PipelineStack. The class must match the file name.

deployStage.addActions(ShellScriptAction.Builder.create()
.actionName("TestViewerEndpoint")
.useOutputs(Map.of("ENDPOINT_URL", deploy.hcViewerUrl))
.commands(List.of("curl -Ssf $ENDPOINT_URL"))
Copy link
Contributor Author

@ryparker ryparker Aug 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Map.of and List.of are not supported in Java 8 which is the minimum Java version we support.

To fix this I replaced..

  • Map.of with final Map<String, StackOutput> TestViewerEndpointOutputs = new HashMap
  • List.of with Arrays.asList

There was also an existing type error that was being thrown on the useOutputs() param. To fix this I replaced deploy.hcEndpoint with pipeline.stackOutput(deploy.hcEndpoint) to get the appropriate type object that is expected in useOutputs().

@ryparker ryparker merged commit 5871bd3 into master Sep 11, 2021
@ryparker ryparker deleted the java-fixes-and-ci branch September 11, 2021 00:39
@ryparker ryparker added the contribution/core This is a PR that came from AWS. label Sep 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement build, synth, and test checks in CI Java Workshop: Construct example not working DynamoTableViewer requires update
2 participants