Skip to content

Commit

Permalink
prepare v0.14.rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
alachaum committed Sep 22, 2024
1 parent b952eac commit d376eb4
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 8 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## [v0.14.rc1](https://github.com/keypup-io/cloudtasker/tree/v0.14.rc1) (2024-09-22)

[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.13.2...v0.14.rc1)

**Improvements:**
- Authentication: To support OIDC and regular Cloudtasker authentication, we moved the Cloudtasker Authentication header from `Authorization` to `X-Cloudtasker-Authorization`. Backward compatibility is maintained for existing jobs.
- Authentication: Use signature-based authentication instead of plain tokens. The authentication token now HMACs the content of the job. This approach prevents token from being reused.
- Batch Jobs: Batch job progress and statistics are now calculated using counters, instead of checking every job. This is much faster.
- Cron Validation: The cron jobs extension now fails epicly if the cron configuration is invalid, instead of failing silently.
- GCP OIDC Authentification: It is now possible to specify an Open ID Connect (OIDC) service account to run Cloudtasker on private Cloud Run services. OIDC authentication is provided as an extra authentication layer on top of the regular Cloudtasker authentication system (see below). See the OIDC section in the [initializer documentation](https://github.com/keypup-io/cloudtasker?tab=readme-ov-file#cloudtasker-initializer).
- Job Execution Control: Add ability to conditionally raise `Cloudtasker::RetryWorkerError` to retry jobs. This error does not get logged but the retry count will still be increased. This is a safer approach than using the `reenqueue` helper, which can lead to forever running jobs if not used properly. [Documentation](https://github.com/keypup-io/cloudtasker?tab=readme-ov-file#conditional-reenqueues-using-retry-errors).
- Log Arguments Truncation: Add `Cloudtasker::WorkerLogger.truncate` helper to truncate large payloads. This is useful to log the top-level attributes of hash/array payloads, without logging the full depth. This case save you significant $$ in logging costs. [Documentation](https://github.com/keypup-io/cloudtasker?tab=readme-ov-file#truncating-log-arguments).
- Storable Jobs: Add an interface to park Cloudtasker jobs that need to be conditionally run later. This is useful when you need to capture jobs (and their arguments) during a batch but only enqueue them after the batch is completed. This extension requires Redis and is provided as an optional module. [Documentation](https://github.com/keypup-io/cloudtasker/blob/master/docs/STORABLE_JOBS.md).
- Local Server: Add ability to disable SSL verification on the local server when local HTTPS endpoints are used. See the `local_server_ssl_verify` section in the [initializer documentation](https://github.com/keypup-io/cloudtasker?tab=readme-ov-file#cloudtasker-initializer).

**Fixed bugs:**
- ActiveJob: Support `enqueue_after_transaction_commit?` to be ISO with the ActiveJob interface.
- Batch Jobs: Do not register batch jobs that were not actually enqueued due to other factors (e.g. Job Uniqueness extension). This issue could lead to never-ending batches.
- Duration Logging: Specify the unit (`s` for seconds) on the job duration attribute so it gets properly picked up by GCP Logging. GCP Logging was occasionally mixing up seconds and milliseconds.
- Job Retry Count: GCP fixed their retry count header some time ago. We now use the `X-CloudTasks-TaskExecutionCount` header instead of the `X-CloudTasks-TaskRetryCount`. [See more details here](https://github.com/keypup-io/cloudtasker?tab=readme-ov-file#max-retries).
- Rails: Use `skip_forgery_protection` instead of `skip_before_action`. The later was causing occasional issues on some setups.



## [v0.13.2](https://github.com/keypup-io/cloudtasker/tree/v0.13.2) (2023-07-02)

[Full Changelog](https://github.com/keypup-io/cloudtasker/compare/v0.13.1...v0.13.2)
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
![Build Status](https://github.com/keypup-io/cloudtasker/workflows/Test/badge.svg) [![Gem Version](https://badge.fury.io/rb/cloudtasker.svg)](https://badge.fury.io/rb/cloudtasker)

🚀🚀🚀 Cloudtasker 0.14 release candidate (`v0.14.rc1`) is out and it's quite big ([Changelog](https://github.com/keypup-io/cloudtasker/blob/master/CHANGELOG.md)). Any help testing this release is welcome, and feel free to open issues if you spot any regression.

# Cloudtasker

Background jobs for Ruby using Google Cloud Tasks.
Expand Down Expand Up @@ -426,7 +428,7 @@ Cloudtasker.configure do |config|
# See https://cloud.google.com/tasks/docs/creating-http-target-tasks#sa for more information on
# setting up service accounts for use with Cloud Tasks.
#
# Supported since: v0.14.0 (upcoming)
# Supported since: v0.14.rc1
#
# Default: nil
#
Expand Down Expand Up @@ -696,7 +698,7 @@ end
See the [Cloudtasker::Worker class](lib/cloudtasker/worker.rb) for more information on attributes available to be logged in your `log_context_processor` proc.

### Truncating log arguments
**Supported since**: `v0.14.0 (upcoming)`
**Supported since**: `v0.14.rc1`

By default Cloudtasker does not log job arguments as arguments can contain sensitive data and generate voluminous logs, which may lead to noticeable costs with your log provider (e.g. GCP Logging). Also some providers (e.g. GCP Logging) will automatically truncate log entries that are too big and reduce their searchability.

Expand Down Expand Up @@ -832,7 +834,7 @@ By default jobs are retried 25 times - using an exponential backoff - before bei

Note that the number of retries set on your Cloud Task queue should be many times higher than the number of retries configured in Cloudtasker because Cloud Task also includes failures to connect to your application. Ideally set the number of retries to `unlimited` in Cloud Tasks.

**Note**: Versions prior to `v0.14.0 (upcoming)` use the `X-CloudTasks-TaskRetryCount` header for retries instead of the `X-CloudTasks-TaskExecutionCount` header to detect the number of retries, because there a previous bug on the GCP side which made the `X-CloudTasks-TaskExecutionCount` stay at zero instead of increasing on successive executions. Versions prior to `v0.14.0 (upcoming)` count any failure as failure, including failures due to the backend being unavailable (`HTTP 503`). Versions `v0.14.0 (upcoming)` and later only count application failure (`HTTP 4xx`) as failure for retry purpose.
**Note**: Versions prior to `v0.14.rc1` use the `X-CloudTasks-TaskRetryCount` header for retries instead of the `X-CloudTasks-TaskExecutionCount` header to detect the number of retries, because there a previous bug on the GCP side which made the `X-CloudTasks-TaskExecutionCount` stay at zero instead of increasing on successive executions. Versions prior to `v0.14.rc1` count any failure as failure, including failures due to the backend being unavailable (`HTTP 503`). Versions `v0.14.rc1` and later only count application failure (`HTTP 4xx`) as failure for retry purpose.

E.g. Set max number of retries globally via the cloudtasker initializer.
```ruby
Expand Down Expand Up @@ -889,7 +891,7 @@ end
```

### Conditional reenqueues using retry errors
**Supported since**: `v0.14.0 (upcoming)`
**Supported since**: `v0.14.rc1`

If your worker is waiting for some precondition to occur and you want to re-enqueue it until the condition has been met, you can raise a `Cloudtasker::RetryWorkerError`. This special error will fail your job **without logging an error** while still increasing the number of retries.

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/cloudtasker/worker_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def authenticate!
# Verify content signature
Authenticator.verify_signature!(signature, json_payload)
else
# Get authorization token from custom header (since v0.14.0 (upcoming)) or fallback to
# Get authorization token from custom header (since v0.14.rc1) or fallback to
# former authorization header (jobs enqueued by v0.13 and below)
bearer_token = request.headers[Cloudtasker::Config::CT_AUTHORIZATION_HEADER].to_s.split.last ||
request.headers[Cloudtasker::Config::OIDC_AUTHORIZATION_HEADER].to_s.split.last
Expand Down
2 changes: 1 addition & 1 deletion docs/STORABLE_JOBS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cloudtasker Storable Jobs

**Supported since**: `v0.14.0 (upcoming)`
**Supported since**: `v0.14.rc1`
**Note**: this extension requires redis

The Cloudtasker storage extension allows you to park jobs in a specific garage lane and enqueue (pull) them when specific conditions have been met.
Expand Down
2 changes: 1 addition & 1 deletion examples/sinatra/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# Verify content signature
Cloudtasker::Authenticator.verify_signature!(signature, json_payload)
else
# Get authorization token from custom header (since v0.14.0 (upcoming)) or fallback to
# Get authorization token from custom header (since v0.14.rc1) or fallback to
# former authorization header (jobs enqueued by v0.13 and below)
auth_token = request.env['HTTP_X_CLOUDTASKER_AUTHORIZATION'].to_s.split.last ||
request.env['HTTP_AUTHORIZATION'].to_s.split.last
Expand Down
2 changes: 1 addition & 1 deletion lib/cloudtasker/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Cloudtasker
VERSION = '0.13.2'
VERSION = '0.14.rc1'
end

0 comments on commit d376eb4

Please sign in to comment.