Non-Deployment jobs (e.g. `action: prepare`, `action: verify`) turn into `manual` state when Deployment Approval is configured
Problem
Non-Deployment jobs (e.g. action: prepare
, action: verify
and action: access
) turn into manual
state when Deployment Approval is configured. If the pipeline job won't deployment, it shouldn't be affected.
Please see this typebug report #300784 (comment 1249224486). This was able to be reproduced in https://gitlab.com/dosuken-org/developer-group/approval-demo/-/pipelines/763670118.
Proposal
This should resolve the bug
diff --git a/ee/app/services/ee/ci/process_build_service.rb b/ee/app/services/ee/ci/process_build_service.rb
index d73c2579706c..7b12afb2901c 100644
--- a/ee/app/services/ee/ci/process_build_service.rb
+++ b/ee/app/services/ee/ci/process_build_service.rb
@@ -6,7 +6,7 @@ module ProcessBuildService
override :process
def process(build)
- if build.persisted_environment.try(:needs_approval?)
+ if build.persisted_environment.try(:needs_approval?) && build.deployment.present?
build.run_after_commit { |build| build.deployment&.block! }
# To populate the deployment job as manually executable (i.e. `Ci::Build#playable?`),
# we have to set `manual` to `ci_builds.when` as well as `ci_builds.status`.
As fixing this bug is a breaking change, we want to put the fix behind the feature flag (disabled by default) together with the related issue Environment.action: prepare should require the ... (#437132). Then, in %18.0 we can turn it on by default and remove the feature flag.
Edited by Anna Vovchenko