Commit 6310a04e authored by Asad Ullah Khan's avatar Asad Ullah Khan

Add README

parent 92bd63df
# Description
* This Cloud functions will be triggered based on pubsub message , it reads and get intendID from the message and check GCP firestore if intendId exist or not
* if IntendId exist in Datastore then fetch pipeline details from it and trigger paramertized jenkin job
# Block diagram of the Flow
# Deployment steps:
## Create a Jenkin Job and User API token:
* Create a paramertized Jenkin Job
* Create and API token for the user authentication that is required to trigger jenkins job
* Trigger Build remotely check box must checked at the pip;eine configuration and a token must spcified there
## Setting up a Pub/Sub topic:
* Specify your Google Cloud project in an environment variable.
export PROJECT_ID=PROJECT_ID
* Specify your Google Cloud organization in an environment variable.
export ORG_ID=ORG_ID
* Set the project ID for gcloud commands.
gcloud config set project PROJECT_ID
* Create the Pub/Sub topic where notifications are published.
gcloud pubsub topics create trigger-email
* Specify the topic in an environment variable.
export TOPIC=projects/$PROJECT_ID/topics/trigger-email
* Create the subscription that notifies Cloud Functions to send an email or chat message when messages are published to the topic.
gcloud pubsub subscriptions create gcf-trigger-email-asia-east2-trigger-email-sub --topic trigger-email
## Create the Cloud Function
In this section, you deploy a function that sends notifications to your email account.
* Ensure that you're using the same PROJECT_ID you used to create the Pub/Sub topic.
* Click Create Function. SendGrid function
* Set Function name to send-high-and-critical-finding-email-notification and the Trigger type to Pub/Sub.
* Select the Pub/Sub topic that you created in Setting up a Pub/Sub topic.
* Click Save, and then click Next.
* On the next page, set Runtime to Python 3.10.
* In the file list, click requirements.txt and add the following to the text field: sendgrid.[Text Wrapping Break][Text Wrapping Break]SendGrid requirements
* Click main.py and replace the contents with your code snippet.
* Navigate to the Entry point field and enter the name of the function in the code snippet (send_email_notification, in this example).
* Click Deploy. You are returned to the Cloud Functions list where you should see your new function. When a green check mark appears next to the function name, it has been successfully deployed. The process could take a few minutes.
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment