summaryrefslogtreecommitdiff
path: root/spec/workers
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'dm-process-commit-worker-n+1' into 'master'Stan Hu2019-08-161-40/+0
|\ | | | | | | | | | | | | Look up upstream commits once before queuing ProcessCommitWorkers Closes #65464 See merge request gitlab-org/gitlab-ce!31871
| * Look up upstream commits once before queuing ProcessCommitWorkersDouwe Maan2019-08-161-40/+0
| | | | | | | | | | | | | | | | Instead of checking if a commit already exists in the upstream project in its ProcessCommitWorker and bailing out if it does, we check the existence of all commits in bulk in Git::BranchHooksService, so that we can skip scheduling ProcessCommitWorker jobs for those commits that already exist upstream entirely.
* | Expire project caches once per push instead of once per refStan Hu2019-08-162-5/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously `ProjectCacheWorker` would be scheduled once per ref, which would generate unnecessary I/O and load on Sidekiq, especially if many tags or branches were pushed at once. `ProjectCacheWorker` would expire three items: 1. Repository size: This only needs to be updated once per push. 2. Commit count: This only needs to be updated if the default branch is updated. 3. Project method caches: This only needs to be updated if the default branch changes, but only if certain files change (e.g. README, CHANGELOG, etc.). Because the third item requires looking at the actual changes in the commit deltas, we schedule one `ProjectCacheWorker` to handle the first two cases, and schedule a separate `ProjectCacheWorker` for the third case if it is needed. As a result, this brings down the number of `ProjectCacheWorker` jobs from N to 2. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/52046
* | Merge branch 'sh-optimize-commit-deltas-post-receive' into 'master'Nick Thomas2019-08-141-0/+2
|\ \ | | | | | | | | | | | | | | | | | | Reduce Gitaly calls in PostReceive Closes #65878 See merge request gitlab-org/gitlab-ce!31741
| * | Reduce Gitaly calls in PostReceivesh-optimize-commit-deltas-post-receiveStan Hu2019-08-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit reduces I/O load and memory utilization during PostReceive for the common case when no project hooks or services are set up. We saw a Gitaly N+1 issue in `CommitDelta` when many tags or branches are pushed. We can reduce this overhead in the common case because we observe that most new projects do not have any Web hooks or services, especially when they are first created. Previously, `BaseHooksService` unconditionally iterated through the last 20 commits of each ref to build the `push_data` structure. The `push_data` structured was used in numerous places: 1. Building the push payload in `EventCreateService` 2. Creating a CI pipeline 3. Executing project Web or system hooks 4. Executing project services 5. As the return value of `BaseHooksService#execute` 6. `BranchHooksService#invalidated_file_types` We only need to generate the full `push_data` for items 3, 4, and 6. Item 1: `EventCreateService` only needs the last commit and doesn't actually need the commit deltas. Item 2: In addition, `Ci::CreatePipelineService` only needed a subset of the parameters. Item 5: The return value of `BaseHooksService#execute` also wasn't being used anywhere. Item 6: This is only used when pushing to the default branch, so if many tags are pushed we can save significant I/O here. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/65878 Fic
* | | Add usage pings for source code pushesIgor2019-08-131-13/+24
| | | | | | | | | | | | Source Code Usage Ping for Create SMAU
* | | Rework retry strategy for remote mirrorsBob Van Landuyt2019-08-131-70/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | **Prevention of running 2 simultaneous updates** Instead of using `RemoteMirror#update_status` and raise an error if it's already running to prevent the same mirror being updated at the same time we now use `Gitlab::ExclusiveLease` for that. When we fail to obtain a lease in 3 tries, 30 seconds apart, we bail and reschedule. We'll reschedule faster for the protected branches. If the mirror already ran since it was scheduled, the job will be skipped. **Error handling: Remote side** When an update fails because of a `Gitlab::Git::CommandError`, we won't track this error in sentry, this could be on the remote side: for example when branches have diverged. In this case, we'll try 3 times scheduled 1 or 5 minutes apart. In between, the mirror is marked as "to_retry", the error would be visible to the user when they visit the settings page. After 3 tries we'll mark the mirror as failed and notify the user. We won't track this error in sentry, as it's not likely we can help it. The next event that would trigger a new refresh. **Error handling: our side** If an unexpected error occurs, we mark the mirror as failed, but we'd still retry the job based on the regular sidekiq retries with backoff. Same as we used to The error would be reported in sentry, since its likely we need to do something about it.
* | | Only expire tag cache once per pushsh-only-flush-tags-once-per-pushStan Hu2019-08-131-4/+26
| |/ |/| | | | | | | | | | | | | | | | | Previously each tag in a push would invoke the Gitaly `FindAllTags` RPC since the tag cache would be invalidated with every tag. We can eliminate those extraneous calls by expiring the tag cache once in `PostReceive` and taking advantage of the cached tags. Relates to https://gitlab.com/gitlab-org/gitlab-ce/issues/65795
* | Merge branch '65803-invalidate-branches-cache-on-refresh' into 'master'Bob Van Landuyt2019-08-131-7/+25
|\ \ | | | | | | | | | | | | Only expire branch cache once per push See merge request gitlab-org/gitlab-ce!31653
| * | Rename branches_exist? -> includes_branches?65803-invalidate-branches-cache-on-refreshStan Hu2019-08-091-3/+8
| | |
| * | Invalidate branches cache on PostReceivePatrick Bajao2019-08-091-6/+19
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Whenever `PostReceive` is enqueued, `UpdateMergeRequestsWorker` is enqueued and `MergeRequests::RefreshService` is called, it'll check if the source branch of each MR asssociated to the push exists or not via `MergeRequest#source_branch_exists?`. The said method will call `Repository#branch_exists?` which is cached in `Rails.cache`. When the cache contains outdated data and the source branch actually exists, the `MergeRequests#RefreshService` job will close associated MRs which is not correct. The fix is to expire the branches cache of the project so we have updated data during the post receive hook which will help in the accuracy of the check if we need to close associated MRs or not.
* | Remove unused `BuildProcessWorker`Kamil Trzciński2019-08-131-26/+0
|/ | | | | We migrated all logic to `PipelineProcessWorker` and this worker become redundant.
* Merge branch 'prefer-to-use-process-pipeline-worker' into 'master'Sean McGivern2019-08-052-1/+12
|\ | | | | | | | | Extend PipelineProcessWorker to accept a list of builds See merge request gitlab-org/gitlab-ce!31425
| * Extend PipelineProcessWorker to accept a list of buildsprefer-to-use-process-pipeline-workerKamil Trzciński2019-08-022-1/+12
| | | | | | | | | | | | | | This changes used worker from `BuildProcessWorker` to `PipelineProcessWorker` to make pipeline processing much simpler. We process `pipeline_id`, based on some triggers.
* | Removes update_statistics_namespace feature flagMayra Cabrera2019-08-022-21/+0
|/ | | | | | | | After measuring the impact of the namespace storage on https://gitlab.com/gitlab-org/gitlab-ce/issues/64092. It was decided that it's performant enough. So we can freely remove the feature flag Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/64092
* Add support for DAGKamil Trzciński2019-08-011-0/+26
| | | | | | This implements the support for `needs:` keyword as part of GitLab CI. That makes some of the jobs to be run out of order.
* Remove unused Clusters::RefreshServiceTiger2019-07-292-85/+0
| | | | | | Also removes all logic from ClusterConfigureWorker and ClusterProjectConfigureWorker, which are also no longer used.
* Remove dead MySQL codeNick Thomas2019-07-231-14/+6
| | | | None of this code can be reached any more, so it can all be removed
* Validate the existence of archived traces before removing live tracesafe-archiving-for-tracesShinya Maeda2019-07-233-7/+6
| | | | | Often live traces are removed even though the archived trace doesn't exist. This commit checkes the existence strictly.
* Schedule namespace aggregation in other contextsMayra Cabrera2019-07-081-0/+14
| | | | | | | Schedules a Namespace::AggregationSchedule worker if some of the project statistics are refreshed. The worker is only executed if the feature flag is enabled.
* Implements lease_release on NamespaceAggregationMayra Cabrera2019-07-041-14/+25
| | | | | | | Sets lease_release? to false to prevent the job to be re-executed more often than lease timeout Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/64079
* Includes logic to persist namespace statisticsMayra Cabrera2019-07-023-0/+189
| | | | | | | | | | | | | | | | | | | | | - Add two new ActiveRecord models: - RootNamespaceStoragestatistics will persist root namespace statistics - NamespaceAggregationSchedule will save information when a new update to the namespace statistics needs to be scheduled - Inject into UpdateProjectStatistics concern a new callback that will call an async job to insert a new row onto NamespaceAggregationSchedule table - When a new row is inserted a new job is scheduled. This job will update call an specific service to update the statistics and after that it will delete thee aggregated scheduled row - The RefresherServices makes heavy use of arel to build composable queries to update Namespace::RootStorageStatistics attributes. - Add an extra worker to traverse pending rows on NAmespace::AggregationSchedule table and schedule a worker for each one of this rows. - Add an extra worker to traverse pending rows on NAmespace::AggregationSchedule table and schedule a worker for each one of this rows
* Merge branch '61156-instance-level-cluster-pod-terminal-access' into 'master'Thong Kuah2019-06-271-4/+3
|\ | | | | | | | | | | | | Instance-level cluster pod terminal access Closes #55489, #55488, #55487, and #61156 See merge request gitlab-org/gitlab-ce!28613
| * Move terminal construction logic to Environment61156-instance-level-cluster-pod-terminal-accessTiger2019-06-251-4/+3
| | | | | | | | | | | | | | | | This enables terminals for group and project level clusters. Previously there was no way to determine which project (and therefore kubernetes namespace) to connect to, moving this logic onto Environment means the assoicated project can be used to look up the correct namespace.
* | Use project depended feature flag for pages sslpages-ssl-project-aware-feature-flagVladimir Shushlin2019-06-252-9/+23
|/ | | | | Also add ::Gitlab::LetsEncrypt.enabled? shortcut and simplify it a lot
* Renew Let's Encrypt certificatesVladimir Shushlin2019-06-242-0/+94
| | | | | | | | Add index for pages domain ssl auto renewal Add PagesDomain.needs_ssl_renewal scope Add cron worker for ssl renewal Add worker for ssl renewal Add pages ssl renewal worker queues settings
* Merge branch 'remove_create_deployment_from_build_success_worker' into 'master'Douwe Maan2019-06-241-44/+0
|\ | | | | | | | | | | | | Remove deprecated call in BuildSuccessWorker Closes #63622 See merge request gitlab-org/gitlab-ce!29958
| * Remove deprecated call in BuildSuccessWorkerremove_create_deployment_from_build_success_workerThong Kuah2019-06-241-44/+0
| | | | | | | | | | We now create_deployment on Ci::Build create. No need to call create_deployment again
* | Merge branch '60617-enable-project-cluster-jit' into 'master'Thong Kuah2019-06-241-7/+0
|\ \ | |/ |/| | | | | Enable JIT Kubernetes resource creation for project level clusters See merge request gitlab-org/gitlab-ce!29515
| * Enable project-level JIT resource creation60617-enable-project-cluster-jitTiger2019-06-181-7/+0
| | | | | | | | | | | | | | | | | | | | Previously this behaviour was only available to group and instance-level clusters, as some project clusters relied on Kubernetes credentials being passed through to the runner instead of having their resources managed by GitLab (which is not available when using JIT). These clusters have been migrated to unmanaged, so resources can be created on demand for the remaining managed clusters.
* | Add 2nd response for container api bulk deleteSteve Abrams2019-06-181-8/+0
|/ | | | | | | The bulk delete api endpoint for container registries can only be called once per hour. If a user calls the endpoint more than once per hour, they will now receive a 400 error with a descriptive message.
* Make KubernetesService readonlyJames Fargher2019-06-181-10/+0
| | | | | | | | We are deprecating this service in favor of instance wide clusters. Therefore we removed some code that is not anymore needed for a readonly cluster and also we added some flags to allow for this deprecation. These flags are to be removed in the next release when we finally completelly remove KubernetesService.
* Merge branch 'error-pipelines-for-blocked-users' into 'master'Grzegorz Bizon2019-06-171-1/+2
|\ | | | | | | | | | | | | Preventing blocked users and their PipelineSchdules from creating new Pipelines Closes #47756 See merge request gitlab-org/gitlab-ce!27318
| * preventing blocked users and their PipelineSchdules from creating new Pipelinesdrew cimino2019-06-041-1/+2
| | | | | | | | updated several specs and factories to accomodate new permissions
* | Delete unauthorized Todos when project is privateissue_49897Felipe Artur2019-06-051-3/+10
| | | | | | | | | | Delete Todos for guest users when project visibility level is updated to private.
* | Ensure DB is writable before continuing jobs11925-geo-sidekiq-nodes-try-to-run-jobs-even-thought-db-is-readonlyAsh McKenzie2019-06-052-0/+14
|/ | | | | | | In the context of a Geo setup, some jobs can be running on a Geo secondary where the database is read-only and therefore we should guard against various jobs attempting to write.
* Merge branch 'introduce-auto-merge-process-worker' into 'master'Thong Kuah2019-06-042-27/+31
|\ | | | | | | | | Introduce sidekiq worker for auto merge process See merge request gitlab-org/gitlab-ce!28780
| * Introduce sidekiq worker for auto merge processintroduce-auto-merge-process-workerShinya Maeda2019-06-042-27/+31
| | | | | | | | | | As we have a central domain for auto merge process today, we should use a single worker for any auto merge process.
* | Merge branch ↵Kamil Trzciński2019-06-042-56/+33
|\ \ | |/ |/| | | | | | | | | | | | | 'set-real-next-run-at-for-preventing-duplciate-pipeline-creations' into 'master' Make pipeline schedule worker resilient Closes gitlab-com/gl-infra/production#805 and #61955 See merge request gitlab-org/gitlab-ce!28407
| * Make pipeline schedule worker resilientset-real-next-run-at-for-preventing-duplciate-pipeline-creationsShinya Maeda2019-06-032-56/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, pipeline schedule worker is unstable because it's sometimes killed by excessive memory consumption. In order to improve the performance, we add the following fixes: 1. next_run_at is always real_next_run, which means the value always takes into account of worker's cron schedule 1. Remove exlusive lock. This is already covered by real_next_run change. 1. Use RunPipelineScheduleWorker for avoiding memory killer. Memory consumption is spread to the multiple sidekiq worker.
* | Abstract auto merge processesShinya Maeda2019-06-031-4/+5
|/ | | | | | | | | | | | We have one auto merge strategy today - Merge When Pipeline Succeeds. In order to add more strategies for Merge Train feature, we abstract the architecture to be more extensible. Removed arguments Fix spec
* Remove legacy artifact related coderemove-legacy-artifacts-related-codeShinya Maeda2019-05-311-3/+3
| | | | | | We've already migrated all the legacy artifacts to the new realm, which is ci_job_artifacts table. It's time to remove the old code base that is no longer used.
* Add wiki size to project statisticsPeter Marko2019-05-291-2/+3
|
* Expire pipeline cache on finishmc/bug/pipeline-cache-invalidMatija Čupić2019-05-211-0/+1
|
* Remove remove_disabled_domains feature flagVladimir Shushlin2019-05-201-15/+0
|
* Stop configuring group clusters on creation60379-remove-ci-preparing-state-feature-flagTiger2019-05-161-19/+2
| | | | | | | | | | | Immediate configuration is not ideal for group and instance level clusters as projects that may never be deployed would still have Kubernetes namespaces and service accounts created for them. As of https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/25586 we now create only the resources that are required for the project being deployed, at the time of deployment.
* Change DetectRepositoryLanguagesWorker to not receive userDiego Silva2019-05-091-9/+2
| | | | Fixes #60425
* Add gitlab-managed option to clusters formMayra Cabrera2019-05-031-0/+10
| | | | | | | | When this option is enabled, GitLab will create namespaces and service accounts as usual. When disabled, GitLab wont create any project specific kubernetes resources Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/56557
* Use git_garbage_collect_worker to run pack_refsJan Provaznik2019-05-021-0/+13
| | | | | | | | PackRefs is not an expensive gitaly call - we want to call it more often (than as part of full `gc`) because it helps to keep number of refs files small - too many refs file may be a problem for deployments with slow storage.
* Remove disabled pages domainsVladimir Shushlin2019-04-302-4/+46
| | | | | Domain will be removed by verification worker after 1 week of being disabled