From 2a777ca4e7642c1eea4728c137ba387e239240ce Mon Sep 17 00:00:00 2001 From: HKWinterhalter Date: Mon, 17 Jul 2023 16:14:35 -0700 Subject: [PATCH 1/3] ci: rename master branch to main --- .github/workflows/buildpack-integration-test.yml | 2 +- .github/workflows/codeql.yml | 4 ++-- .github/workflows/conformance.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/scorecard.yml | 2 +- .github/workflows/unit.yml | 2 +- README.md | 4 ++-- src/functions_framework/event_conversion.py | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/buildpack-integration-test.yml b/.github/workflows/buildpack-integration-test.yml index ec9fbf3d..c1d8084e 100644 --- a/.github/workflows/buildpack-integration-test.yml +++ b/.github/workflows/buildpack-integration-test.yml @@ -3,7 +3,7 @@ name: Buildpack Integration Test on: push: branches: - - master + - main pull_request: workflow_dispatch: # Runs every day on 12:00 AM PST diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 33614b00..dd1d1d77 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -13,10 +13,10 @@ name: "CodeQL" on: push: - branches: ["master"] + branches: ["main"] pull_request: # The branches below must be a subset of the branches above - branches: ["master"] + branches: ["main"] schedule: - cron: "0 0 * * 1" diff --git a/.github/workflows/conformance.yml b/.github/workflows/conformance.yml index 8ebf4e42..b892a3ea 100644 --- a/.github/workflows/conformance.yml +++ b/.github/workflows/conformance.yml @@ -2,7 +2,7 @@ name: Python Conformance CI on: push: branches: - - 'master' + - 'main' pull_request: # Declare default permissions as read only. diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 88af8d1e..fc00bc6f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,7 +2,7 @@ name: Python Lint CI on: push: branches: - - master + - main pull_request: permissions: contents: read diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0dced000..519f287b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,7 +28,7 @@ jobs: - name: Build distributions run: python -m build - name: Publish - uses: pypa/gh-action-pypi-publish@54d67ed3c50a769c633f7db8063c9e634709c1b0 # master + uses: pypa/gh-action-pypi-publish@54d67ed3c50a769c633f7db8063c9e634709c1b0 # main with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index e8b1f04c..0c24297e 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -8,7 +8,7 @@ on: schedule: - cron: '0 */12 * * *' push: - branches: [ "master" ] + branches: [ "main" ] workflow_dispatch: # Declare default permissions as read only. diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index dd40b16e..381c28b0 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -2,7 +2,7 @@ name: Python Unit CI on: push: branches: - - master + - main pull_request: permissions: contents: read diff --git a/README.md b/README.md index ce094471..0433028d 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ def hello_cloud_event(cloud_event): print(f"Received event with ID: {cloud_event['id']} and data {cloud_event.data}") ``` -> Your function is passed a single [CloudEvent](https://github.com/cloudevents/sdk-python/blob/master/cloudevents/sdk/event/v1.py) parameter. +> Your function is passed a single [CloudEvent](https://github.com/cloudevents/sdk-python/blob/main/cloudevents/sdk/event/v1.py) parameter. Run the following command to run `hello_cloud_event` target locally: @@ -302,7 +302,7 @@ After you've written your function, you can simply deploy it from your local mac ### Cloud Run/Cloud Run on GKE -Once you've written your function and added the Functions Framework to your `requirements.txt` file, all that's left is to create a container image. [Check out the Cloud Run quickstart](https://cloud.google.com/run/docs/quickstarts/build-and-deploy) for Python to create a container image and deploy it to Cloud Run. You'll write a `Dockerfile` when you build your container. This `Dockerfile` allows you to specify exactly what goes into your container (including custom binaries, a specific operating system, and more). [Here is an example `Dockerfile` that calls Functions Framework.](https://github.com/GoogleCloudPlatform/functions-framework-python/blob/master/examples/cloud_run_http) +Once you've written your function and added the Functions Framework to your `requirements.txt` file, all that's left is to create a container image. [Check out the Cloud Run quickstart](https://cloud.google.com/run/docs/quickstarts/build-and-deploy) for Python to create a container image and deploy it to Cloud Run. You'll write a `Dockerfile` when you build your container. This `Dockerfile` allows you to specify exactly what goes into your container (including custom binaries, a specific operating system, and more). [Here is an example `Dockerfile` that calls Functions Framework.](https://github.com/GoogleCloudPlatform/functions-framework-python/blob/main/examples/cloud_run_http) If you want even more control over the environment, you can [deploy your container image to Cloud Run on GKE](https://cloud.google.com/run/docs/quickstarts/prebuilt-deploy-gke). With Cloud Run on GKE, you can run your function on a GKE cluster, which gives you additional control over the environment (including use of GPU-based instances, longer timeouts and more). diff --git a/src/functions_framework/event_conversion.py b/src/functions_framework/event_conversion.py index 06e5a812..0e67cdaa 100644 --- a/src/functions_framework/event_conversion.py +++ b/src/functions_framework/event_conversion.py @@ -27,7 +27,7 @@ # Maps background/legacy event types to their equivalent CloudEvent types. # For more info on event mappings see -# https://github.com/GoogleCloudPlatform/functions-framework-conformance/blob/master/docs/mapping.md +# https://github.com/GoogleCloudPlatform/functions-framework-conformance/blob/main/docs/mapping.md _BACKGROUND_TO_CE_TYPE = { "google.pubsub.topic.publish": "google.cloud.pubsub.topic.v1.messagePublished", "providers/cloud.pubsub/eventTypes/topic.publish": "google.cloud.pubsub.topic.v1.messagePublished", From 33085517aaac9d1b5ac4b273412d133e40d9ca7a Mon Sep 17 00:00:00 2001 From: HKWinterhalter Date: Mon, 17 Jul 2023 16:50:09 -0700 Subject: [PATCH 2/3] ci: retarget buildpack integration tests to latest --- .github/workflows/buildpack-integration-test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/buildpack-integration-test.yml b/.github/workflows/buildpack-integration-test.yml index c1d8084e..0e65c0a9 100644 --- a/.github/workflows/buildpack-integration-test.yml +++ b/.github/workflows/buildpack-integration-test.yml @@ -15,7 +15,7 @@ permissions: read-all jobs: python37: - uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@v1.8.4 + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml with: http-builder-source: 'tests/conformance' http-builder-target: 'write_http_declarative' @@ -26,7 +26,7 @@ jobs: builder-runtime-version: '3.7' start-delay: 5 python38: - uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@v1.8.4 + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml with: http-builder-source: 'tests/conformance' http-builder-target: 'write_http_declarative' @@ -37,7 +37,7 @@ jobs: builder-runtime-version: '3.8' start-delay: 5 python39: - uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@v1.8.4 + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml with: http-builder-source: 'tests/conformance' http-builder-target: 'write_http_declarative' @@ -48,7 +48,7 @@ jobs: builder-runtime-version: '3.9' start-delay: 5 python310: - uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@v1.8.4 + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml with: http-builder-source: 'tests/conformance' http-builder-target: 'write_http_declarative' From adfac811d374a2730bd639278630b26bc0cfcca7 Mon Sep 17 00:00:00 2001 From: HKWinterhalter Date: Mon, 17 Jul 2023 17:01:26 -0700 Subject: [PATCH 3/3] retarget buildpack integration tests to conformance main --- .github/workflows/buildpack-integration-test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/buildpack-integration-test.yml b/.github/workflows/buildpack-integration-test.yml index 0e65c0a9..0c9e6eff 100644 --- a/.github/workflows/buildpack-integration-test.yml +++ b/.github/workflows/buildpack-integration-test.yml @@ -15,7 +15,7 @@ permissions: read-all jobs: python37: - uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@main with: http-builder-source: 'tests/conformance' http-builder-target: 'write_http_declarative' @@ -26,7 +26,7 @@ jobs: builder-runtime-version: '3.7' start-delay: 5 python38: - uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@main with: http-builder-source: 'tests/conformance' http-builder-target: 'write_http_declarative' @@ -37,7 +37,7 @@ jobs: builder-runtime-version: '3.8' start-delay: 5 python39: - uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@main with: http-builder-source: 'tests/conformance' http-builder-target: 'write_http_declarative' @@ -48,7 +48,7 @@ jobs: builder-runtime-version: '3.9' start-delay: 5 python310: - uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@main with: http-builder-source: 'tests/conformance' http-builder-target: 'write_http_declarative' @@ -57,4 +57,4 @@ jobs: prerun: 'tests/conformance/prerun.sh ${{ github.sha }}' builder-runtime: 'python310' builder-runtime-version: '3.10' - start-delay: 5 \ No newline at end of file + start-delay: 5