This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Script path: venv/bin/functions-framework | |
| Parameters: --source=src/main.py --target=${FUNCTION_NAME_PUBSUB} --signature-type=event --port=${FUNCTION_PORT_PUBSUB} --debug | |
| Environment variables: PYTHONUNBUFFERED=1 | |
| Working directory: /home/iluz/Projects/Personal/cloud-build-cloud-functions-pipeline/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "eventType": "com.example.someevent", | |
| "resource": "FooBar", | |
| "eventId": "B234-1234-1234", | |
| "timestamp": "2020-06-20T17:31:00Z", | |
| "data": { | |
| "data": "__DATA_BASE64_PLACEHOLDER__", | |
| "attributes": { | |
| "foo": "bar", | |
| "bar": "baz" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/bash | |
| DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
| source "${DIR}/.env.local" | |
| RAW_MESSAGE=$1 | |
| MESSAGE_BASE64=$(echo -n ${RAW_MESSAGE} | base64) | |
| EVENT_PAYLOAD=$( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/bash | |
| DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
| SOURCE_FILE="${DIR}/../src/main.py" | |
| source "${DIR}/.env.local" | |
| functions-framework \ | |
| --source=${SOURCE_FILE} \ | |
| --target=${FUNCTION_NAME_PUBSUB} \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/bash | |
| DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
| SOURCE_FILE="${DIR}/../src/main.py" | |
| source "${DIR}/.env.local" | |
| curl "http://localhost:${FUNCTION_PORT_HTTP}/?subject=FooBar" | |
| echo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/bash | |
| DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
| SOURCE_FILE="${DIR}/../src/main.py" | |
| source "${DIR}/.env.local" | |
| functions-framework \ | |
| --source=${SOURCE_FILE} \ | |
| --target=${FUNCTION_NAME_HTTP} \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export FUNCTION_NAME_HTTP=sample_http | |
| export FUNCTION_PORT_HTTP=4000 | |
| export FUNCTION_NAME_PUBSUB=sample_pubsub | |
| export FUNCTION_PORT_PUBSUB=5000 | |
| export PUBSUB_TOPIC=builder-functions-demo-topic |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import base64 | |
| import pprint as pp | |
| from flask import current_app, escape | |
| def sample_http(request): | |
| """HTTP Cloud Function. | |
| Args: | |
| request (flask.Request): The request object. | |
| <http://flask.pocoo.org/docs/1.0/api/#flask.Request> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| read -p "Enter the Cloud Run Service name: " SERVICE_NAME | |
| read -s -p "Enter the API KEY: " API_KEY | |
| HASHED_API_KEY=`./hash_value.py --value "${API_KEY}"` | |
| gcloud run \ | |
| services update $SERVICE_NAME \ | |
| --region us-central1 \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ ./set_env_vars.sh | |
| Enter the Cloud Run Service name: pipeline-demo | |
| ✓ Deploying... Done. | |
| ✓ Creating Revision... | |
| ✓ Routing traffic... | |
| Done. | |
| Service [pipeline-demo] revision [pipeline-demo-00004-hec] has been deployed and is serving 100 percent of traffic at https://pipeline-demo-pmrwyqmvha-uc.a.run.app |