Job Trace API endpoint doesn't return JSON formatted trace output

Summary

/projects/:id/jobs/:jobId/trace.json only returns raw output.

Steps to reproduce

  1. Via the API GET the trace
GET https://gitlab.com/api/v4/projects/:id/jobs/:jobId/trace.json

What is the current bug behavior?

When you use the API to get the build trace it only returns the raw output of the build

What is the expected correct behavior?

I believe the endpoint should be capable of returning JSON formatted trace output.

I'm not sure if this is a bug or if it's expected behaviour. The reason I think it might be a bug is because jobs_controller.rb#L62 seems to set the endpoint up to return formatted JSON.

Relevant logs and/or screenshots

The UI receives JSON formatted output

Example output

{
	append: false,
	complete: true,
	html: "Running with gitlab-runner 10.5.0-rc1 (7a8e43fe)<br>  ...",
	id: 53563500,
	offset:0,
	size:1678,
	state:"eyJvZmZzZXQiOjE2NzgsIm5fb3Blbl90YWdzIjowLCJmZ19...",
	status:"success",
	total:1678,
	truncated:false,
}

Output of checks

This "bug" happens on GitLab.com API as well

Results of GitLab environment info

Expand for output related to GitLab environment info

System information System: Ubuntu 14.04 Current User: git Using RVM: no Ruby Version: 2.3.6p384 Gem Version: 2.6.13 Bundler Version:1.13.7 Rake Version: 12.3.0 Redis Version: 3.2.11 Git Version: 2.14.3 Sidekiq Version:5.0.5 Go Version: unknown

GitLab information Version: 10.4.4 Revision: 1d22950 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://git.xxxxxxxx.com HTTP Clone URL: https://git.xxxxxxxx.com/some-group/some-project.git SSH Clone URL: git@git.xxxxxxxx.com-group/some-project.git Using LDAP: no Using Omniauth: no

GitLab Shell Version: 5.11.0 Repository storage paths:

  • default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check
Checking GitLab Shell ...

GitLab Shell version >= 5.11.0 ? ... OK (5.11.0) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 167/107 ... ok 167/111 ... ok 167/112 ... ok 213/119 ... ok 217/121 ... repository is empty 167/125 ... ok 217/127 ... repository is empty 167/132 ... ok 167/140 ... repository is empty 167/157 ... ok 250/167 ... repository is empty 167/168 ... ok 329/198 ... ok 335/200 ... repository is empty 167/204 ... repository is empty 337/205 ... repository is empty 210/210 ... ok 338/213 ... ok 167/216 ... ok 167/218 ... repository is empty 167/224 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK

Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Reply by email is disabled in config/gitlab.yml Checking LDAP ...

LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet) Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 167/107 ... yes 167/111 ... yes 167/112 ... yes 213/119 ... yes 217/121 ... yes 167/125 ... yes 217/127 ... yes 167/132 ... yes 167/140 ... yes 167/157 ... yes 250/167 ... yes 167/168 ... yes 329/198 ... yes 335/200 ... yes 167/204 ... yes 337/205 ... yes 210/210 ... yes 338/213 ... yes 167/216 ... yes 167/218 ... yes 167/224 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.3.6) Git version >= 2.7.3 ? ... yes (2.14.3) Git user has default SSH configuration? ... yes Active users: ... 16

Checking GitLab ... Finished

Possible fixes

https://gitlab.com/gitlab-org/gitlab-ce/blob/v10.4.4/app/controllers/projects/jobs_controller.rb#L62

Edited Jun 26, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading