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

Show a helpful error message if debug mode is not enabled #1121

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ rvm: 2.6.5
script: "bundle exec rake knapsack:rspec"

addons:
- snaps:
- name: docker
channel: latest/beta
snaps:
- name: docker
channel: latest/beta

env:
global:
Expand Down Expand Up @@ -38,4 +38,4 @@ jobs:
install: echo skip
before_script: echo skip
script: make ship
if: commit_message =~ /ship:docker/ OR env(SHIP_DOCKER) = true or branch = master
if: (commit_message =~ /ship:docker/ OR env(SHIP_DOCKER) = true or branch = master) and type != pull_request
1 change: 1 addition & 0 deletions lib/travis/api/v3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def location(env)
AlreadySyncing = ClientError .create('sync already in progress', status: 409)
BuildAlreadyRunning = ClientError .create('build already running, cannot restart', status: 409)
BuildNotCancelable = ClientError .create('build is not running, cannot cancel', status: 409)
DebugUnavailable = ClientError .create('debug mode not enabled', status: 403)
DuplicateResource = ClientError .create('resource already exists', status: 409)
EntityMissing = NotFound .create(type: 'not_found')
InsufficientAccess = ClientError .create(status: 403)
Expand Down
4 changes: 2 additions & 2 deletions lib/travis/api/v3/services/job/debug.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ class Services::Job::Debug < Service

def run
@job = check_login_and_find(:job)
raise WrongCredentials unless job.repository.debug_tools_enabled?

access_control.permissions(job).debug!
raise DebugUnavailable unless job.repository.debug_tools_enabled?

return repo_migrated if migrated?(job.repository)

job.debug_options = debug_data
Expand Down
4 changes: 2 additions & 2 deletions spec/v3/services/job/debug_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
example { expect(last_response.status).to be == 403 }
example { expect(JSON.load(body)).to include(
"@type" => "error",
"error_message" => "access denied",
"error_type" => "wrong_credentials"
"error_message" => "debug mode not enabled",
"error_type" => "debug_unavailable"
)}
end
end
Expand Down