Skip to content
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

feat: handle default and supported values for building in source per workflow #418

Merged

Conversation

torresxb1
Copy link
Contributor

@torresxb1 torresxb1 commented Dec 20, 2022

Issue #, if available:

Description of changes:
Building in source

  • handles default values for each workflow
  • handles supported values for each workflow
  • ensures each workflow should define its own defaults and supported values
  • error handling if the passed-in value is not supported by the workflow

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

Comment on lines -47 to -50
# Don't build in source by default (backwards compatibility)
if build_in_source is None:
build_in_source = False

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I recently added this in a previous PR to handle build-in-source defaults for custom makefile, but it's not needed anymore with the new class constant logic (BUILD_IN_SOURCE_BY_DEFAULT)

else:
error_reason = "Unsupported value for build_in_source"

raise WorkflowFailedError(workflow_name=self.NAME, action_name=None, reason=error_reason)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm actually we might not want to fail. I might speak with UX about this but I think I'll change this to show a warning/log and use the default value for the workflow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For context: one of the reasons we might not want this to fail is that the --in-source flag is applied to all functions and layers of a project for now. If there's one function/layer that doesn't support building in source, this would fail the whole build. If it just raised a warning and used the default value, users would still be able to build (although there might be less visibility into the warning message vs. an error message)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

update: confirmed this with PM and changed logic to show warning LOG instead of erroring out.

This is what it would look like if custom make didn't support building in source:
Screen Shot 2022-12-21 at 1 55 11 PM

aws_lambda_builders/workflow.py Outdated Show resolved Hide resolved
aws_lambda_builders/workflow.py Outdated Show resolved Hide resolved
aws_lambda_builders/workflow.py Outdated Show resolved Hide resolved
aws_lambda_builders/workflow.py Outdated Show resolved Hide resolved
Copy link
Contributor

@sriram-mv sriram-mv left a comment

Choose a reason for hiding this comment

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

Not blocking, but will leave my comments in there on same code path being executed on if and elif. There could be ways in which we make that cleaner.

@torresxb1 torresxb1 enabled auto-merge (squash) January 5, 2023 20:16
@torresxb1 torresxb1 merged commit 75927e3 into aws:develop Jan 5, 2023
@torresxb1 torresxb1 deleted the build-in-source-defaults-and-support branch January 5, 2023 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants