Skip to content

Commit

Permalink
Merge pull request #4115 from zendesk/awoo/release-log-project
Browse files Browse the repository at this point in the history
Log project name when creating a release
  • Loading branch information
anthonywoo authored Aug 26, 2024
2 parents 5282f8d + a44f65d commit 27d9522
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/controllers/integrations/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def create
create_release = project.create_release?(branch, service_type, service_name)
record_log(
:info,
"Create release for branch [#{branch}], service_type [#{service_type}], service_name [#{service_name}]: " \
"#{create_release}"
"Create release for project [#{project.name}], branch [#{branch}], service_type [#{service_type}], " \
"service_name [#{service_name}]: #{create_release}"
)
release = find_or_create_release if create_release
else
Expand Down
9 changes: 5 additions & 4 deletions test/controllers/integrations/base_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ class BaseTestController < Integrations::BaseController # rubocop:disable Lint/C
post :create, params: {test_route: true, token: token, foo: "bar"}
assert_response :success
result = WebhookRecorder.read(project)
log = "INFO: Create release for branch [master], service_type [ci], service_name [base_test]: true\n"
log = "INFO: Create release for project [Foo], branch [master], service_type [ci], " \
"service_name [base_test]: true\n"

project.reload
result.fetch(:log).must_equal log
Expand Down Expand Up @@ -192,7 +193,7 @@ class BaseTestController < Integrations::BaseController # rubocop:disable Lint/C
post :create, params: {test_route: true, token: token}

expected_messages = <<~MESSAGES
INFO: Create release for branch [master], service_type [ci], service_name [base_test]: true
INFO: Create release for project [Foo], branch [master], service_type [ci], service_name [base_test]: true
INFO: Deploying #{deploy1.id} to Staging
INFO: Deploying #{deploy2.id} to Production
MESSAGES
Expand Down Expand Up @@ -221,7 +222,7 @@ class BaseTestController < Integrations::BaseController # rubocop:disable Lint/C
post :create, params: {test_route: true, token: token, includes: 'status_urls'}

expected_messages = <<~MESSAGES
INFO: Create release for branch [master], service_type [ci], service_name [base_test]: true
INFO: Create release for project [Foo], branch [master], service_type [ci], service_name [base_test]: true
INFO: Deploying #{deploy1.id} to Staging
INFO: Deploying #{deploy2.id} to Production
MESSAGES
Expand All @@ -241,7 +242,7 @@ class BaseTestController < Integrations::BaseController # rubocop:disable Lint/C
post :create, params: {test_route: true, token: token}

message = <<~MSG
INFO: Create release for branch [master], service_type [ci], service_name [base_test]: true
INFO: Create release for project [Foo], branch [master], service_type [ci], service_name [base_test]: true
ERROR: Failed deploying to Staging: Stage is locked
INFO: Deploying #{Deploy.first.id} to Production
MSG
Expand Down

0 comments on commit 27d9522

Please sign in to comment.