aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
461 stars 116 forks source link

Command hook for frontend SSG deployments #3914

Open ramkumarHFN opened 8 months ago

ramkumarHFN commented 8 months ago

Before opening, please confirm:

Amplify Hosting feature

Build settings, Frontend builds

Is your feature request related to a problem? Please describe:

I am having a use-case of developing several NextJS applications (SSG) and deploying them to AWS Amplify. I am using AWS amplify hosting, where directly linking each GitHub repository to amplify apps. And configuring YAML file for frontend deployment. All applications are deployed and working fine.

Problem statement: Now I need to setup a quality gate in the deployment process, Where I have to check certain parameters (Package version of few NPM modules) before deployment.

I am trying to implement this with command hooks. Officially its mentioned pre and post push hooks will get triggered by default in amplify hosting.

I have added amplify/hooks folder.

When I tried to trigger a build, these hook scripts are not getting executed. Is it applicable only for backend execution?

Is there any other better way to handle this use-case with AWS amplify CICD for SSG deployments?

Describe how you'd like this feature to work

Currently I am trying with cURL to pass the data to an API.

version: 1 frontend: phases: preBuild: commands:

But receiving an error as

[ERROR]: !!! CustomerError: The commands provided in the buildspec are malformed. Please ensure that you have properly escaped reserved YAML characters. If you have a ':' character in your command, encapsulate the command within quotes.

But while executing the same buildspec without assigning the curl response to a variable its executing properly.

Is there any easy way to post required info to external APIs via hooks in frontend deployment.

github-actions[bot] commented 8 months ago

This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!