Commit Graph

29 Commits

Author SHA1 Message Date
GitLab Bot 9ea23bb2f6 Add latest changes from gitlab-org/gitlab@master 2025-07-14 18:12:28 +00:00
GitLab Bot cd9a4ce166 Add latest changes from gitlab-org/gitlab@master 2024-05-30 18:15:18 +00:00
GitLab Bot 8716e15290 Add latest changes from gitlab-org/gitlab@master 2024-05-01 21:15:14 +00:00
GitLab Bot 5d831256a4 Add latest changes from gitlab-org/gitlab@master 2024-03-25 21:09:16 +00:00
GitLab Bot eba8dcc1b7 Add latest changes from gitlab-org/gitlab@master 2023-06-30 21:09:07 +00:00
GitLab Bot 4fa04f789e Add latest changes from gitlab-org/gitlab@master 2020-09-02 12:10:35 +00:00
GitLab Bot cf6a3e7ed4 Add latest changes from gitlab-org/gitlab@master 2020-02-21 15:09:05 +00:00
GitLab Bot 76623c12c1 Add latest changes from gitlab-org/gitlab@master 2020-02-05 21:09:02 +00:00
GitLab Bot 76923eae4b Add latest changes from gitlab-org/gitlab@master 2019-10-22 09:06:14 +00:00
GitLab Bot 6b75320f52 Add latest changes from gitlab-org/gitlab@master 2019-10-17 12:07:33 +00:00
GitLab Bot 80f61b4035 Add latest changes from gitlab-org/gitlab@master 2019-09-18 14:02:45 +00:00
Stan Hu b46b9d5e89 Fix pipelines not always being created after a push
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31741 introduced
a regression where not all the right parameters would be passed into
`Ci::CreatePipelineService`. We fix this by breaking out the pipeline
parameters and reusing a method from `Gitlab::DataBuilder::Push`.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/66196
2019-08-17 06:23:26 -07:00
Stan Hu 4e2bb4e5e7 Reduce Gitaly calls in PostReceive
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
2019-08-12 22:28:49 -07:00
Jonathon Reinhart f48605c796 Use all keyword args for DataBuilder::Push.build() 2019-04-25 13:54:26 +02:00
Luke Duncalfe 1883e320ea Use Gitlab::PushOptions for `ci.skip` push option
Previously the raw push option Array was sent to Pipeline::Chain::Skip.

This commit updates this class (and the chain of classes that pass the
push option parameters from the API internal `post_receive` endpoint to
that class) to treat push options as a Hash of options parsed by
GitLab::PushOptions.

The GitLab::PushOptions class takes options like this:

    -o ci.skip -o merge_request.create -o merge_request.target=branch

and turns them into a Hash like this:

    {
      ci: {
        skip: true
      },
      merge_request: {
        create: true,
        target: 'branch'
      }
    }

This now how Pipeline::Chain::Skip is determining if the `ci.skip` push
option was used.
2019-04-09 10:03:26 +12:00
Luke Duncalfe f27cba0fee
Fix private user email being visible in tag webhooks
Fixes #54721
2019-01-31 16:51:18 +01:00
Jonathon Reinhart ba781484c7 Add support for Git push options, specifically ci.skip
gitlab-org/gitlab-shell!166 added support for collecting push options
from the environment, and passing them along to the
/internal/post_receive API endpoint.

This change handles the new push_options JSON element in the payload,
and passes them on through to the GitPushService and GitTagPushService
services.

Futhermore, it adds support for the first push option, ci.skip.  With
this change, one can use 'git push -o ci.skip' to skip CI pipe
execution. Note that the pipeline is still created, but in the "skipped"
state, just like with the 'ci skip' commit message text.

Implements #18667
2018-12-31 13:57:53 -05:00
gfyoung 7e6f6e1603 Enable even more frozen string in lib/gitlab
Enables frozens string for the following:

* lib/gitlab/conflict/**/*.rb
* lib/gitlab/cross_project_access/**/*.rb
* lib/gitlab/cycle_analytics/**/*.rb
* lib/gitlab/data_builder/**/*.rb
* lib/gitlab/database/**/*.rb
* lib/gitlab/dependency_linker/**/*.rb
* lib/gitlab/diff/**/*.rb
* lib/gitlab/downtime_check/**/*.rb
* lib/gitlab/email/**/*.rb
* lib/gitlab/etag_caching/**/*.rb

Partially addresses gitlab-org/gitlab-ce#47424.
2018-11-06 22:47:32 -08:00
Takuya Noguchi 7a57e59e1a Use sample data for push event when no commits created 2018-08-31 10:27:41 +09:00
Vitaliy @blackst0ne Klachkov 614bfc3afb Use full URL of user avatar on webhook push 2017-10-05 23:54:56 +11:00
Andrew Newdigate 9f71ea0d4d Workaround for #38259 2017-09-22 18:54:35 +00:00
Stan Hu 1e53f40c25 Simplify system hook testing and guarantee test will fire
The change in !11728 would cause an arbitrary project to be chosen to test
system hooks, and it's likely that the project would not have any commits or
relevant commits to test the hook. This would prevent admins from verifying
that the hook fired. Instead of trying to create a representative hook
dynamically, just send static data to guarantee the hook will actually be
tested.

Closes #37067
2017-08-27 15:50:20 -07:00
Douwe Maan 0e355e5c92 Load and process at most 100 commits when pushing into default branch 2017-07-28 17:23:13 +02:00
Alexander Randa e0ab5618a0 Wrong data type when testing webhooks 2017-07-20 15:12:06 +00:00
Rémy Coutable c48554edc2 Merge branch 'dturner/username' into 'master'
add username field to push webhook

Closes #32136

See merge request !11272
2017-05-15 07:28:58 +00:00
David Turner 47b8516c15 Add username field to push webhook
Signed-off-by: David Turner <novalis@novalis.org>
2017-05-10 17:11:36 -04:00
Tiago Botelho 6368072fd7 improves test settings for chat notification services for empty projects 2017-04-27 18:36:10 +01:00
Alejandro Rodríguez fa3bbd449e Fix lightweight tags not processed correctly by GitTagPushService
When we updated gitlab_git to 10.4.1, `tag.target` changed from pointing
to the sha of the tag to the sha of the commit the tag points to. The
problem is that only annotated tags have `object_sha`s, lightweight tags
don't (it's nil), so (only) in their case we still need to use
`tag.target`.
2016-10-28 13:53:18 -03:00
Lin Jen-Shin d5264e8804 Simplify the name for data builder, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5620#note_13671791
2016-08-12 16:09:29 +08:00