You are not logged in.

#1 2020-02-02 15:34:30

lahwaacz
Wiki Admin
From: Czech Republic
Registered: 2012-05-29
Posts: 655

[SOLVED] Gitlab runner can't upload job artifacts after Gitlab upgrade

After I upgraded Gitlab to 12.7.4-1, all gitlab-runner jobs which need to upload artifacts to the server fail with the following error:

ERROR: Uploading artifacts to coordinator... forbidden  id=22991 responseStatus=403 Forbidden status=403 Forbidden token=[FILTERED]
4014 FATAL: permission denied                           
4015 ERROR: Job failed: exit status 1

It happens for multiple gitlab-runner versions, from 12.5.0 to 12.7.0. Gitlab 12.7.5-1 from [community-testing] behaves the same.

In production_json.log on the server there are errors like this (reformated for human readability):

{'action': 'index',
 'controller': 'Gitlab::RequestForgeryProtection::Controller',
 'correlation_id': '5I2L8zQHOR7',
 'cpu_s': 0.027092899999999975,
 'db': 0.0,
 'duration': 2.51,
 'exception.   backtrace':
    ["lib/gitlab/request_forgery_protection.rb:30:in `call'",
     "lib/gitlab/request_forgery_protection.rb:34:in `verified?'",
     "lib/gitlab/auth/auth_finders.rb:180:in `verified_request?'",
     "lib/gitlab/auth/auth_finders.rb:35:in `find_user_from_warden'",
     "lib/api/api_guard.rb:70:in `find_user_from_sources'",
     "lib/api/  api_guard.rb:50:in `find_current_user!'",
     "lib/api/helpers.rb:516:in `block in initial_current_user'",
     "lib/gitlab/auth/unique_ips_limiter.rb:19:in `limit_user!'",
     "lib/api/helpers.rb:516:in `initial_current_user'",
     "lib/api/helpers.rb:51:in `current_user'",
     "lib/api/api.rb:48:in `block (2 levels) in <class:API>'",
     "lib/   gitlab/utils/lazy_attributes.rb:29:in `block (2 levels) in define_lazy_reader'",
     "lib/gitlab/utils/strong_memoize.rb:30:in `strong_memoize'",
     "lib/gitlab/utils/lazy_attributes.rb:27:in `block in define_lazy_reader'",
     "lib/gitlab/application_context.rb:62:in `username'",
     "lib/gitlab/application_context.rb:37:in `block (2  levels) in to_lazy_hash'",
     "app/models/ci/build.rb:312:in `block (3 levels) in <class:Build>'",
     "lib/after_commit_queue.rb:39:in `instance_eval'",
     "lib/after_commit_queue.rb:39:in `_run_after_commit_queue'",
     "lib/api/runner.rb:162:in `block (2 levels) in <class:Runner>'",
     "lib/api/api_guard.rb:168:in `call'"],
 'exception.class': 'ActionController::InvalidAuthenticityToken',
 'exception.message': 'ActionController::InvalidAuthenticityToken',
 'format': 'html',
 'method': 'PUT',
 'params': [{'key': 'info',
             'value': {'architecture': 'amd64',
                       'executor': 'shell',
                       'features': {'artifacts': true,
                                    'cache': true,
                                    'image': false,
                                    'masking': true,
                                    'proxy': false,
                                    'refspecs': true,
                                    'services': false,
                                    'session': true,
                                    'shared': true,
                                    'terminal': true,
                                    'upload_multiple_artifacts': true,
                                    'upload_raw_artifacts': true,
                                    'variables': '[FILTERED]'},
                       'name': 'gitlab-runner',
                       'platform': 'linux',
                       'revision': '577f813d',
                       'shell': 'bash',
                       'version': '12.5.0'}},
            {'key': 'token', 'value': '[FILTERED]'},
            {'key': 'state', 'value': 'failed'},
            {'key': 'failure_reason', 'value': 'script_failure'},
            {'key': 'request_forgery_protection',
             'value': {'failure_reason': 'script_failure',
                       'info': {'architecture': 'amd64',
                                'executor': 'shell',
                                'features': {'artifacts': true,
                                             'cache': true,
                                             'image': false,
                                             'masking': true,
                                             'proxy': false,
                                             'refspecs': true,
                                             'services': false,
                                             'session': true,
                                             'shared': true,
                                             'terminal': true,
                                             'upload_multiple_artifacts': true,
                                             'upload_raw_artifacts': true,
                                             'variables': '[FILTERED]'},
                                'name': 'gitlab-runner',
                                'platform': 'linux',
                                'revision': '577f813d',
                                'shell': 'bash',
                                'version': '12.5.0'},
                       'state': 'failed',
                       'token': '[FILTERED]'}}],
 'path': '/gitlab/api/v4/jobs/22991',
 'queue_duration': null,
 'remote_ip': null,
 'status': 422,
 'time': '2020-02-02T14:42:43.356Z',
 'ua': null,
 'user_id': null,
 'username': null,
 'view': 0.0}

Any idea how to fix it?

Last edited by lahwaacz (2020-02-03 08:59:31)

Offline

#2 2020-02-03 08:58:33

lahwaacz
Wiki Admin
From: Czech Republic
Registered: 2012-05-29
Posts: 655

Re: [SOLVED] Gitlab runner can't upload job artifacts after Gitlab upgrade

Today there was a gitlab-workhorse 8.19.0-1 → 8.20.0-1 upgrade which has fixed it for me.

Offline

Board footer

Powered by FluxBB