aws-amplify / aws-amplify/amplify-hosting

No way to pass parameters to pre-push hook with `amplifyPush --simple`

Open
#3,130 0 comments 0 reactions 0 assignees View on GitHub
bug pending-triage
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Before opening, please confirm:

- [X] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-hosting/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-hosting/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-hosting/blob/master/CONTRIBUTING.md).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.

### App Id

d1vom4s7fiombe

### AWS Region

us-west-2

### Amplify Hosting feature

Backend builds

### Describe the bug

Main Problem: There is no way to pass variables to the pre-push hook in CI/CD if using `amplifyPush --simple`

Subproblem: [amplifyPush](https://github.com/aws-amplify/amplify-hosting/blob/main/scripts/amplifyPush.sh) is now marked as deprecated. Some command also called "amplifyPush" is still used in the default `amplify.yml` generated for new amplify projects and recommended [here](https://github.com/aws-amplify/amplify-hosting/blob/main/scripts/README.md). Previously I'm pretty sure these two functions were the same. Now, they are seemingly decoupled, which means that the hosting version of `amplifyPush` is opaque (AFAICT).

Details:
- For a long time, pre-push hooks were not correctly executed from the version-controlled hook versions in amplify hosting. See e.g. https://github.com/aws-amplify/amplify-hosting/issues/2624 and https://github.com/aws-amplify/amplify-cli/issues/10253
- Even after these were resolved and we deleted the hooks from our s3 deployment bucket, hooks did not execute on our side.
- Something seems to have changed in the last week or so such that our pre-push hook now executes when CI/CD backend builds are triggered (great!)
- But, this means we need to provide some information (ex: override flags) to these hooks in the ci/cd environment.
- Our amplify.yml file uses `amplifyPush --simple` as recommended.

We need a way to configure this hook in our CI/CD runs. We would be happy with either
`amplifyPush --simple -- --ourCustomFlag=value`
or
`OUR_CUSTOM_FLAG="value" amplifyPush --simple'

... but neither of these work in `amplify.yml`

Note that plain old `amplify push` supports the former i.e. `amplify push --ourCustomFlag=value` works. Could something like this be supported for `amplifyPush`?

### Expected behavior

`amplifyPush [--simple]` supports some custom information forwarding to amplify push, somehow.

### Reproduction steps

simply try to run `amplifyPush --simple` either with an altered environment or additional arguments. Add a hook that dumps `parameters.data` and `process.env` (for node js hooks). Note that the information doesn't make it to the hook.

If you repeat this with plain old `amplify push`, you'll notice that at least the additional arguments are forwarded.

### Build Settings

_No response_

### Log output

```
# Put your logs below this line

```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with scripts/amplifyPush.sh and the scripts README, then compare their documented behavior with the amplify.yml invocation using amplifyPush --simple. Reproduce the hook run with forwarded arguments and environment variables, and consider the work complete when custom information reaches the pre-push hook through a documented supported form.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, shell
Domain
ci-cd, cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.