-
Notifications
You must be signed in to change notification settings - Fork 115
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
Trigger command #1570
base: main
Are you sure you want to change the base?
Trigger command #1570
Conversation
…ltiple trigger commands
Hi @rochana-atapattu. Thanks for your PR. I'm waiting for a jenkins-x member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the jenkins-x/lighthouse repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Please give a description with the purpose of the PR |
thank you for having a look at this, I have updated the description above |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your new code lines need to have their indentation adjusted to correspond to the surrounding code
if arg != "" { | ||
for i := range toTest { | ||
toTest[i].Base.PipelineRunParams = append(toTest[i].Base.PipelineRunParams , job.PipelineRunParam{ | ||
Name: "TRIGGER_COMMAND_ARG", | ||
ValueTemplate: arg, | ||
}) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The feature should be documented and unit test added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
836cdca adding in unit tests. please let me know if I have missed anything. I updated the code so that handleGenericComment take in the command arg.
documentation for this feature is in
lighthouse/docs/trigger/README.md
Line 5 in 1b48028
When these commands are triggered using ChatOps, Lighthouse will store the command arg in TRIGGER_COMMAND_ARG PipelineRunPara which you can refer from the pipeline. |
|
||
plugins.RegisterPlugin(pluginName, plugin) | ||
customTriggerCommand := os.Getenv(customerTriggerCommandEnvVar) | ||
for _, trigger := range strings.Split(customTriggerCommand, ","){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you not already do this using a regex pattern for the customDeploymentTriggerCommand like: build|plan|apply
?
We are doing this currently to trigger builds with /build
commands and Terraform plans/applies with /plan
and /apply
commands. Perhaps the docs just need to be updated to make this clearer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree. This is interpreted as a regexp, so I think you should revert this change and update the documentation and tests accordingly.
/ok-to-test |
|
||
plugins.RegisterPlugin(pluginName, plugin) | ||
customTriggerCommand := os.Getenv(customerTriggerCommandEnvVar) | ||
for _, trigger := range strings.Split(customTriggerCommand, ","){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree. This is interpreted as a regexp, so I think you should revert this change and update the documentation and tests accordingly.
with this change we can pass a parameter to out pipeline and use that parameter in the pipeline
eg:
/deploy dev
TRIGGER_COMMAND_ARG=dev