Skip to content

Script for deploy and cleanup of the snap-in#69

Open
radovanjorgic wants to merge 4 commits intomainfrom
rado/ISS-252849
Open

Script for deploy and cleanup of the snap-in#69
radovanjorgic wants to merge 4 commits intomainfrom
rado/ISS-252849

Conversation

@radovanjorgic
Copy link
Contributor

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 deploy or npm run cleanup.

Connected Issues

https://app.devrev.ai/devrev/works/ISS-252849

Checklist

  • Tests added/updated and ran with npm run test OR no tests needed.
  • Code formatted and checked with npm run lint.
  • Added "How to test" section to the description OR this section is not needed.

Copy link
Contributor

@gasperzgonec gasperzgonec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

@navneel99 navneel99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm ci?

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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants