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

Update build_deploy with allow_concurrency keyword argument #1334

Merged
merged 1 commit into from
Mar 20, 2024

Conversation

kartiki975
Copy link
Contributor

@kartiki975 kartiki975 commented Mar 19, 2024

1 of 2 PRs (2nd PR will be in an Internal Shopify service)

There is an internal Shopify ticket that hopes to separate concurrent deploys from force=true for the deploy API. To avoid overriding the whole build_deploy method in our internal service, I have updated the method signature to accept allow_concurrency field but default it to force to keep the existing implementation.

Changelog and README.md have been updated in case other users would also like to more control of the concurrency of deployments; note, that this differs from rollback whose concurrency is still limited to force.

@kartiki975 kartiki975 closed this Mar 19, 2024
@kartiki975 kartiki975 deleted the update-deploy-api branch March 19, 2024 16:20
@kartiki975 kartiki975 restored the update-deploy-api branch March 19, 2024 21:25
@kartiki975 kartiki975 reopened this Mar 19, 2024
@kartiki975 kartiki975 requested a review from a team March 20, 2024 01:15
@kartiki975 kartiki975 marked this pull request as ready for review March 20, 2024 01:15
@kartiki975 kartiki975 self-assigned this Mar 20, 2024
Copy link
Contributor

@kwboyd-shopify kwboyd-shopify left a comment

Choose a reason for hiding this comment

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

In addition to the comment about the controllers, we need to add tests for this!

accepts :require_ci, Boolean, default: false
accepts :env, Hash, default: {}
end
def create
commit = stack.commits.by_sha(params.sha) || param_error!(:sha, 'Unknown revision')
param_error!(:force, "Can't deploy a locked stack") if !params.force && stack.locked?
param_error!(:require_ci, "Commit is not deployable") if params.require_ci && !commit.deployable?
deploy = stack.trigger_deploy(commit, current_user, env: params.env, force: params.force)
deploy = stack.trigger_deploy(commit, current_user, env: params.env, force: params.force,
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to add some testing around this - as it stands, I think that if params.allow_concurrency equals false but params.force equals true, allow_concurrency is going to end up evaluated to true due to the || condition

@kartiki975 kartiki975 merged commit 261b3ad into main Mar 20, 2024
17 checks passed
@kartiki975 kartiki975 deleted the update-deploy-api branch March 20, 2024 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants