Before opening, please confirm:
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
14.16.1
Amplify CLI Version
5.0.1
What operating system are you using?
Ubuntu
Amplify Categories
Not applicable
Amplify Commands
Not applicable
Describe the bug
- I have multiple apps configured in a monorepo.
- I have each of these apps staged with an environment connected to our
master branch
- I have preview enabled on each of the apps, targeting the
master branch
- I do not yet have an
amplify.yml in the master branch
- Within my pull request I have added the
amplify.yml to the root of the repository
- Each preview build fails to find the
amplify.yml that is included in the pull request
Expected behavior
The monorepo configuration will read the /amplify.yml within the pull request and apply it to the preview build
Reproduction steps
- Create a new monorepo repository
- Add multiple applications into the monorepo
- Use terraform to create the Amplify applications, branch per app, backend environment per branch, domain association per branch, enable previews on the branch
- Create a new branch to adds amplify to each of the applications
- Use amplify cli to initialize the applications by passing the appId along with the typical initialization parameters
- Commit the changes
- Open a pull request to the branch that has previews enabled
GraphQL schema(s)
n/a
Log output
AppId: d3127if6i267u2
2021-06-24T02:40:22.407Z [INFO]: Git SSH Key acquired
2021-06-24T02:40:22.485Z [INFO]: # Cloning repository: git@github.com:quantum-sec/platform.git
2021-06-24T02:40:22.528Z [INFO]: Agent pid 132
2021-06-24T02:40:22.553Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
2021-06-24T02:40:22.754Z [INFO]: Cloning into 'platform'...
2021-06-24T02:40:23.735Z [INFO]: Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.
2021-06-24T02:40:27.642Z [WARNING]: !Error: ENOENT: no such file or directory, open '/codebuild/output/src673194686/src/platform/amplify.yml'
2021-06-24T02:40:27.645Z [INFO]: Agent pid 145
2021-06-24T02:40:27.649Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
2021-06-24T02:40:27.732Z [INFO]: # Retrieving environment cache...
2021-06-24T02:40:27.775Z [INFO]: # Retrieved environment cache
2021-06-24T02:40:27.775Z [WARNING]: !Cannot read property 'split' of undefined
2021-06-24T02:40:27.786Z [ERROR]: !!!Monorepo spec provided without "applications" key
2021-06-24T02:40:27.786Z [INFO]: # Starting environment caching...
2021-06-24T02:40:27.786Z [INFO]: # Environment caching completed
Terminating logging...
AppId: d3jyfteqrhguhk
2021-06-24T02:40:26.048Z [INFO]: Git SSH Key acquired
2021-06-24T02:40:26.123Z [INFO]: # Cloning repository: git@github.com:quantum-sec/platform.git
2021-06-24T02:40:26.157Z [INFO]: Agent pid 134
2021-06-24T02:40:26.192Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
2021-06-24T02:40:26.460Z [INFO]: Cloning into 'platform'...
2021-06-24T02:40:27.447Z [INFO]: Warning: Permanently added the RSA host key for IP address '13.229.188.59' to the list of known hosts.
2021-06-24T02:40:31.115Z [WARNING]: !Error: ENOENT: no such file or directory, open '/codebuild/output/src149936278/src/platform/amplify.yml'
2021-06-24T02:40:31.118Z [INFO]: Agent pid 147
2021-06-24T02:40:31.122Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
2021-06-24T02:40:31.234Z [INFO]: # Retrieving environment cache...
2021-06-24T02:40:31.274Z [INFO]: # Retrieved environment cache
2021-06-24T02:40:31.275Z [WARNING]: !Cannot read property 'split' of undefined
2021-06-24T02:40:31.283Z [ERROR]: !!!Monorepo spec provided without "applications" key
2021-06-24T02:40:31.284Z [INFO]: # Starting environment caching...
2021-06-24T02:40:31.284Z [INFO]: # Environment caching completed
Terminating logging...
AppId: d1d91c9119qjjz
2021-06-24T02:40:18.197Z [INFO]: Git SSH Key acquired
2021-06-24T02:40:18.269Z [INFO]: # Cloning repository: git@github.com:quantum-sec/platform.git
2021-06-24T02:40:18.303Z [INFO]: Agent pid 131
2021-06-24T02:40:18.329Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
2021-06-24T02:40:18.572Z [INFO]: Cloning into 'platform'...
2021-06-24T02:40:19.530Z [INFO]: Warning: Permanently added the RSA host key for IP address '13.229.188.59' to the list of known hosts.
2021-06-24T02:40:23.378Z [WARNING]: !Error: ENOENT: no such file or directory, open '/codebuild/output/src345629935/src/platform/amplify.yml'
2021-06-24T02:40:23.382Z [INFO]: Agent pid 144
2021-06-24T02:40:23.385Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
2021-06-24T02:40:23.467Z [INFO]: # Retrieving environment cache...
2021-06-24T02:40:23.500Z [INFO]: # Retrieved environment cache
2021-06-24T02:40:23.500Z [WARNING]: !Cannot read property 'split' of undefined
2021-06-24T02:40:23.510Z [ERROR]: !!!Monorepo spec provided without "applications" key
2021-06-24T02:40:23.510Z [INFO]: # Starting environment caching...
2021-06-24T02:40:23.511Z [INFO]: # Environment caching completed
Terminating logging...
Additional information
| region |
appId |
| ap-southeast-1 |
d3127if6i267u2 |
| ap-southeast-1 |
d3jyfteqrhguhk |
| ap-southeast-1 |
d1d91c9119qjjz |
No amplify.yml in the target branch. This is the initial deployment and we would like to validate the previews are working as expected with the ability to update amplify.yml in the pull request, prior to being merged.
The following amplify.yml is being added in the pull request where the preview build fails. Application names have been changed to example, otherwise each appRoot matches the AMPLIFY_MONOREPO_APP_ROOT that is set in each of the amplify apps.
/amplify.yml
version: 1
applications:
- appRoot: apps/ngx-example1
backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- '# everything should be performed from the base of the monorepo'
- cd ../../
- npm config set cache --global .npm
- bash .tools/build/update-nvm.sh
- nvm exec npm ci
build:
commands:
- nvm exec npm run build:prod --workspace apps/ngx-example1
artifacts:
baseDirectory: ../../dist/apps/ngx-example1/
files:
- '**/*'
cache:
paths:
- .npm
test:
phases:
preTest:
commands:
- cd ../../
- npm config set cache --global .npm
- bash .tools/build/update-nvm.sh || true
- nvm exec npm ci
test:
commands:
- nvm exec npx --yes --package='nx@^12.4.0' -- nx run ngx-example1-e2e:e2e
postTest:
commands:
- nvm exec npx --yes --package='mochawesome-merge@^4.2.0' -- mochawesome-merge -o dist/cypress/apps/ngx-example1-e2e/mochawesome-report/mochawesome.json dist/cypress/apps/ngx-example1-e2e/mochawesome-report/mochawesome*.json
artifacts:
baseDirectory: ../../dist/cypress/apps/ngx-example1-e2e
configFilePath: '**/mochawesome.json'
files:
- '**/*.png'
- '**/*.mp4'
- '**/*.html'
- appRoot: apps/ngx-example2
backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- '# everything should be performed from the base of the monorepo'
- cd ../../
- npm config set cache --global .npm
- bash .tools/build/update-nvm.sh
- nvm exec npm ci
build:
commands:
- nvm exec npm run build:prod --workspace apps/ngx-example2
artifacts:
baseDirectory: ../../dist/apps/ngx-example2/
files:
- '**/*'
cache:
paths:
- .npm
test:
phases:
preTest:
commands:
- cd ../../
- npm config set cache --global .npm
- bash .tools/build/update-nvm.sh || true
- nvm exec npm ci
test:
commands:
- nvm exec npx --yes --package='nx@^12.4.0' -- nx run ngx-example2-e2e:e2e
postTest:
commands:
- nvm exec npx --yes --package='mochawesome-merge@^4.2.0' -- mochawesome-merge -o dist/cypress/apps/ngx-example2-e2e/mochawesome-report/mochawesome.json dist/cypress/apps/ngx-example2-e2e/mochawesome-report/mochawesome*.json
artifacts:
baseDirectory: ../../dist/cypress/apps/ngx-example2-e2e
configFilePath: '**/mochawesome.json'
files:
- '**/*.png'
- '**/*.mp4'
- '**/*.html'
- appRoot: apps/ngx-example3
backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- '# everything should be performed from the base of the monorepo'
- cd ../../
- npm config set cache --global .npm
- bash .tools/build/update-nvm.sh
- nvm exec npm ci
build:
commands:
- nvm exec npm run build:prod --workspace apps/ngx-example3
artifacts:
baseDirectory: ../../dist/apps/ngx-example3/
files:
- '**/*'
cache:
paths:
- .npm
test:
phases:
preTest:
commands:
- cd ../../
- npm config set cache --global .npm
- bash .tools/build/update-nvm.sh || true
- nvm exec npm ci
test:
commands:
- nvm exec npx --yes --package='nx@^12.4.0' -- nx run ngx-example3-e2e:e2e
postTest:
commands:
- nvm exec npx --yes --package='mochawesome-merge@^4.2.0' -- mochawesome-merge -o dist/cypress/apps/ngx-example3-e2e/mochawesome-report/mochawesome.json dist/cypress/apps/ngx-example3-e2e/mochawesome-report/mochawesome*.json
artifacts:
baseDirectory: ../../dist/cypress/apps/ngx-example3-e2e
configFilePath: '**/mochawesome.json'
files:
- '**/*.png'
- '**/*.mp4'
- '**/*.html'
Before opening, please confirm:
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
14.16.1
Amplify CLI Version
5.0.1
What operating system are you using?
Ubuntu
Amplify Categories
Not applicable
Amplify Commands
Not applicable
Describe the bug
masterbranchmasterbranchamplify.ymlin themasterbranchamplify.ymlto the root of the repositoryamplify.ymlthat is included in the pull requestExpected behavior
The monorepo configuration will read the
/amplify.ymlwithin the pull request and apply it to the preview buildReproduction steps
GraphQL schema(s)
n/a
Log output
AppId:
d3127if6i267u2AppId:
d3jyfteqrhguhkAppId:
d1d91c9119qjjzAdditional information
No
amplify.ymlin the target branch. This is the initial deployment and we would like to validate the previews are working as expected with the ability to updateamplify.ymlin the pull request, prior to being merged.The following
amplify.ymlis being added in the pull request where the preview build fails. Application names have been changed to example, otherwise eachappRootmatches theAMPLIFY_MONOREPO_APP_ROOTthat is set in each of the amplify apps./amplify.yml