NuGet packages with extended versions fail to upload
Summary
NuGet packages with a naming convention containing 3 or more periods results in a "Validation failed: Version is invalid"
error.
This was initially reported by a customer, who was able to use this naming convention as of ~1 week ago. Details can be found within https://gitlab.zendesk.com/agent/tickets/156226 (internal use).
Steps to reproduce
Attempt to publish a NuGet package to the GitLab registry with a version containing 3 or more periods. For example, a package with this version will not upload (though NuGet will claim it was uploaded successfully):
1.1.1.1
Example Project
https://gitlab.com/calebw/nuget_tests
The above package can be used to replicate the behavior. Simply adjust the version number within nuget_tests/nuget_tests/nuget_tests.csproj
, create the package and attempt to push it to GitLab.
What is the current bug behavior?
After attempting to push the package, NuGet will state the package was pushed, but nothing will be viewable within GitLab. Tailing the sidekiq logs while attempting to push will show the ActiveRecord
error.
What is the expected correct behavior?
Packages should be uploaded and viewable successfully.
If this is intended behavior as a result of recent changes, then we should add documentation stating supported versioning conventions.
Relevant logs and/or screenshots
==> /var/log/gitlab/gitlab-rails/api_json.log <==
{"time":"2020-05-08T17:09:10.863Z","severity":"INFO","duration_s":0.06,"db_duration_s":0.01,"view_duration_s":0.05,"status":201,"method":"PUT","path":"/api/v4/projects/24/packages/nuget","params":[{"key":"package.name","value":"package.nupkg"},{"key":"package.path","value":"/var/opt/gitlab/gitlab-rails/shared/packages/tmp/uploads/package.nupkg494035662"},{"key":"package.remote_id","value":""},{"key":"package.size","value":"3404"},{"key":"package.md5","value":"5d52998898c5b6385aea2b8c7fc82cc1"},{"key":"package.sha1","value":"30fede9fd168f5d80ebc213e9e30785861cf74e5"},{"key":"package.sha256","value":"f521e65bc06851c83d4d16ca1cea2469ca0ff4fb54db161f2b1f148ea97073c7"},{"key":"package.remote_url","value":""},{"key":"package.sha512","value":"850f244bb807d71b13ba57bf3b5447683ca5ec4320f99cfa8cdbcf2cc08886f10ddde635bfafae7c03f99a1c7776985f8be9b256ff7fedf4561e62bfd09fb4f5"},{"key":"package","value":null}],"host":"gitlab.technotion.co","remote_ip":"redacted","ua":"NuGet Command Line/5.5.1 (Microsoft Windows NT 10.0.18363.0)","route":"/api/:version/projects/:id/packages/nuget","user_id":3,"username":"caleb","queue_duration_s":0.01,"redis_calls":3,"redis_duration_s":0.0,"correlation_id":"hVHD5ODN806"}
==> /var/log/gitlab/gitlab-rails/sidekiq.log <==
{"severity":"INFO","time":"2020-05-08T17:09:10.858Z","class":"Packages::Nuget::ExtractionWorker","retry":3,"queue":"package_repositories:packages_nuget_extraction","queue_namespace":"package_repositories","jid":"32653088cbe4d0ab5746eb15","created_at":"2020-05-08T17:09:10.855Z","meta.user":"caleb","meta.caller_id":"/api/:version/projects/:id/packages/nuget","correlation_id":"hVHD5ODN806","enqueued_at":"2020-05-08T17:09:10.857Z","pid":20376,"message":"Packages::Nuget::ExtractionWorker JID-32653088cbe4d0ab5746eb15: start","job_status":"start","scheduling_latency_s":0.0}
{"severity":"WARN","time":"2020-05-08T17:09:10.880Z","class":"Packages::Nuget::ExtractionWorker","retry":3,"queue":"package_repositories:packages_nuget_extraction","queue_namespace":"package_repositories","jid":"32653088cbe4d0ab5746eb15","created_at":"2020-05-08T17:09:10.855Z","meta.user":"caleb","meta.caller_id":"/api/:version/projects/:id/packages/nuget","correlation_id":"hVHD5ODN806","enqueued_at":"2020-05-08T17:09:10.857Z","pid":20376,"message":"Packages::Nuget::ExtractionWorker JID-32653088cbe4d0ab5746eb15: fail: 0.02 sec","job_status":"fail","scheduling_latency_s":0.0,"duration_s":0.02,"cpu_s":0.02,"completed_at":"2020-05-08T17:09:10.880Z","error_message":"Sidekiq::JobRetry::Skip","error_class":"Sidekiq::JobRetry::Skip","db_duration_s":0.01}
{"severity":"WARN","time":"2020-05-08T17:09:10.881Z","error_class":"ActiveRecord::RecordInvalid","error_message":"Validation failed: Version is invalid","context":"Job raised exception","jobstr":"{\"class\":\"Packages::Nuget::ExtractionWorker\",\"args\":[127],\"retry\":3,\"queue\":\"package_repositories:packages_nuget_extraction\",\"queue_namespace\":\"package_repositories\",\"jid\":\"32653088cbe4d0ab5746eb15\",\"created_at\":1588957750.8552759,\"meta.user\":\"caleb\",\"meta.caller_id\":\"/api/:version/projects/:id/packages/nuget\",\"correlation_id\":\"hVHD5ODN806\",\"enqueued_at\":1588957750.8572557}","class":"Packages::Nuget::ExtractionWorker","args":["127"],"retry":3,"queue":"package_repositories:packages_nuget_extraction","queue_namespace":"package_repositories","jid":"32653088cbe4d0ab5746eb15","created_at":"2020-05-08T17:09:10.855Z","meta.user":"caleb","meta.caller_id":"/api/:version/projects/:id/packages/nuget","correlation_id":"hVHD5ODN806","enqueued_at":"2020-05-08T17:09:10.857Z","error_backtrace":["ee/app/services/packages/nuget/update_package_from_metadata_service.rb:53:in `update_linked_package'","ee/app/services/packages/nuget/update_package_from_metadata_service.rb:21:in `block in execute'","lib/gitlab/database.rb:318:in `transaction'","ee/app/services/packages/nuget/update_package_from_metadata_service.rb:17:in `execute'","ee/app/workers/packages/nuget/extraction_worker.rb:16:in `perform'","lib/gitlab/with_request_store.rb:7:in `with_request_store'","lib/gitlab/sidekiq_daemon/monitor.rb:49:in `within_job'"]}
==> /var/log/gitlab/sidekiq/current <==
{"severity":"INFO","time":"2020-05-08T17:09:10.858Z","class":"Packages::Nuget::ExtractionWorker","retry":3,"queue":"package_repositories:packages_nuget_extraction","queue_namespace":"package_repositories","jid":"32653088cbe4d0ab5746eb15","created_at":"2020-05-08T17:09:10.855Z","meta.user":"caleb","meta.caller_id":"/api/:version/projects/:id/packages/nuget","correlation_id":"hVHD5ODN806","enqueued_at":"2020-05-08T17:09:10.857Z","pid":20376,"message":"Packages::Nuget::ExtractionWorker JID-32653088cbe4d0ab5746eb15: start","job_status":"start","scheduling_latency_s":0.0}
{"severity":"WARN","time":"2020-05-08T17:09:10.880Z","class":"Packages::Nuget::ExtractionWorker","retry":3,"queue":"package_repositories:packages_nuget_extraction","queue_namespace":"package_repositories","jid":"32653088cbe4d0ab5746eb15","created_at":"2020-05-08T17:09:10.855Z","meta.user":"caleb","meta.caller_id":"/api/:version/projects/:id/packages/nuget","correlation_id":"hVHD5ODN806","enqueued_at":"2020-05-08T17:09:10.857Z","pid":20376,"message":"Packages::Nuget::ExtractionWorker JID-32653088cbe4d0ab5746eb15: fail: 0.02 sec","job_status":"fail","scheduling_latency_s":0.0,"duration_s":0.02,"cpu_s":0.02,"completed_at":"2020-05-08T17:09:10.880Z","error_message":"Sidekiq::JobRetry::Skip","error_class":"Sidekiq::JobRetry::Skip","db_duration_s":0.01}
{"severity":"WARN","time":"2020-05-08T17:09:10.881Z","error_class":"ActiveRecord::RecordInvalid","error_message":"Validation failed: Version is invalid","context":"Job raised exception","jobstr":"{\"class\":\"Packages::Nuget::ExtractionWorker\",\"args\":[127],\"retry\":3,\"queue\":\"package_repositories:packages_nuget_extraction\",\"queue_namespace\":\"package_repositories\",\"jid\":\"32653088cbe4d0ab5746eb15\",\"created_at\":1588957750.8552759,\"meta.user\":\"caleb\",\"meta.caller_id\":\"/api/:version/projects/:id/packages/nuget\",\"correlation_id\":\"hVHD5ODN806\",\"enqueued_at\":1588957750.8572557}","class":"Packages::Nuget::ExtractionWorker","args":["127"],"retry":3,"queue":"package_repositories:packages_nuget_extraction","queue_namespace":"package_repositories","jid":"32653088cbe4d0ab5746eb15","created_at":"2020-05-08T17:09:10.855Z","meta.user":"caleb","meta.caller_id":"/api/:version/projects/:id/packages/nuget","correlation_id":"hVHD5ODN806","enqueued_at":"2020-05-08T17:09:10.857Z","error_backtrace":["ee/app/services/packages/nuget/update_package_from_metadata_service.rb:53:in `update_linked_package'","ee/app/services/packages/nuget/update_package_from_metadata_service.rb:21:in `block in execute'","lib/gitlab/database.rb:318:in `transaction'","ee/app/services/packages/nuget/update_package_from_metadata_service.rb:17:in `execute'","ee/app/workers/packages/nuget/extraction_worker.rb:16:in `perform'","lib/gitlab/with_request_store.rb:7:in `with_request_store'","lib/gitlab/sidekiq_daemon/monitor.rb:49:in `within_job'"]}
Output of checks
This bug happens on GitLab.com (13.0.0-pre 9bf75ddb) and self-managed (12.10.3-ee).
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Debian 9.11 Proxy: no Current User: git Using RVM: no Ruby Version: 2.6.5p114 Gem Version: 2.7.10 Bundler Version:1.17.3 Rake Version: 12.3.3 Redis Version: 5.0.7 Git Version: 2.26.2 Sidekiq Version:5.2.7 Go Version: unknown GitLab information Version: 12.10.3-ee Revision: 7c0ab260960 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 11.7 URL: https://gitlab.technotion.co HTTP Clone URL: https://gitlab.technotion.co/some-group/some-project.git SSH Clone URL: git@gitlab.technotion.co:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers: GitLab Shell Version: 12.2.0 Repository storage paths: - default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab Shell ... FinishedChecking Gitaly ...
Gitaly: ... default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab App ...
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: ... 1/1 ... yes 1/2 ... yes 3/3 ... yes 3/4 ... yes 3/5 ... yes 3/8 ... yes 3/10 ... yes 3/12 ... yes 3/13 ... yes 3/14 ... yes 3/17 ... yes 3/18 ... yes 5/19 ... yes 5/20 ... yes 3/21 ... yes 3/22 ... yes 3/23 ... yes 3/24 ... yes 20/25 ... yes Redis version >= 4.0.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.6.5) Git version >= 2.22.0 ? ... yes (2.26.2) Git user has default SSH configuration? ... yes Active users: ... 13 Is authorized keys file accessible? ... yes Elasticsearch version 5.6 - 6.x? ... skipped (elasticsearch is disabled)
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)