-
-
Notifications
You must be signed in to change notification settings - Fork 42
feat: Add Cloud Run Jobs support as queue target #187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
robertpcontreras-ts
wants to merge
10
commits into
stackkit:master
Choose a base branch
from
robertpcontreras-ts:feature/cloud-run-jobs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: Add Cloud Run Jobs support as queue target #187
robertpcontreras-ts
wants to merge
10
commits into
stackkit:master
from
robertpcontreras-ts:feature/cloud-run-jobs
+996
−6
Conversation
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
Enables dispatching jobs to Cloud Run Jobs instead of HTTP endpoints, allowing for long-running batch processing that exceeds Cloud Tasks HTTP timeout limits. This change introduces a new `cloud_run_job` configuration option for the `cloudtasks` queue connection. When enabled, jobs are dispatched to the Cloud Run Jobs execution API, passing the job payload as environment variables. A new artisan command `cloud-tasks:work-job` is introduced to handle Cloud Run Job executions. Large payloads exceeding environment variable limits can be stored in Laravel filesystem disks, and the path is passed to the Cloud Run Job instead.
- Add cloud-tasks:work-job Artisan command for processing jobs via Cloud Run Jobs - Support Cloud Run Jobs as a target type via Cloud Tasks execution API - Add GCS payload storage for large payloads (>10KB) using Laravel Filesystem - Container overrides pass CLOUD_TASKS_PAYLOAD, CLOUD_TASKS_TASK_NAME, CLOUD_TASKS_PAYLOAD_PATH env vars - Command reads env vars via getenv() and extracts connection from payload - Automatic cleanup of payload files after processing - 23 comprehensive unit tests with 30 assertions
Cloud Run Jobs API requires OAuth authentication with cloud-platform scope. - Changed from OidcToken to OAuthToken - Set scope to 'https://www.googleapis.com/auth/cloud-platform' - Updated test to verify OAuth token configuration
Added comprehensive section covering: - Project-level permissions (cloudtasks.enqueuer, cloudtasks.viewer, run.jobsExecutorWithOverrides, run.invoker) - Service account permissions (iam.serviceAccountUser for SA and Cloud Tasks agent) - Summary table with purpose of each permission
The library only creates/deletes tasks, it does not list queues or tasks. cloudtasks.viewer is only needed if your own application code lists queues/tasks.
Member
|
This is really nice, thanks! I will review everything later. |
Modifies the Cloud Run Job worker to handle job retries by releasing jobs back to Cloud Tasks instead of relying on Cloud Run's retry mechanism. This prevents duplicate job executions when retries are configured on the Cloud Run Job itself, as Laravel manages retries by pushing a new task back to Cloud Tasks when a job is released. This matches the same behaviour as the HTTP request handler Updates tests to reflect the change.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for processing Laravel queue jobs using Google Cloud Run Jobs as a target type. Instead of dispatching jobs to an HTTP endpoint, Cloud Tasks triggers a Cloud Run Job execution via the Cloud Run Jobs API, which runs an Artisan command to process the job.
Features
Configuration
Breaking Changes
None. This is an additive feature - the cloud_run_job option defaults to false, preserving existing behaviour.
Tests
Documentation