Script for deploy and cleanup of the snap-in#69
Conversation
gasperzgonec
left a comment
There was a problem hiding this comment.
Looks good.
I'd like to also ignore the .env file inside of the code/ directory.
Currently only the .env file in the root is .gitignored.
navneel99
left a comment
There was a problem hiding this comment.
Thanks Rado! I have added some suggestions here. @SathishKumarHS raised a similar PR long time ago LINK where I voiced similar concerns. Once we handle those it will be a great addition!
|
|
||
| if [ $? -ne 0 ]; then | ||
| error "Failed to create snap-in version" | ||
| exit 1 |
There was a problem hiding this comment.
On errors when creation of SIV, either set the snap-in package in context and have a switch to use this package itself the next time, otherwise delete the SIP itself to avoid orphan snap-in packages.
| cd "$CODE_DIR" | ||
|
|
||
| echo "Building..." | ||
| if ! npm run build; then |
| FILTERED_OUTPUT=$(echo "$VER_OUTPUT" | grep "snap_in_version" | grep -o '{.*}') | ||
|
|
||
| if echo "$FILTERED_OUTPUT" | jq '.message' 2>/dev/null | grep -v null > /dev/null; then | ||
| error "Failed to create snap-in version" |
There was a problem hiding this comment.
let's handle failure in creation of SIV gracefully
| break | ||
| elif [[ "$STATE" == "build_failed" ]] || [[ "$STATE" == "deployment_failed" ]]; then | ||
| REASON=$(echo "$VER_STATUS" | jq -r '.snap_in_version.failure_reason' 2>/dev/null) | ||
| error "Build/deployment failed: $REASON" |
There was a problem hiding this comment.
The script can be taken to the next level if we also add a command for getting package logs and/or saving the logs in a file. Reduces a lot of effort
Description
This PR replaces Makefile with deploy and cleanup scripts with new ones that can be ran as other node.js commands with
npm run deployornpm run cleanup.Connected Issues
https://app.devrev.ai/devrev/works/ISS-252849
Checklist
npm run testOR no tests needed.npm run lint.