Skip to content
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

feat: Make CHECKSUM and TIMESTAMP vars available in cmds commands #1872

Merged

Conversation

niklasr22
Copy link
Contributor

@niklasr22 niklasr22 commented Oct 21, 2024

Hello, this is my attempt to fix #1735.

@niklasr22 niklasr22 closed this Oct 21, 2024
@niklasr22 niklasr22 changed the title Cmds with checksum and timestamp vars feat: Make CHECKSUM and TIMESTAMP vars available in cmds commands Oct 21, 2024
@niklasr22 niklasr22 reopened this Oct 21, 2024
@vmaerten vmaerten self-requested a review December 30, 2024 19:47
Copy link
Member

@vmaerten vmaerten left a comment

Choose a reason for hiding this comment

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

Hello
Thanks for your PR, I've left some comments!

@@ -228,7 +181,7 @@ func (e *Executor) compiledTask(call *ast.Call, evaluateShVars bool) (*ast.Task,
}
}

if len(origTask.Status) > 0 {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not a big fan of those two nested if statements.
TIMESTAMP and CHECKSUM should only be available if there are sources defined. I'd replace len(origTask.Status) > 0 with len(origTask.Source) > 0 and move it above cmds.

Copy link
Contributor Author

@niklasr22 niklasr22 Dec 31, 2024

Choose a reason for hiding this comment

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

True, good idea. I changed it like you said but now it also has the effect that .TIMESTAMP and .CHECKSUM are available in preconditions and deps. Do you want to keep it like that?

Copy link
Member

Choose a reason for hiding this comment

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

Indeed this is wanted 🙂

@niklasr22 niklasr22 force-pushed the cmds-with-checksum-and-timestamp-vars branch 2 times, most recently from 104542a to 370d528 Compare December 31, 2024 12:38
@vmaerten vmaerten self-requested a review December 31, 2024 13:01
@vmaerten
Copy link
Member

Lint job is failing. a t.Parallele is missing in your test
After that it should be good

@niklasr22 niklasr22 force-pushed the cmds-with-checksum-and-timestamp-vars branch from 370d528 to 856aa66 Compare December 31, 2024 14:33
@niklasr22 niklasr22 force-pushed the cmds-with-checksum-and-timestamp-vars branch from 856aa66 to 7d9a093 Compare December 31, 2024 14:34
Copy link
Member

@vmaerten vmaerten left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

@vmaerten vmaerten merged commit c1e14c4 into go-task:main Dec 31, 2024
14 checks passed
vmaerten added a commit that referenced this pull request Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Allow .CHECKSUM and .TIMESTAMP variables to be used in cmds
2 participants