Comments (10)
@s1mrankaur Is that for the entire pipeline or just the deploy stage?
You can try and assign more CPU/Memory to the CodeBuild job: https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html
from aws-simple-cicd.
@srijitm Deploy stage: The command I am running is:
cdk deploy --all --profile profile-name
from aws-simple-cicd.
Remove the --all and include only the stack you want to deploy.
from aws-simple-cicd.
@srijitm Is there a way for it to automatically detect what stack should be deployed?
from aws-simple-cicd.
No.
Cloudformation (and therefore CDK) only pushes the changes anyways. However, it may take some time for it to do the diff.
from aws-simple-cicd.
That explains it. Thank you
from aws-simple-cicd.
Also, I have a question related to issue #61 . Does npm install command need to be run in all the scripts i.e build.sh, deploy.sh and test.sh ? lerna run commands seem to be running okay in build.sh where the npm install command runs but throws MODULE_NOT_FOUND errr in deploy.sh and test.sh @srijitm
from aws-simple-cicd.
You should take a look and see if everything is being packaged correctly (can probably run the ls -al
command to check). Also take a look at how lerna includes the node_modules (whether they are symlinks, relative links etc). Fully qualified symlinks will likely not work because the CODEBUILD_SRC_DIR changes between the stages. Running npm install
might be the easiest thing to do but that will increase execution time.
from aws-simple-cicd.
@srijitm lerna created symlinks but I tried adding npm install in each of the 3 shell scripts i.e test.sh, build.sh and deploy.sh but still am getting the error in test.sh and deploy.sh
I did run npm install
in test.sh as well,
but it still failed. while the same command runs just fine in build.sh
So here's what my build.sh looks like:
#! /bin/bash
set -e
set -u
set -o pipefail
echo "Building services..................!"
npm install
npm run test
echo "Build completed..................!"
Here's what my test.sh looks like:
#! /bin/bash
set -e
set -u
set -o pipefail
echo "Running tests...........................!"
npm install
npm run test
echo "Tests completed.........................!"
The build stage completed okay, and the test stage throws this error:
> [email protected] postinstall
--
66 | > lerna bootstrap
67 |
68 | internal/modules/cjs/loader.js:834
69 | throw err;
70 | ^
71 |
72 | Error: Cannot find module '.'
73 | Require stack:
74 | - /codebuild/output/src188079499/src/node_modules/.bin/lerna
75 | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
76 | at Function.Module._load (internal/modules/cjs/loader.js:687:27)
77 | at Module.require (internal/modules/cjs/loader.js:903:19)
78 | at require (internal/modules/cjs/helpers.js:74:18)
79 | at Object.<anonymous> (/codebuild/output/src188079499/src/node_modules/.bin/lerna:11:3)
80 | at Module._compile (internal/modules/cjs/loader.js:1015:30)
81 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
82 | at Module.load (internal/modules/cjs/loader.js:879:32)
83 | at Function.Module._load (internal/modules/cjs/loader.js:724:14)
84 | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) {
85 | code: 'MODULE_NOT_FOUND',
86 | requireStack: [ '/codebuild/output/src188079499/src/node_modules/.bin/lerna' ]
87 | }
88 | npm ERR! code 1
89 | npm ERR! path /codebuild/output/src188079499/src
90 | npm ERR! command failed
91 | npm ERR! command sh -c lerna bootstrap
92 |
93 | npm ERR! A complete log of this run can be found in:
94 | npm ERR! /root/.npm/_logs/2021-03-15T23_15_26_005Z-debug.log
95 |
96 | [Container] 2021/03/15 23:15:26 Command did not exit successfully bash ${CODEBUILD_SRC_DIR}/scripts/test.sh exit status 1
97 | [Container] 2021/03/15 23:15:26 Phase complete: BUILD State: FAILED
98 | [Container] 2021/03/15 23:15:26 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: bash ${CODEBUILD_SRC_DIR}/scripts/test.sh. Reason: exit status 1
99 | [Container] 2021/03/15 23:15:26 Entering phase POST_BUILD
100 | [Container] 2021/03/15 23:15:26 Phase complete: POST_BUILD State: SUCCEEDED
101 | [Container] 2021/03/15 23:15:26 Phase context status code: Message:
102 | [Container] 2021/03/15 23:15:26 Expanding base directory path: .
103 | [Container] 2021/03/15 23:15:26 Assembling file list
104 | [Container] 2021/03/15 23:15:26 Expanding .
105 | [Container] 2021/03/15 23:15:26 Expanding file paths for base directory .
106 | [Container] 2021/03/15 23:15:26 Assembling file list
107 | [Container] 2021/03/15 23:15:26 Expanding **/*
108 | [Container] 2021/03/15 23:15:26 Found 34591 file(s)
109 | [Container] 2021/03/15 23:15:35 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED
110 | [Container] 2021/03/15 23:15:35 Phase context status code: Message:
111 |
from aws-simple-cicd.
@srijitm If it's relevant, I needed the pipeline to use node runtime 15, so I had added following in
1.tets-project.js
2. deploy-project.ts
3. build-project.ts
install: {
commands: [
'npm install npm@latest -g',
'npm install lerna@latest -g'
]
},
and removed:
phases: {
install: {
'runtime-versions': {
nodejs: '10'
}
},
Please let me know if that's not right or could be causing the issue.
from aws-simple-cicd.
Related Issues (20)
- NodeJS verison in buildspec HOT 1
- How to connect to private npm registry nexus from code-pipeline HOT 2
- Cannot find module '.'
- Error running the deployment from the CI/CD pipeline
- Commands run in build.sh but not in test.sh or deploy.sh
- How to run deployment without using the profile used while running from local system HOT 1
- How to pass stage name from CI/CD pipeline to application? HOT 1
- How to run tests from a separate repository as part of the same pipeline
- How to increase the memory in codebuild
- Check if region is being used in config file
- Consistent repository naming convention
- Can the cross-account role be provisioned using CDK instead of CloudFormation
- Rollback support in case of a failure
- How to install node_modues in build stage and reuse them in deploy stage
- sharing artifacts across stages in codebuild breaks npm commands
- How to add badges through CodePipeline/Codebuild in souce projects
- How to configure tests stage in the pipeline to use BatchBuild from Codebuild and create multiple instances HOT 1
- Python 3.6 version in CustomCDKBucketDeployment - Where to update?
- Deploying spring boot service via Gitlab -> Terraform -> Lambda
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-simple-cicd.