Commit Graph
29904 Commits
Author SHA1 Message Date
Kamil Trzcinski 9e487100b5 Validate project and environment instead of only requiring 2016-06-15 14:05:10 +02:00
Kamil Trzcinski 14433b341d Make project_id and environment_id nullable
This is done to make belongs_to with required to properly validate association.
Otherwise `ActiveRecord::StatementInvalid` is raised.
2016-06-15 13:00:13 +02:00
Kamil Trzcinski eb26755d63 Create_deployment ability is need to create retry or rollback deployment 2016-06-15 12:56:02 +02:00
Kamil Trzcinski 2bed8db995 Add CHANGELOG 2016-06-15 12:24:53 +02:00
Kamil Trzcinski 32a400aa14 Make environments_spec more feature-spec 2016-06-15 12:24:47 +02:00
Kamil Trzcinski 18fd2ccb8b Improve cyclomatic of ability::allowed 2016-06-15 12:12:26 +02:00
Kamil Trzcinski 0052644009 Improve forms and specs 2016-06-15 12:07:06 +02:00
Kamil Trzcinski 2541e50d7c Improve validations 2016-06-15 12:03:49 +02:00
Kamil Trzcinski 14a02a6a95 Improve design after review 2016-06-14 18:34:48 +02:00
Kamil Trzcinski 006b650988 Merge remote-tracking branch 'origin/master' into environments-and-deployments
# Conflicts:
#	db/schema.rb
2016-06-14 16:19:29 +02:00
Kamil Trzcinski dc41a933f4 Update scss to make the views look nicer 2016-06-14 16:11:28 +02:00
Dmitriy Zaporozhets d4cd6dcaa0 Merge branch 'settings-dropdown-permissions' into 'master'
Fix displaying of project settings links the user cannot access.

## What does this MR do?

It fixes the Project Settings dropdown displaying project settings links that the user cannot actually access.

## Are there points in the code the reviewer needs to double check?

I've tested combinations I can think of, feel free to mess around with and see if it breaks?

## Why was this MR needed?

Users were seeing links in the Project Settings dropdown that they shouldn't have seen, if they clicked them they would be shown permission errors.

## What are the relevant issue numbers?

#18294 

## Screenshots (if relevant)

Users without any permissions:

![Screen_Shot_2016-06-10_at_10.41.27_AM](/uploads/b70ca18a36b5f774b85694d8f1728882/Screen_Shot_2016-06-10_at_10.41.27_AM.png)

Guest members of the project:

![Screen_Shot_2016-06-10_at_10.48.36_AM](/uploads/a37986b4daa789063661c2fa8cf59d43/Screen_Shot_2016-06-10_at_10.48.36_AM.png)

Full permissions:

![Screen_Shot_2016-06-10_at_10.41.57_AM](/uploads/4c5cc97962e69a1a72ee8e237591ec22/Screen_Shot_2016-06-10_at_10.41.57_AM.png)

cc: @dzaporozhets @annabeldunstone @jschatz1 

See merge request !4599
2016-06-14 14:11:13 +00:00
Rémy Coutable 95a7fbe97c Merge branch 'artifacts-expire-date' into 'master'
Artifacts expire date

What do you think @grzesiek?

The syntax will be simple:
```
job:
  artifacts:
    expire_in: 7d
```

- [x] Implement `expire_in`
- [x] Check current design of expiry information with @jschatz1 and @markpundsack 
- [x] Add tests in GitLab application for a `ExpireBuildArtifactsWorker` and for `ArtifactsController::keep`
- [x] Add user documentation how to use `artifacts:expire_in`
- [x] Prepare GitLab Runner changes to pass `expire_in`: gitlab-org/gitlab-ci-multi-runner!191
- [x] Fix `timeago` with help of @jschatz1
- [x] Merge latest master after builds view changes @iamphill
- [ ] Add Omnibus support for `expire_build_artifacts_worker` cron job
- [ ] Add documentation how to configure `expire_build_artifacts_worker`

This is based on https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4201.

See merge request !4200
2016-06-14 13:40:01 +00:00
Achilleas Pipinellis 1c0c5232c2 Merge branch 'update-ci-api-docs' into 'master'
Update CI API docs

Since CI is now part of GitLab, it makes sense to group all API related endpoints under
one location. This is a step towards the much awaited issue of doc restructure
https://gitlab.com/gitlab-org/gitlab-ce/issues/3349

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/18404

See merge request !4567
2016-06-14 13:34:03 +00:00
Kamil Trzcinski 975e388751 Merge remote-tracking branch 'origin/master' into environments-and-deployments
# Conflicts:
#	lib/ci/gitlab_ci_yaml_processor.rb
2016-06-14 14:53:10 +02:00
Yorick Peterse fdcafe72d1 Merge branch 'zj-rework-migration-award-emoji' into 'master'
Fix timing issues on convertion migration award emoji

See merge request !4581
2016-06-14 12:52:17 +00:00
Kamil Trzcinski 2b5449b96d Fix Ci::Build#artifacts_expire_in= when assigning invalid duration 2016-06-14 14:51:09 +02:00
Achilleas Pipinellis f2f5a115c6 Fix grammar and syntax 2016-06-14 14:50:25 +02:00
Kamil Trzcinski 3f5819fb7a Merge remote-tracking branch 'origin/master' into artifacts-expire-date 2016-06-14 14:49:59 +02:00
Achilleas Pipinellis 47c9b7d34c Update CI API docs
- Move ci/api under api/ci
- Clean up builds.md and runners.md
- Replace old links with new ones
- Add CI API links in ci/README.md
2016-06-14 14:47:32 +02:00
Kamil Trzcinski 30877effb1 Test environment controller specs 2016-06-14 14:47:00 +02:00
Kamil Trzcinski 6209b60c96 Properly create a new deployment after build success 2016-06-14 14:44:09 +02:00
Kamil Trzcinski bb6f246790 Authorize environments controller actions 2016-06-14 14:43:45 +02:00
Kamil Trzcinski e129f66d9e Add gitlab-ci.yml documentation for environments 2016-06-14 14:43:16 +02:00
Kamil Trzcinski 3ade826065 Add specs for models and services 2016-06-14 13:51:12 +02:00
Yorick Peterse 4b964011cf Merge branch '18528-cpu-time-instrumentation' into 'master'
Measure CPU time for instrumented methods

See merge request !4640
2016-06-14 11:39:19 +00:00
Kamil Trzcinski e8f09f02bf Validate environment name with regex 2016-06-14 13:04:21 +02:00
Kamil Trzcinski 3656a6edf3 Make retry action on pipeline to save a user 2016-06-14 13:04:10 +02:00
Achilleas Pipinellis ab3fb00c42 Merge branch 'registry-example' into 'master'
Update CI Docker docs

## What does this MR do?

Updates documentation with:

* instructions for bind-mounting for docker runners (fixes #17769 and #13898)
* examples of using the GitLab Container Registry in docker-based builds (fixes #17968 and #17967)
* update runner instructions for `gitlab-ci-multi-runner` (fixes https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/issues/1337)
* some grammar fixes

## Are there points in the code the reviewer needs to double check?

The markdown in general. The runner commands. I haven't been able to verify the socket version works yet.

## Why was this MR needed?

Better documentation for users.

## What are the relevant issue numbers?
#17769, #13898, #17968, #17967 

## Screenshots (if relevant)

See merge request !4524
2016-06-14 10:54:36 +00:00
Rémy Coutable 47cdb69921 Merge branch 'refactor/ci-config-add-global-entry' into 'master'
Add global entry with before script to new CI config

## What does this MR do?

This MR adds a new entries to a new CI config class. It is next refactoring step after !4462.

See #15060

See merge request !4482
2016-06-14 10:53:26 +00:00
Paco Guzman 120fbbd487 Measure CPU time for instrumented methods 2016-06-14 12:49:31 +02:00
Kamil Trzcinski 7d9e8b04c0 Merge remote-tracking branch 'origin/master' into environments-and-deployments 2016-06-14 12:41:18 +02:00
Douwe Maan 066020fcd0 Merge branch 'fix-markdown-spec' into 'master'
Add whitelisted elements correctly in sanitization

Add whitelisted elements correctly in sanitization

Consider this command:

    bundle exec rails r "include GitlabMarkdownHelper
    puts markdown('<span>this is a span</span>', pipeline: :description)
    puts markdown('<span>this is a span</span>')"

And the same in the opposite order:

    bundle exec rails r "include GitlabMarkdownHelper
    puts markdown('<span>this is a span</span>')
    puts markdown('<span>this is a span</span>', pipeline: :description)"

Before this change, they would both output:

    <p><span>this is a span</span></p>
    <p>this is a span</p>

That's because `span` is added to the list of whitelisted elements in
the `SanitizationFilter`, but this method tries not to make the same
changes multiple times. Unfortunately,
`HTML::Pipeline::SanitizationFilter::LIMITED`, which is used by the
`DescriptionPipeline`, uses the same Ruby objects for all of its hash
values _except_ `:elements`.

That means that whichever of `DescriptionPipeline` and `GfmPipeline` is
called first would have `span` in its whitelisted elements, and the
second wouldn't.

Fix this by adding a special check for modifying `:elements` twice, then
checking `:transformers` as before.


See merge request !4588
2016-06-14 10:26:50 +00:00
Yorick Peterse c6744b4949 Fixed locking syntax for PostgreSQL 2016-06-14 12:19:38 +02:00
Yorick Peterse d032c6b0ff Move LOCK TABLES to a separate execute
MySQL apparently doesn't support executing multiple queries in the same
`execute` call so we have to use a separate one for the "LOCK TABLES"
statement.
2016-06-14 12:19:38 +02:00
Z.J. van de WegandYorick Peterse fc5b3a8fa5 Fix MySQL migration, obtain lock the right way
As suggested by @yorrickpeterse in
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4581#note_12373882
the locking of the MySQL database wasn't correct.
2016-06-14 12:19:38 +02:00
Z.J. van de WegandYorick Peterse f8290c2862 Fix timing issues on convertion migration award emoji
This commit does two things:
1. It adds logic which prevents timing issues when running the
migration. During the migration, notes can be created which _should_
be award emoji and thus migrated. To prevent these timing issues, a
lock is obtained on the table (MySQL) or on Transaction level (PG).
2. There was no down migration before as you'd probably lose some data.
Data effected is all awards on notes. These could be migrated back, as
the noteable type would just be Note, though this would litter the DB
with data which should not be there. This down migration does not yet
delete the table.
2016-06-14 12:19:38 +02:00
Kamil Trzcinski 1b62b86fdd Merge remote-tracking branch 'origin/master' into artifacts-expire-date 2016-06-14 11:38:44 +02:00
Kamil Trzcinski 60e0137c86 Fix specs 2016-06-14 11:38:34 +02:00
Douwe Maan 0c0ef7dfb6 Merge branch 'confidential-issues-in-private-projects' into 'master'
Allow users to create confidential issues in private projects

Closes #14787

## What does this MR do?

Allow users to create confidential issues in private projects, and exclude access to them to project members with `Guest` role.

## Are there points in the code the reviewer needs to double check?

The query generated by the `User#authorized_projects` method.

## Why was this MR needed?

Community have been requesting this feature.

## What are the relevant issue numbers?

https://gitlab.com/gitlab-org/gitlab-ce/issues/14787

https://gitlab.com/gitlab-org/gitlab-ce/issues/3678

## Screenshots (if relevant)

Not relevant.

## Todo

- [x] Allow users to create confidential issues in private projects
- [x] Project members with `Guest` role should not have access to confidential issues
- [ ] ~~Apply changes in EE + Elasticsearch~~ Will be done in another MR, when this got merged

See merge request !3471
2016-06-14 09:35:18 +00:00
Grzegorz Bizon 30e946ce8a Validate ci config entry value before processing nodes 2016-06-14 11:28:20 +02:00
Grzegorz Bizon 59eeec3ff8 Make method that composes ci config entry private 2016-06-14 10:48:51 +02:00
Rémy Coutable 0068ba8db5 Merge branch 'bentolor/gitlab-ce-fix/bamboo-service-trigger-auth' into 'master'
Bamboo & TeamCity Services: Fix missing credentials & URL handling

_Note: Originally opened at !4367 by @bentolor_

I've also fixed the URL handling for TeamCity which is very similar to Bamboo implementation-wise.

-----

*Note:* This is a port from my [original pull request on GitHub](https://github.com/gitlabhq/gitlabhq/pull/9428)

## What does this MR do?
This improves the Bamboo Service and provides two fixes:

1. One for the situation, where the build trigger won't work because Bamboo is requiring authentication credentials for the trigger GET: 8f25aca307b49ee006172b8c2985a878800aa6b6
2. One which fixes the way how the configured Bamboo base URL is assembled to the final REST URL. fe9eb30d7ebe4a83eefea7e06f8b69b135dad15d

### Regarding credentials
The change now does provide additional HTTP Basic Auth parameters if user credentials were provided and appends an request parameter indicating the HTTP Basic Authentication should be used. This aligns interaction with Bamboo with the other calls this service executes.

### Regarding URL handling
If one had configured a `bamboo_url` like http://foo.bar/bamboo in the previous implementation the plugin directed it's request i.e. to http://foo.bar/rest/... instead of http://foo.bar/bamboo/rest/...


## Are there points in the code the reviewer needs to double check?
The second issues was probably an unwanted side effect of how Ruby's `URI.join` is working. It will only work correctly, if 
- ... the prefix URL has at least one or more  trailing `/`
- .. the appendix parts are _not_ prefixed with `/`

I need try & figure it out using the rather lacking, official stdlib documentation and playing around in `irb`. As I'm an absolute Ruby novice I'm unable to add/provide new tests.

## Why was this MR needed?
Because Gitlab does not work in our Bamboo-Environment at all: Neither it is able to trigger Bamboo runs nor does the Merge status check work. This MR at least fixes the trigger issues.

## What are the relevant issue numbers?
This MR originates from my [original pull request on GitHub](https://github.com/gitlabhq/gitlabhq/pull/9428).
Sadly the issue, that the merge status is still not working correctly for branches will still not work. But at least the trigger works. 

There happened to be very much discussion about the branch status issue in #1355 and  #2562 though that one is lost as the author retracted his branch. 

See merge request !4408
2016-06-14 08:32:31 +00:00
Rémy Coutable a78cd2ecb7 Merge branch 'issue_14572' into 'master'
Add more information into RSS feed for issues

## What does this MR do?

This MR adds issue text, labels , milestone, assignee and due date into issues RSS feed.

## Are there points in the code the reviewer needs to double check?

#14572 requests to add 'weight' among other fields. Seems like issue weight is available
in enterprise edition only so it is not implemented in this MR. Please correct me if I'm wrong.

## Why was this MR needed?

This MR is needed because it extends issues RSS feed with useful information requested in
#14572.

## What are the relevant issue numbers?

https://gitlab.com/gitlab-org/gitlab-ce/issues/14572

See merge request !4158
2016-06-14 08:23:28 +00:00
Rémy Coutable 2f7b2057f2 Fix broken URI joining for teamcity_url with suffixes
If one had configured a `teamcity_url` like http://foo.bar/teamcity in
the previous implementation the plugin directed it's request i.e. to
http://foo.bar/httpAuth/... instead of http://foo.bar/teamcity/httpAuth/...

`URI.join` only works correctly, if the prefix URL has
  - at least one or more  trailing '/'
  - the appended parts are _not_ prefixed with '/'

The current implementation should work with all sorts of TeamCity base
URLs.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-06-14 10:07:37 +02:00
Rémy Coutable 17c32ee8d0 Factorize duplicated code into a method in BambooService and update specs
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-06-14 10:07:37 +02:00
Benjamin SchmidandRémy Coutable 46f3cd7c65 Fix broken URI joining for bamboo_url with suffixes
If one had configured a `bamboo_url` like http://foo.bar/bamboo in the
previous implementation the plugin directed it's request i.e. to
http://foo.bar/rest/... instead of http://foo.bar/bamboo/rest/...

`URI.join` only works correctly, if the prefix URL has
  - at least one or more  trailing '/'
  - the appended parts are _not_ prefixed with '/'

The current implementation should work with all sorts of Bamboo base URLs.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-06-14 10:07:34 +02:00
Benjamin SchmidandRémy Coutable 84b07f7054 Honor credentials on calling Bamboo CI trigger
This improves the Bamboo Service and provides a fix for situations,
where the build trigger won't work, because Bamboo is requiring
authentication also for the trigger GET.

The change now does provide additional HTTP Basic Auth parameters
if user credentials were provided and appends an request parameter
indicating the HTTP Basic Authentication should be used.
This aligns interaction with Bamboo with the other calls this service
executes.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-06-14 10:00:37 +02:00
Rémy Coutable 121c632280 Merge branch 'retry-spinach-tests' into 'master'
Retry spinach tests in case of failure using rerun reporter

## What does this MR do?

Fixes Spinach tests to retry on tests on master


See merge request !4539
2016-06-14 07:57:44 +00:00
Mark Pundsack 6ed7fcad29 Remove our 2016-06-13 22:47:54 -07:00