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

cmd: project option to disable passing variables to PR from forked repo #198

Merged
merged 1 commit into from
Jan 28, 2020

Conversation

camandel
Copy link
Contributor

Add boolean parameter to choose if pass variables to runs even when triggered by PRs (option disabled by default):

agola project [create|update] --pass-vars-to-pr=true <...>

Fixes #38

Copy link
Member

@sgotti sgotti left a comment

Choose a reason for hiding this comment

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

@camandel Thanks for your PR. Can you please also add some integration tests to check this new feature?

internal/services/gateway/action/run.go Outdated Show resolved Hide resolved
@camandel camandel force-pushed the cmd_disable_vars_pr branch from a9df525 to b5b3e3d Compare January 22, 2020 11:28
@camandel
Copy link
Contributor Author

Integration tests added

Copy link
Member

@sgotti sgotti left a comment

Choose a reason for hiding this comment

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

@camandel The integration tests looks great and made me remember that in #38 I haven't detailed that we should probably do this only on forked pull requests since pull requests from the same repos means that the users have access to the main repo.

So the option should be called something like PassVarsToForkedPR and we should check that the source and destination repositories are not the same. This will require extending the webhooks parsing the retrieve the base and head repositories and return in WebhookData something like a PRFromSameRepo bool.

tests/setup_test.go Outdated Show resolved Hide resolved
tests/setup_test.go Outdated Show resolved Hide resolved
tests/setup_test.go Outdated Show resolved Hide resolved
@camandel camandel force-pushed the cmd_disable_vars_pr branch from b5b3e3d to 69fd8a4 Compare January 25, 2020 11:45
@camandel camandel changed the title cmd: project option to disable passing variables to PR cmd: project option to disable passing variables to PR from forked repo Jan 25, 2020
Copy link
Member

@sgotti sgotti left a comment

Choose a reason for hiding this comment

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

@camandel Just some small nits and then it LGTM!

cmd/agola/cmd/projectupdate.go Outdated Show resolved Hide resolved
cmd/agola/cmd/projectcreate.go Outdated Show resolved Hide resolved
internal/services/gateway/action/run.go Outdated Show resolved Hide resolved
@camandel camandel force-pushed the cmd_disable_vars_pr branch from 69fd8a4 to 182eb14 Compare January 28, 2020 08:06
Copy link
Member

@sgotti sgotti left a comment

Choose a reason for hiding this comment

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

@camandel LGTM! Thanks! Merging.

@sgotti sgotti merged commit ec53a63 into agola-io:master Jan 28, 2020
@camandel camandel deleted the cmd_disable_vars_pr branch February 7, 2020 15:25
tulliobotti64 pushed a commit to tulliobotti64/agola that referenced this pull request Oct 19, 2022
cmd: project option to disable passing variables to PR from forked repo
tulliobotti64 pushed a commit to tulliobotti64/agola that referenced this pull request Oct 19, 2022
cmd: project option to disable passing variables to PR from forked repo
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.

Project option to disable passing variables to PR
2 participants