gitlab-org--gitlab-foss/app/models
Rémy Coutable f29fd65cdd Merge branch 'fix/incremental-trace-update-api' into 'master'
Fix UTF-8 handling in incremental trace update API

## What does this MR do?

This MR fixes invalid UTF-8 handling in incremental trace update API (used by GitLab Runner).

## Why was this MR needed?

Current version is using `.length` method to determine current trace size where Runner is using the trace size in bytes. Also this byte size is used in headers and file operations to agree the trace part to send. This is a problem when build trace contains any multi-byte UTF-8 characters. This MR is fixing this situation so all parts are using the same size in bytes.

### Runner -> API communication before fix:
```
Checking for builds... received                     runner=_token_
gitlab-ci-multi-runner 1.3.0~beta.26.gcfd63b9 (cfd63b9)  build=25 runner=_token_
Using Docker executor with image debian:jessie ...  build=25 runner=_token_
Pulling docker image debian:jessie ...              build=25 runner=_token_
25 Submitting build to coordinator... ok            runner=_token_
25 Appending trace to coordinator... ok             RemoteRange=0-158 RemoteState=running ResponseMessage=202 Accepted ResponseStatusCode=202 SentRange=0-158 runner=_token_
25 Appending trace to coordinator... ok             RemoteRange=0-491 RemoteState=running ResponseMessage=202 Accepted ResponseStatusCode=202 SentRange=158-505 runner=_token_
WARNING: 25 Appending trace to coordinator... range missmatch  RemoteRange=0-491 RemoteState= ResponseMessage=416 Requested Range Not Satisfiable ResponseStatusCode=416 SentRange=505-584 runner=_token_
WARNING: 25 Resending trace patch due to range missmatch  runner=_token_
25 Appending trace to coordinator... ok             RemoteRange=0-556 RemoteState=running ResponseMessage=202 Accepted ResponseStatusCode=202 SentRange=491-584 runner=_token_
WARNING: 25 Appending trace to coordinator... range missmatch  RemoteRange=0-556 RemoteState= ResponseMessage=416 Requested Range Not Satisfiable ResponseStatusCode=416 SentRange=584-663 runner=_token_
WARNING: 25 Resending trace patch due to range missmatch  runner=_token_
25 Appending trace to coordinator... ok             RemoteRange=0-621 RemoteState=running ResponseMessage=202 Accepted ResponseStatusCode=202 SentRange=556-663 runner=_token_
Build succeeded                                     build=25 runner=_token_
WARNING: 25 Appending trace to coordinator... range missmatch  RemoteRange=0-621 RemoteState= ResponseMessage=416 Requested Range Not Satisfiable ResponseStatusCode=416 SentRange=663-797 runner=_token_
WARNING: 25 Resending trace patch due to range missmatch  runner=_token_
25 Appending trace to coordinator... ok             RemoteRange=0-741 RemoteState=running ResponseMessage=202 Accepted ResponseStatusCode=202 SentRange=621-797 runner=_token_
25 Submitting build to coordinator... ok            runner=_token_
```

### Runner -> API communication after fix:
```
Checking for builds... received                     runner=_token_
gitlab-ci-multi-runner 1.3.0~beta.26.gcfd63b9 (cfd63b9)  build=26 runner=_token_
Using Docker executor with image debian:jessie ...  build=26 runner=_token_
Pulling docker image debian:jessie ...              build=26 runner=_token_
26 Submitting build to coordinator... ok            runner=_token_
26 Appending trace to coordinator... ok             RemoteRange=0-158 RemoteState=running ResponseMessage=202 Accepted ResponseStatusCode=202 SentRange=0-158 runner=_token_
26 Appending trace to coordinator... ok             RemoteRange=0-505 RemoteState=running ResponseMessage=202 Accepted ResponseStatusCode=202 SentRange=158-505 runner=_token_
26 Appending trace to coordinator... ok             RemoteRange=0-584 RemoteState=running ResponseMessage=202 Accepted ResponseStatusCode=202 SentRange=505-584 runner=_token_
26 Appending trace to coordinator... ok             RemoteRange=0-663 RemoteState=running ResponseMessage=202 Accepted ResponseStatusCode=202 SentRange=584-663 runner=_token_
Build succeeded                                     build=26 runner=_token_
26 Submitting build to coordinator... ok            runner=_token_
```

See merge request !4541
2016-06-10 13:08:22 +00:00
..
ci Fix UTF-8 handling in incremental trace update API 2016-06-10 13:09:34 +02:00
concerns Fix pseudo n+1 queries with Note and Note Authors in issuables APIs 2016-06-08 10:26:05 -04:00
hooks Merge branch 'hook-docs-behavior' into 'master' 2016-05-11 16:34:00 +00:00
members Add changelog and code refactor 2016-05-30 22:32:07 +07:00
network Merge branch 'style/enable-semicolon-rubocop-cop' into 'master' 2016-06-01 17:41:19 +00:00
project_services Enable Lint/AmbiguousOperator rubocop cop 2016-06-03 10:59:43 +02:00
.gitkeep
ability.rb Merge branch 'separate-banzai-references' into 'master' 2016-06-01 15:51:59 +00:00
abuse_report.rb
appearance.rb
application_setting.rb Allow custom text on 'almost there' page 2016-06-08 19:08:53 +01:00
audit_event.rb
award_emoji.rb Fix latests concerns 2016-05-18 08:47:15 -05:00
blob.rb
broadcast_message.rb
commit.rb Remove projects inclusion in notes_with_associations to skip some unnecessary queries 2016-06-08 10:26:05 -04:00
commit_range.rb Don't modify arguments in CommitRange#initialize 2016-05-26 13:58:01 +02:00
commit_status.rb Delegate to pipeline instead of commit 2016-06-03 13:34:38 +02:00
deploy_key.rb
deploy_keys_project.rb
email.rb
event.rb Reduce duplication and branching logic in EventsHelper 2016-05-16 14:52:04 -05:00
external_issue.rb
forked_project_link.rb
generic_commit_status.rb
global_label.rb
global_milestone.rb
group.rb
identity.rb
issue.rb Improve Issuable.order_labels_priority 2016-06-06 11:59:49 -05:00
jira_issue.rb
key.rb Add leading comment space cop 2016-05-31 19:33:46 -03:00
label.rb Fix label order by priority on labels page 2016-06-07 14:01:30 +01:00
label_link.rb
legacy_diff_note.rb Incorportate feedback 2016-06-01 12:10:08 +02:00
lfs_object.rb
lfs_objects_project.rb
member.rb
merge_request.rb Rename ci_commit -> pipeline 2016-06-10 14:41:38 +02:00
merge_request_diff.rb Maintain commit order in MRs 2016-05-18 17:14:55 +01:00
milestone.rb Address Yorick's feedback 2016-05-18 23:45:25 -05:00
namespace.rb Merge branch 'docker-registry' into docker-registry-view 2016-05-13 17:15:01 -05:00
note.rb Backend awardables on comments 2016-06-06 11:03:39 +02:00
notification_setting.rb Notifications dropdown on project page now has descriptions 2016-06-07 15:02:00 +01:00
oauth_access_token.rb
personal_snippet.rb
project.rb Merge remote-tracking branch 'origin/master' into rename-ci-commit 2016-06-03 13:10:01 +02:00
project_group_link.rb
project_import_data.rb Upgrade attr_encrypted and encryptor 2016-05-30 13:51:21 -06:00
project_snippet.rb Refactor Participable 2016-06-01 16:22:35 +02:00
project_team.rb
project_wiki.rb Codestyle changes 2016-05-31 11:24:58 -03:00
protected_branch.rb
release.rb
repository.rb Remove main_language and tests 2016-05-25 17:16:42 -04:00
security_event.rb
sent_notification.rb
service.rb
snippet.rb Remove projects inclusion in notes_with_associations to skip some unnecessary queries 2016-06-08 10:26:05 -04:00
spam_log.rb
spam_report.rb
subscription.rb
todo.rb Create a todo on failing MR build 2016-05-17 10:17:45 +01:00
tree.rb
u2f_registration.rb Add a U2fRegistrations table/model. 2016-06-06 12:50:31 +05:30
user.rb Add a U2fRegistrations table/model. 2016-06-06 12:50:31 +05:30
users_star_project.rb
wiki_page.rb