Commit Graph

237 Commits

Author SHA1 Message Date
Grzegorz Bizon f57cfdb6b5 Update order of build transition callbacks 2016-10-04 14:43:58 +02:00
Grzegorz Bizon 7d4767fb48 Extract updating pipeline status to async worker 2016-10-04 14:43:24 +02:00
Grzegorz Bizon 578638742a Use internal commit status API to check if finished 2016-10-04 14:43:24 +02:00
Grzegorz Bizon 68774452a4 Fix async pipeline and remove unrelated changes 2016-10-04 14:42:32 +02:00
Lin Jen-Shin 752a4cce51 Add test for CommitStatus.exclude_ignored 2016-10-03 18:56:32 +08:00
Kamil Trzcinski 4567e624a0 Make pipeline processing asynchronous
Conflicts:
	app/models/ci/pipeline.rb
	app/models/commit_status.rb
2016-10-03 12:34:05 +02:00
Lin Jen-Shin 705d210c73 Style/EmptyLinesAroundBlockBody 2016-10-03 18:33:43 +08:00
Lin Jen-Shin 23e0a3ee7d Specify 3 cases we want them to be excluded. [ci skip] 2016-10-03 18:25:18 +08:00
Lin Jen-Shin 8dfec32d2b Rename ignored to failed_but_allowed, introduce exclude_ignored
which merges previous exclude_ignored_jobs and failed_but_allowed,
so that we don't treat ignored a special case in HasStatus.
2016-10-03 18:22:51 +08:00
Kamil Trzcinski de61efed0f Fix processing of events when build finished.
This solves Pipelines in `running` after all stages do finish.
2016-09-19 15:06:26 +02:00
Rémy Coutable 7b25add30f Merge branch 'group-similar' into 'master'
Group similar builds

We group builds by removing from the builds name two numbers which are delimited by whitespace or colon:
* `name 0 1` => `name`
* `name 0:1` => `name`
* `name 0/1` => `name`
* `name 0:1 ruby` => `name ruby`
* `name 0/1 ruby` => `name ruby`
* `0 1 name ruby` => `name ruby`
* `0:1 name ruby` => `name ruby`
* `0/1 name ruby` => `name ruby`

See merge request !6242
2016-09-15 15:41:15 +00:00
Kamil Trzcinski b964c6c579 Add grouping tests 2016-09-14 15:04:12 +02:00
Lin Jen-Shin 6baf9971db Revert "reload instead, so that we don't have to change order"
This reverts commit 575dc2b0d7.
2016-09-12 21:27:46 +08:00
Lin Jen-Shin 575dc2b0d7 reload instead, so that we don't have to change order 2016-09-12 20:37:44 +08:00
Lin Jen-Shin 683d8b7f00 Fix the ordering of transition callbacks:
Because pipeline status could be changed for the builds in the next
stages, if we process next stages first, the current build would be
out of synchronized, and would need a reload for that matter.

Alternatively, like what I did in this commit, we could process the
next stages later (by using `after_transition` rather than
`around_transition`), and complete what're doing for the current
build first. This way we don't have to reload because nothing is
out synchronized.

Note that since giving `false` in `after_transition` would halt the
callbacks chain, according to:

https://github.com/state-machines/state_machines-activemodel/blob/v0.4.0/lib/state_machines/integrations/active_model.rb#L426-L429

We'll need to make sure we're not returning false because we don't
intend to interrupt the chain.

This fixes #22010.

After this fix, both pipeline events and build events would only show
up once.
2016-09-12 18:55:49 +08:00
Kamil Trzcinski d392f147fc Group similar builds 2016-09-07 14:52:13 +02:00
Robert Speicher 34a472f674 Merge branch 'statuseable-hasstatus' into 'master'
rename Statuseable to HasStatus

## What does this MR do?

- Rename all instances of Statuseable in the codebase, to HasStatus
- Rename all files from statuseable to has_status

## What are the relevant issue numbers?

Closes #21103 

See merge request !6003
2016-08-25 18:49:03 +00:00
Paco Guzman 6280fd3777 Reduce number of database queries on builds tab 2016-08-25 14:42:18 +02:00
De Wet Blomerus 23bed91b3f rename Statuseable to HasStatus 2016-08-25 04:55:32 +02:00
Robert Speicher c711fe15dd Merge branch 'mark-as-processable' into 'master'
Make all future skipped builds as processable when retrying a build

## What does this MR do?

Makes a builds that are marked as skipped when a pipeline is processed to be reprocessed by changing their's state to created.

## Why was this MR needed?

Currently retry is broken. When you retry a build of pipeline it will succeed and be marked as succeeded, when the next stages should be triggered.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/21066

See merge request !5879
2016-08-19 18:35:07 +00:00
Kamil Trzcinski 71db3b1ce7 Make all future skipped builds as processable when retrying a build 2016-08-18 22:36:54 +01:00
Lin Jen-Shin 0ea81ae50a Merge remote-tracking branch 'upstream/pipeline-hooks-without-slack' into wall-clock-time-for-showing-pipeline
* upstream/pipeline-hooks-without-slack:
  Make explicit call for all event types for ProjectHook factory
  Capitalise URL on web_hooks/form
  Remove changes not related to this MR
  Added documentation for pipeline hooks
  Rename queue to enqueue in tests
  Instrument Project.visible_to_user
  Fix build play failure
  Update ruby 2.3.1
  Improve transition between states for event `enqueue`
  Use event `enqueue` instead of `queue`
  Fix test failures
  Fix bug where destroying a namespace would not always destroy projects
  Remove unused SpamReport model; this was renamed to SpamLog
  Corrected links/usernames in performance guide
  Add gravatars to build history
  Add deployment ID and gravatar to environments page
  Format environment history page
  Add avatar to commit message; environment style updates to match pipelines page
  Style deploy button
2016-08-15 19:02:48 +08:00
Lin Jen-Shin 5e7d99d3dc Rename to total_duration and we're not using CommitStatus.duration 2016-08-15 18:54:38 +08:00
Lin Jen-Shin b5d1e6341b Merge branch 'pipeline-hooks-without-slack' into wall-clock-time-for-showing-pipeline
* pipeline-hooks-without-slack: (156 commits)
  Fix test failures
  Make pipeline to be in created state for hooks tests
  Make `execute_methods` public
  Added specs for started_at and finished_at
  Use explicit events to transition between states
  Fix tests. We cannot reload unless it's already saved:
  Have trait all_events_enabled so that's easier to reuse, feedback:
  Simplify the name for data builder, feedback:
  Prefer extend self over module_function, feedback:
  Make it more grammatically correct, feedback:
  if -> when; when -> `when`; %w() -> %w[]; and fix some typos:
  Prefer described_class, feedback:
  Make the comment more clear, feedback:
  Update CHANGELOG
  render only commit title
  Fix test failures, that did occur because of missing previously used `reload_status!` call
  Use state machine for pipeline event processing
  Upgrade Rails to 4.2.7.1 for security fixes.
  Update gitlab-shell to v3.3.3
  Verify the pipeline status after executing events on builds
  ...
2016-08-15 18:45:45 +08:00
Kamil Trzcinski ea4ac57853 Use event `enqueue` instead of `queue` 2016-08-12 13:57:58 +02:00
Kamil Trzcinski e1f05b932d Use explicit events to transition between states 2016-08-12 11:36:51 +02:00
Kamil Trzcinski 4ccf39cde7 Fix test failures, that did occur because of missing previously used `reload_status!` call 2016-08-11 22:54:25 +02:00
Kamil Trzcinski 6a6a69f4af Use state machine for pipeline event processing 2016-08-11 21:32:16 +02:00
Kamil Trzcinski d983c5bd46 Verify the pipeline status after executing events on builds 2016-08-11 19:19:32 +02:00
Kamil Trzcinski 39203f1adf Pre-create all builds for Pipeline when a trigger is received
This change simplifies a Pipeline processing by introducing a special new status: created.
This status is used for all builds that are created for a pipeline.
We are then processing next stages and queueing some of the builds (created -> pending) or skipping them (created -> skipped).
This makes it possible to simplify and solve a few ordering problems with how previously builds were scheduled.
This also allows us to visualise a full pipeline (with created builds).

This also removes an after_touch used for updating a pipeline state parameters.
Right now in various places we explicitly call a reload_status! on pipeline to force it to be updated and saved.
2016-08-11 15:22:35 +02:00
Lin Jen-Shin 21fdc1edae Cleanup the use of duration and optimize some queries 2016-08-10 23:12:02 +08:00
Lin Jen-Shin 122b046b92 Workaround MySQL with INNER JOIN:
This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME
subquery'

Oh well.
2016-07-21 01:10:08 +08:00
Kamil Trzcinski 60583bf9db Make manual actions to work with master code 2016-07-18 14:57:24 +02:00
Grzegorz Bizon 92984783db Rename commit_data in Pipeline to commit 2016-06-21 14:43:37 +02:00
Grzegorz Bizon dd08202a24 Fix builds API response not including commit data 2016-06-21 14:26:57 +02:00
James Lopez b07dc938b9 fixed specs and refactored a few things due to recent model changes and merge conflicts 2016-06-13 13:34:36 +02:00
Kamil Trzcinski fe5735a860 Delegate to pipeline instead of commit 2016-06-03 13:34:38 +02:00
Kamil Trzcinski 3577b57f6b Try to use `pipeline` where applicable 2016-06-03 13:09:49 +02:00
Kamil Trzcinski 021d3810c3 Rename Ci::Commit to Ci::Pipeline and rename some of the ci_commit to pipeline 2016-06-02 16:59:04 +02:00
Douwe Maan 3f6f2bbe14 Merge branch 'create-todo-on-failing-build' into 'master'
Create a todo on failing MR build

Implements #14067. I worked on this with @DouweM (any mistakes are mine).

When a build fails for a commit, create a todo for the author of the merge request that commit is the HEAD of. If the commit isn't the HEAD commit of any MR, don't do anything. If there already is a todo for that user and MR, don't do anything.

Current limitations:
- This isn't configurable by project.
- The author of a merge request might not be the person who pushed the breaking commit.
- I haven't tested this with a working CI setup, just with the unit tests below and by modifying my DB directly.


See merge request !3177
2016-05-19 21:18:22 +00:00
Sean McGivern 6b834f2cbc Create a todo on failing MR build
When a build fails for a commit, create a todo for the author of the
merge request that commit is the HEAD of. If the commit isn't the HEAD
commit of any MR, don't do anything. If there already is a todo for that
user and MR, don't do anything.

Current limitations:
- This isn't configurable by project.
- The author of a merge request might not be the person who pushed the
  breaking commit.
2016-05-17 10:17:45 +01:00
Kamil Trzcinski bf4dc75801 Improve the pipelines design 2016-05-16 16:48:27 -05:00
Kamil Trzcinski 8c93b6051f Revert `stages` change 2016-05-14 14:45:11 -05:00
Kamil Trzcinski a6b8d36ae9 Fix specs 2016-05-14 09:46:38 -05:00
Kamil Trzcinski ecee057795 Merge remote-tracking branch 'origin/master' into with-pipeline-view 2016-05-13 17:15:09 -05:00
Kamil Trzcinski 6d19e13df6 Fix specs 2016-05-13 17:11:57 -05:00
Kamil Trzcinski 3953e5fcd7 Update generic commit status to make it look like a build 2016-05-10 02:38:25 +03:00
Kamil Trzcinski 504a1fac95 Fix SQL queries for calculating stages status 2016-05-10 00:58:53 +03:00
Kamil Trzcinski 7c1acb022a Merge remote-tracking branch 'origin/master' into with-pipeline-view
# Conflicts:
#	app/views/projects/ci/builds/_build.html.haml
#	app/views/projects/commit/_ci_commit.html.haml
#	app/views/projects/commit/_commit_box.html.haml
2016-05-09 23:53:02 +03:00
Kamil Trzcinski 1ad0c968d5 Make a build views nicer 2016-05-09 23:39:48 +03:00
Jeroen van Baarsen f1479b56b7
Remove the annotate gem and delete old annotations
In 8278b763d9 the default behaviour of annotation
has changes, which was causing a lot of noise in diffs. We decided in #17382
that it is better to get rid of the whole annotate gem, and instead let people
look at schema.rb for the columns in a table.

Fixes: #17382
2016-05-09 18:00:28 +02:00
Zeger-Jan van de Weg 47da013cf8 Annotate the models 2016-05-06 08:27:46 +02:00
Kamil Trzcinski 28ce41c00e Fix tests 2016-04-18 07:35:43 -04:00
Kamil Trzcinski 1c5b172abb Write specs for this feature 2016-04-16 22:43:40 +02:00
Kamil Trzcinski 0b1655e7b2 Rename CiStatus to Statusable 2016-04-16 21:46:26 +02:00
Kamil Trzcinski 102537072b Fix CiStatus implementation and tests 2016-04-13 15:40:12 +02:00
Kamil Trzcinski 234be12e4e Optimise CI status accessor 2016-04-12 20:38:02 +02:00
Kamil Trzcinski 8e84acbf2e Optimise CI status accessor 2016-04-12 20:37:57 +02:00
Kamil Trzcinski af7214d0f0 Fix specs 2016-04-11 23:32:55 +02:00
Kamil Trzcinski 5d69f5b46d Use Ci::Commit as Pipeline 2016-04-11 23:32:54 +02:00
Geoffrey Lalonde 4117c815df adjusted behavior so canceled builds tagged as allowed to fail do not fail build 2016-03-17 07:55:10 -07:00
Kamil Trzcinski 0672258915 Cleanup CiCommit and CiBuild
- Remove all view related methods from Ci::Build and CommitStatus
- Remove unused Ci::Commit and Ci::Build methods
- Use polymorphism to render different types of CommitStatus
2016-03-14 13:20:35 +01:00
Kamil Trzcinski 56449cc674 Fix Merge When Succeeded for multiple stages
Use around_transition to trigger build creation for next stages
2016-02-19 23:24:31 +01:00
Kamil Trzcinski aa812dbfcc Fix missing ignored? for GenericCommitStatus 2016-02-19 19:58:43 +01:00
Douwe Maan ba42b03348 Merge branch 'ci/api-builds' into 'master'
Add builds API

References #4264

See merge request !2207
2016-01-14 16:29:15 +00:00
Tomasz Maczukin 2c7d9cfa7d Move Ci::Build#available_statuses to AVAILABLE_STATUSES constant in CommitStatus 2016-01-14 14:59:04 +01:00
Grzegorz Bizon 9e0e9342a4 Rename method that returns url to CI build artifacts download 2016-01-14 12:48:14 +01:00
Stan Hu 79c0e7212a Annotate models 2016-01-06 13:09:55 +00:00
Kamil Trzcinski 73b04bebad Fix errors 2015-12-11 18:02:09 +01:00
Kamil Trzcinski 1e2a4895c8 Finishing touches 2015-12-11 18:02:09 +01:00
Kamil Trzcinski e80e3f5372 Migrate CI::Project to Project 2015-12-11 18:02:09 +01:00
Zeger-Jan van de Weg 53b285c9a8 Merge branch 'master' into merge-if-green 2015-11-18 11:58:01 +01:00
Zeger-Jan van de Weg 2f048df4a4 API support, incorporated feedback 2015-11-18 11:17:41 +01:00
Dmitriy Zaporozhets a237999f00
Annotate models
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-11-13 19:22:46 +01:00
Kamil Trzcinski d0e3e823a2 Implement Build Artifacts
- Offloads uploading to GitLab Workhorse
- Use /authorize request for fast uploading
- Added backup recipes for artifacts
- Support download acceleration using X-Sendfile
2015-11-10 12:51:50 +01:00
Kamil Trzcinski ba68facf8d CI details cleanup
- Add page titles to CI settings.
- Fix CI admin navigation.
- Remove duplicated scope.
- Use monospace font for commit sha.
- Add page title and header title to build page.
- Proper authorization for cancel/retry builds.
- Use gitlab pagination theme for builds and group members.
- Don't paginate builds widget on build page.
- Add badges to commit page Changes/Builds tabs.
- Add "Builds" to commit Builds tab page title.
- Add and use Ci::Build#retryable? method.
- Add CI::Build#retried? method.
- Allow all failed commit builds to be retried.
- Proper authorization for cancel/retry all builds.
- Remove unused param.
- Use time_ago_with_tooltip where appropriate.
- Tweak builds index text
- Remove duplication between builds/build and commit_statuses/commit_status.
- Use POST rather than GET for canceling and retrying builds.
- Remove redundant URL helpers.
- Add build ID to build page.
- Link branch name on build page.
- Move commit/:sha/ci to commit/:sha/builds.
2015-11-05 15:24:27 +01:00
Zeger-Jan van de Weg 77f8a1e392 Merge when build succeeds 2015-11-02 17:27:38 +01:00
Kamil Trzcinski 127836dd54 Fix small CI UI regressions 2015-10-23 11:45:45 +02:00
Kamil Trzcinski 0aa6061d6a Implement when syntax in .gitlab-ci.yml 2015-10-15 23:49:39 +02:00
Kamil Trzciński daccc54d25 Merge branch 'builds-view' into 'master'
Added builds view

![Screen_Shot_2015-10-13_at_19.02.48](https://gitlab.com/gitlab-org/gitlab-ce/uploads/95bb3a7d9d603678fdd077558637045d/Screen_Shot_2015-10-13_at_19.02.48.png)

/cc @dzaporozhets @vsizov 


See merge request !1593
2015-10-15 11:35:57 +00:00
Kamil Trzcinski 7af4f5215e Show warning if build doesn't have runners with specified tags or runners didn't connect recently
Slightly refactor runner status detection: moving it to Runner class

Signed-off-by: Kamil Trzcinski <ayufan@ayufan.eu>
2015-10-14 17:29:18 +02:00
Kamil Trzcinski 4d69c6a336 Refactor builds view 2015-10-14 17:28:38 +02:00
Kamil Trzcinski 789fe7b489 Update rendering 2015-10-12 16:32:58 +02:00
Kamil Trzcinski 69c04498ef Small bug fixes 2015-10-12 15:55:12 +02:00
Kamil Trzcinski 0aefeeb882 Add Commit Status documentation 2015-10-12 12:42:27 +02:00
Kamil Trzcinski 7ef156a242 Add author to statuses 2015-10-12 12:16:55 +02:00
Kamil Trzcinski 914cfbd2f1 Implement Commit Status API 2015-10-12 11:53:49 +02:00