Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

docs: clarify cron attribute format for coder_script resource#409

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
blink-so wants to merge5 commits intomain
base:main
Choose a base branch
Loading
fromfix-cron-documentation

Conversation

blink-so[bot]
Copy link

@blink-soblink-sobot commentedJun 4, 2025

This PR addresses issue#353 by clarifying the cron format documentation for thecoder_script resource.

Changes Made

  • Updated cron description: Clarified that the cron attribute uses a 6-field format (seconds minutes hours day-of-month month day-of-week) instead of the standard Unix 5-field format
  • Fixed misleading example: Changed"0 22 * * *" to"0 0 22 * * *" to show proper 6-field format
  • Added helpful examples: Included multiple cron examples with inline comments explaining the schedule
  • Added additional example: Created a new example showing every 5 minutes schedule

Problem Solved

The original issue was that users expected the standard Unix cron format (minutes hours day month day-of-week) but the provider actually uses a 6-field format that includes seconds as the first field. This caused confusion where a user's"*/5 * * * *" (intended for every 5 minutes) was actually running every 5 seconds.

Testing

The documentation changes have been tested by verifying the cron parser configuration inprovider/script.go which shows:

varScriptCRONParser=cron.NewParser(cron.Second|cron.Minute|cron.Hour|cron.Dom|cron.Month|cron.DowOptional|cron.Descriptor)

This confirms the 6-field format is correct.

Fixes#353

@github-actionsGitHub Actions
Copy link

github-actionsbot commentedJun 4, 2025
edited
Loading

All contributors have signed the CLA ✍️ ✅
Posted by theCLA Assistant Lite bot.

blink-sobot added5 commitsJune 4, 2025 15:06
- Update cron description to specify 6-field format (seconds minutes hours day month day-of-week)- Fix misleading example that used 5-field Unix format- Add additional cron examples with proper 6-field format- Include inline comments explaining the scheduleFixes#353
- Detect when users provide Unix 5-field cron format- Provide helpful warning with suggested 6-field conversion- Maintain backwards compatibility - expressions still work- Add comprehensive tests for validation functionThis helps users avoid confusion where '*/5 * * * *' (intended forevery 5 minutes) actually runs every 5 seconds due to the missingseconds field.
- Added the missing every_5_minutes cron script example to examples/resources/coder_script/resource.tf- This example demonstrates the 6-field cron format with a health check that runs every 5 minutes- Ensures examples directory matches the documentation examples
- Updated the cron field description in provider/script.go to include detailed 6-field format explanation- Fixed formatting issues in documentation (removed extra spaces before comments)- Regenerated documentation to ensure consistency between schema and docs- This ensures the documentation generation preserves the detailed cron description instead of reverting to generic text
@blink-soblink-sobotforce-pushed thefix-cron-documentation branch frome998cb2 toe810230CompareJune 4, 2025 15:06
@matifalimatifali requested a review fromCopilotJune 4, 2025 15:07
Copy link

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

This PR clarifies the cron attribute format used by the coder_script resource, addressing issue#353 by updating documentation and examples to reflect the usage of a 6-field cron format.

  • Updated cron description in resource schema and docs
  • Fixed misleading example by converting a 5-field expression to a correct 6-field expression
  • Added tests to validate cron expressions and introduced a new example for an every 5 minutes schedule

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

FileDescription
provider/script_test.goAdded tests for various cron expression scenarios
provider/script.goIntroduced ValidateCronExpression and updated the resource's validation logic
examples/resources/coder_script/resource.tfUpdated resource examples to use the correct 6-field cron format
docs/resources/script.mdUpdated documentation for the cron attribute to clarify the 6-field format

@matifalimatifali requested a review fromjohnstcnJune 4, 2025 15:17
Copy link

@jatcod3rjatcod3r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The description looks good to me! I tested out the 6-field format too and it works per what example describes.

I'm not sure about the new function though. I don't know how to test this myself, but it looks like the runner was able to verify it:https://github.com/coder/terraform-provider-coder/actions/runs/15445849660

Would be good to get someone to test out the resource change, but overall this looks great to me!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

@kylecarbskylecarbskylecarbs approved these changes

@jatcod3rjatcod3rjatcod3r approved these changes

@johnstcnjohnstcnAwaiting requested review from johnstcn

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

docs: better description for thecron attribute ofcoder_script
2 participants
@kylecarbs@jatcod3r

[8]ページ先頭

©2009-2025 Movatter.jp