Skip to content

Commit 83ac458

Browse files
authored
Merge pull request #9516 from circleci/add-error-message-for-retention
Add error documentation for job retention configuration
2 parents 07aeb61 + 5efc68f commit 83ac458

File tree

1 file changed

+42
-2
lines changed

1 file changed

+42
-2
lines changed

docs/reference/modules/ROOT/pages/configuration-reference.adoc

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,6 @@ jobs:
494494

495495
Configure job retention periods to control how long job data is kept. Job retention specifically controls cache retention at the job level. This setting can be configured from 1 day to 15 days using string values (for example, "1d", "7d", "15d"). Job retention reduces the organization-level retention from the default by automatically removing cache data after the specified period.
496496

497-
For more information on cache retention, see the xref:guides:optimize:persist-data.adoc#custom-storage-usage[Persisting data overview] page.
498-
499497
*Example:*
500498

501499
[source,yaml]
@@ -514,6 +512,48 @@ jobs:
514512
- run: npm test
515513
----
516514

515+
For more information on cache retention, see the xref:guides:optimize:persist-data.adoc#custom-storage-usage[Persisting data overview] page.
516+
517+
[#retention-errors]
518+
===== Common errors
519+
520+
When configuring job retention, you may encounter the following validation errors:
521+
522+
* **Invalid time format**: The retention period must use the format `^([1-9]|[12][0-9]|30)d$` (1-30 days with "d" suffix). For example, use `"7d"` instead of `"12h"` or `"1w"`.
523+
524+
* **Incorrect data type**: The `retention` key expects a map with `caches` as a string value, not a direct string.
525+
526+
*Examples:*
527+
528+
.Incorrect - direct string value
529+
[source,yaml]
530+
----
531+
# Incorrect - direct string value
532+
jobs:
533+
say-hello:
534+
retention: "12h" # Error: expected type: String, found: Mapping
535+
----
536+
537+
.Incorrect - invalid time format
538+
[source,yaml]
539+
----
540+
#Incorrect - invalid time format
541+
jobs:
542+
say-hello:
543+
retention:
544+
caches: "12h" # Error: does not match pattern ^([1-9]|[12][0-9]|30)d$
545+
----
546+
547+
.Correct format
548+
[source,yaml]
549+
----
550+
# Correct format
551+
jobs:
552+
say-hello:
553+
retention:
554+
caches: "7d" # Valid: 7 days
555+
----
556+
517557
'''
518558

519559
[#parallelism]

0 commit comments

Comments
 (0)