@monstm/cicd
v1.2.2
Published
A simplified CLI for CI/CD pipeline automation tools
Readme
CICD Pipeline
A simplified CLI for CI/CD pipeline automation tools
Prerequisites
- node 22.16.0
- npm 11.3.0
Rollbar Integrations
Create Rollbar deploy event
npx @monstm/cicd rollbar:deploy:started -t $ROLLBAR_ACCESS_TOKEN -r $ROLLBAR_REVISION| options | short | environment variables | default value | description | | :----------------- | :---: | :--------------------------------------- | :------------------ | :--------------------------------------------- | | --access-token | -t | ROLLBAR_ACCESS_TOKEN | | Rollbar access token | | --environment | -e | ROLLBAR_ENVIRONMENT | local | Environment to which the revision was deployed | | --revision | -r | ROLLBAR_REVISION, CI_COMMIT_SHORT_SHA | | Git SHA of revision being deployed | | --rollbar-username | -u | ROLLBAR_USERNAME | | Rollbar username of person who deployed | | --local-username | -l | ROLLBAR_LOCAL_USERNAME, GITLAB_USER_NAME | | Local username of person who deployed | | --comment | -c | ROLLBAR_COMMENT, CI_COMMIT_TITLE | | Additional text to include with the deploy | | --filename | -f | ROLLBAR_FILENAME | rollbar-deploy.json | Rollbar response filename |
Update Rollbar deploy event to succeeded
npx @monstm/cicd rollbar:deploy:succeeded -t $ROLLBAR_ACCESS_TOKEN| options | short | environment variables | default value | description | | :------------- | :---: | :-------------------- | :------------------ | :-------------------------------------- | | --access-token | -t | ROLLBAR_ACCESS_TOKEN | | Rollbar access token | | --comment | -c | ROLLBAR_COMMENT | | Optional comment to describe the deploy | | --filename | -f | ROLLBAR_FILENAME | rollbar-deploy.json | Rollbar response filename |
Update Rollbar deploy event to failed
npx @monstm/cicd rollbar:deploy:failed -t $ROLLBAR_ACCESS_TOKEN| options | short | environment variables | default value | description | | :------------- | :---: | :------------------------------- | :------------------ | :-------------------------------------- | | --access-token | -t | ROLLBAR_ACCESS_TOKEN | | Rollbar access token | | --comment | -c | ROLLBAR_COMMENT, CI_PIPELINE_URL | | Optional comment to describe the deploy | | --filename | -f | ROLLBAR_FILENAME | rollbar-deploy.json | Rollbar response filename |
Gitlab Example - .gitlab-ci.yml
on-begin:
stage: .pre
image: node:alpine
script:
- npx @monstm/cicd rollbar:deploy:started -t $ROLLBAR_ACCESS_TOKEN
artifacts:
paths:
- rollbar-deploy.json
# do somethings ...
on-success:
stage: .post
image: node:alpine
script:
- npx @monstm/cicd rollbar:deploy:succeeded -t $ROLLBAR_ACCESS_TOKEN
when: on_success
on-failure:
stage: .post
image: node:alpine
script:
- npx @monstm/cicd rollbar:deploy:failed -t $ROLLBAR_ACCESS_TOKEN
when: on_failurePushover Integrations
Send Pushover message
npx @monstm/cicd pushover:messages -t $PUSHOVER_TOKEN -u $PUSHOVER_USER -m $PUSHOVER_MESSAGE| options | short | environment variables | description | | :---------- | :---: | :-------------------- | :------------------------------ | | --token | -t | PUSHOVER_TOKEN | Pushover api token | | --user | -u | PUSHOVER_USER | Pushover user/group key | | --message | -m | PUSHOVER_MESSAGE | Message to send | | --title | | PUSHOVER_TITLE | Title of message | | --url | | PUSHOVER_URL | URL to show in message | | --url-title | | PUSHOVER_URL_TITLE | Title of URL to show in message | | --device | -d | PUSHOVER_DEVICE | Device to send message to | | --sound | -s | PUSHOVER_SOUND | Sound to play | | --priority | -p | PUSHOVER_PRIORITY | Priority of message | | --html | | PUSHOVER_HTML | Enable HTML parsing |
Send Pushover pipeline passed notification
npx @monstm/cicd pushover:pipeline:passed -t $PUSHOVER_TOKEN -u $PUSHOVER_USER -a $PUSHOVER_APPLICATION_NAME -r $PUSHOVER_REFERENCE_NAME -s $PUSHOVER_SHA -l $PUSHOVER_LINK| options | short | environment variables | description | | :----------------- | :---: | :------------------------------------------ | :------------------------------- | | --token | -t | PUSHOVER_TOKEN | Pushover api token | | --user | -u | PUSHOVER_USER | Pushover user/group key | | --application-name | -a | PUSHOVER_APPLICATION_NAME, CI_PROJECT_TITLE | Application name | | --reference-name | -r | PUSHOVER_REFERENCE_NAME, CI_COMMIT_REF_NAME | Reference name | | --sha | -s | PUSHOVER_SHA, CI_COMMIT_SHORT_SHA | SHA of the commit revision | | --link | -l | PUSHOVER_LINK, CI_PIPELINE_URL | The URL for the pipeline details |
Send Pushover pipeline failed notification
npx @monstm/cicd pushover:pipeline:failed -t $PUSHOVER_TOKEN -u $PUSHOVER_USER -a $PUSHOVER_APPLICATION_NAME -r $PUSHOVER_REFERENCE_NAME -s $PUSHOVER_SHA -l $PUSHOVER_LINK| options | short | environment variables | description | | :----------------- | :---: | :------------------------------------------ | :------------------------------- | | --token | -t | PUSHOVER_TOKEN | Pushover api token | | --user | -u | PUSHOVER_USER | Pushover user/group key | | --application-name | -a | PUSHOVER_APPLICATION_NAME, CI_PROJECT_TITLE | Application name | | --reference-name | -r | PUSHOVER_REFERENCE_NAME, CI_COMMIT_REF_NAME | Reference name | | --sha | -s | PUSHOVER_SHA, CI_COMMIT_SHORT_SHA | SHA of the commit revision | | --link | -l | PUSHOVER_LINK, CI_PIPELINE_URL | The URL for the pipeline details |
Send Pushover deploy succeeded notification
npx @monstm/cicd pushover:deploy:succeeded -t $PUSHOVER_TOKEN -u $PUSHOVER_USER -a $PUSHOVER_APPLICATION_NAME -r $PUSHOVER_REFERENCE_NAME -e $PUSHOVER_ENVIRONMENT -l $PUSHOVER_LINK| options | short | environment variables | description | | :----------------- | :---: | :------------------------------------------ | :--------------------------------------------- | | --token | -t | PUSHOVER_TOKEN | Pushover api token | | --user | -u | PUSHOVER_USER | Pushover user/group key | | --application-name | -a | PUSHOVER_APPLICATION_NAME, CI_PROJECT_TITLE | Application name | | --reference-name | -r | PUSHOVER_REFERENCE_NAME, CI_COMMIT_REF_NAME | Reference name | | --environment | -e | PUSHOVER_ENVIRONMENT | Environment to which the revision was deployed | | --link | -l | PUSHOVER_LINK | The link for the deployment |
Send Pushover release published notification
npx @monstm/cicd pushover:release:published -t $PUSHOVER_TOKEN -u $PUSHOVER_USER -a $PUSHOVER_APPLICATION_NAME -r $PUSHOVER_REFERENCE_NAME -l $PUSHOVER_LINK| options | short | environment variables | description | | :----------------- | :---: | :------------------------------------------ | :----------------------- | | --token | -t | PUSHOVER_TOKEN | Pushover api token | | --user | -u | PUSHOVER_USER | Pushover user/group key | | --application-name | -a | PUSHOVER_APPLICATION_NAME, CI_PROJECT_TITLE | Application name | | --version | -r | PUSHOVER_APPLICATION_VERSION, CI_COMMIT_TAG | Application version | | --link | -l | PUSHOVER_LINK | The link for the release |
Gitlab Example - .gitlab-ci.yml
on-message:
stage: build
image: node:alpine
script:
- npx @monstm/cicd pushover:messages -t $PUSHOVER_TOKEN -u $PUSHOVER_USER -m $PUSHOVER_MESSAGE
on-deploy:
stage: deploy
image: node:alpine
script:
- npx @monstm/cicd pushover:deploy:succeeded -t $PUSHOVER_TOKEN -u $PUSHOVER_USER -e $PUSHOVER_ENVIRONMENT -l $PUSHOVER_LINK
on-release:
stage: deploy
image: node:alpine
script:
- npx @monstm/cicd pushover:release:published -t $PUSHOVER_TOKEN -u $PUSHOVER_USER -l $PUSHOVER_LINK
rules:
- if: $CI_COMMIT_TAG
on-success:
stage: .post
image: node:alpine
script:
- npx @monstm/cicd pushover:pipeline:passed -t $PUSHOVER_TOKEN -u $PUSHOVER_USER
when: on_success
on-failure:
stage: .post
image: node:alpine
script:
- npx @monstm/cicd pushover:pipeline:failed -t $PUSHOVER_TOKEN -u $PUSHOVER_USER
when: on_failureSMTP Integrations
Send deploy succeeded email notification
npx @monstm/cicd smtp:deploy:succeeded -h $SMTP_HOST -u $SMTP_USERNAME -p $SMTP_PASSWORD -f $SMTP_FROM_ADDRESS --from-name $SMTP_FROM_NAME -t $SMTP_TO_ADDRESS -a $SMTP_APPLICATION_NAME -r $SMTP_REFERENCE_NAME -e $SMTP_ENVIRONMENT -l $SMTP_LINK| options | short | environment variables | description | | :----------------- | :---: | :-------------------------------------- | :---------------------------------------------------------- | | --host | -h | SMTP_HOST | The hostname or IP address of the SMTP server to connect to | | --port | -o | SMTP_PORT | The port number to connect to | | --secure | | SMTP_SECURE | The connection uses TLS immediately upon connecting | | --auth-username | -u | SMTP_USERNAME | SMTP auth username | | --auth-password | -p | SMTP_PASSWORD | SMTP auth password | | --auth-method | -m | SMTP_METHOD | The preferred SASL authentication method | | --from-address | -f | SMTP_FROM_ADDRESS | The email address to send from | | --from-name | | SMTP_FROM_NAME, CI_PROJECT_TITLE | The name to send from | | --to-address | -t | SMTP_TO_ADDRESS | The email address to send to | | --application-name | -a | SMTP_APPLICATION_NAME, CI_PROJECT_TITLE | Application name | | --reference-name | -r | SMTP_REFERENCE_NAME, CI_COMMIT_REF_NAME | Reference name | | --environment | -e | SMTP_ENVIRONMENT | Environment to which the revision was deployed | | --sha | -s | SMTP_SHA, CI_COMMIT_SHORT_SHA | SHA of the commit revision | | --comment | -c | SMTP_SHA, CI_COMMIT_TITLE | Additional text to include with the deployment | | --local-username | | SMTP_SHA, GITLAB_USER_NAME | Username of person who deployed | | --link | -l | SMTP_LINK | The link for the deployment |
Send release published email notification
npx @monstm/cicd smtp:release:published -h $SMTP_HOST -u $SMTP_USERNAME -p $SMTP_PASSWORD -f $SMTP_FROM_ADDRESS --from-name $SMTP_FROM_NAME -t $SMTP_TO_ADDRESS -a $SMTP_APPLICATION_NAME -r $SMTP_REFERENCE_NAME -l $SMTP_LINK| options | short | environment variables | description | | :----------------- | :---: | :-------------------------------------- | :---------------------------------------------------------- | | --host | -h | SMTP_HOST | The hostname or IP address of the SMTP server to connect to | | --port | -o | SMTP_PORT | The port number to connect to | | --secure | | SMTP_SECURE | The connection uses TLS immediately upon connecting | | --auth-username | -u | SMTP_USERNAME | SMTP auth username | | --auth-password | -p | SMTP_PASSWORD | SMTP auth password | | --auth-method | -m | SMTP_METHOD | The preferred SASL authentication method | | --from-address | -f | SMTP_FROM_ADDRESS | The email address to send from | | --from-name | | SMTP_FROM_NAME, CI_PROJECT_TITLE | The name to send from | | --to-address | -t | SMTP_TO_ADDRESS | The email address to send to | | --application-name | -a | SMTP_APPLICATION_NAME, CI_PROJECT_TITLE | Application name | | --version | -r | SMTP_APPLICATION_VERSION, CI_COMMIT_TAG | Application version | | --sha | -s | SMTP_SHA, CI_COMMIT_SHORT_SHA | SHA of the commit revision | | --comment | -c | SMTP_SHA, CI_COMMIT_TITLE | Additional text to include with the release | | --local-username | | SMTP_SHA, GITLAB_USER_NAME | Username of person who published | | --link | -l | SMTP_LINK | The link for the release |
Gitlab Example - .gitlab-ci.yml
on-deploy:
stage: deploy
image: node:alpine
script:
- npx @monstm/cicd smtp:deploy:succeeded -h $SMTP_HOST -u $SMTP_USERNAME -p $SMTP_PASSWORD -f $SMTP_FROM_ADDRESS -t $SMTP_TO_ADDRESS -e $PUSHOVER_ENVIRONMENT -l $PUSHOVER_LINK
on-release:
stage: deploy
image: node:alpine
script:
- npx @monstm/cicd smtp:release:published -h $SMTP_HOST -u $SMTP_USERNAME -p $SMTP_PASSWORD -f $SMTP_FROM_ADDRESS -t $SMTP_TO_ADDRESS -l $PUSHOVER_LINK
rules:
- if: $CI_COMMIT_TAG