Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
a53c0ca02c
commit
2d099cf5e6
|
@ -37,11 +37,6 @@
|
||||||
&.gl-modal .modal-md {
|
&.gl-modal .modal-md {
|
||||||
max-width: 640px;
|
max-width: 640px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-menu {
|
|
||||||
max-height: $dropdown-max-height;
|
|
||||||
@include gl-overflow-y-auto;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//// Copied from roadmaps.scss - adapted for on-call schedules
|
//// Copied from roadmaps.scss - adapted for on-call schedules
|
||||||
|
|
|
@ -97,7 +97,7 @@ class Explore::ProjectsController < Explore::ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_sort_order
|
def default_sort_order
|
||||||
sort_value_name
|
sort_value_latest_activity
|
||||||
end
|
end
|
||||||
|
|
||||||
def sorting_field
|
def sorting_field
|
||||||
|
|
|
@ -37,6 +37,11 @@ module Repositories
|
||||||
|
|
||||||
next unless matches
|
next unless matches
|
||||||
|
|
||||||
|
# When using this class for generating changelog data for a range of
|
||||||
|
# commits, we want to compare against the tag of the last _stable_
|
||||||
|
# release; not some random RC that came after that.
|
||||||
|
next if matches[:prerelease]
|
||||||
|
|
||||||
version = matches[:version]
|
version = matches[:version]
|
||||||
tags[version] = tag
|
tags[version] = tag
|
||||||
versions << version
|
versions << version
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Fix Auto DevOps deploys that use a default branch that's not named 'master'
|
||||||
|
merge_request: 53280
|
||||||
|
author: Mitchell Cash @MitchellCash
|
||||||
|
type: fixed
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Ignore prerelease tags when generating changelogs
|
||||||
|
merge_request: 55065
|
||||||
|
author:
|
||||||
|
type: changed
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Reverts default sort order for Explore Projects to Last updated
|
||||||
|
merge_request: 54879
|
||||||
|
author:
|
||||||
|
type: changed
|
|
@ -8,7 +8,11 @@ require 'marginalia'
|
||||||
# query. Prepending the comment allows us to trace the source of the
|
# query. Prepending the comment allows us to trace the source of the
|
||||||
# query without having to increase the `track_activity_query_size`
|
# query without having to increase the `track_activity_query_size`
|
||||||
# parameter.
|
# parameter.
|
||||||
Marginalia::Comment.prepend_comment = true unless Rails.env.test? # Some tests do string matching against raw SQL
|
#
|
||||||
|
# We only enable this in production because a number of tests do string
|
||||||
|
# matching against the raw SQL, and prepending the comment prevents color
|
||||||
|
# coding from working in the development log.
|
||||||
|
Marginalia::Comment.prepend_comment = true if Rails.env.production?
|
||||||
Marginalia::Comment.components = [:application, :controller, :action, :correlation_id, :jid, :job_class]
|
Marginalia::Comment.components = [:application, :controller, :action, :correlation_id, :jid, :job_class]
|
||||||
|
|
||||||
# As mentioned in https://github.com/basecamp/marginalia/pull/93/files,
|
# As mentioned in https://github.com/basecamp/marginalia/pull/93/files,
|
||||||
|
|
|
@ -311,9 +311,9 @@ Supported attributes:
|
||||||
| `message` | string | no | The commit message to produce when committing the changes, defaults to `Add changelog for version X` where X is the value of the `version` argument. |
|
| `message` | string | no | The commit message to produce when committing the changes, defaults to `Add changelog for version X` where X is the value of the `version` argument. |
|
||||||
|
|
||||||
If the `from` attribute is unspecified, GitLab uses the Git tag of the last
|
If the `from` attribute is unspecified, GitLab uses the Git tag of the last
|
||||||
version that came before the version specified in the `version` attribute. For
|
stable version that came before the version specified in the `version`
|
||||||
this to work, your project must create Git tags for versions using one of the
|
attribute. For this to work, your project must create Git tags for versions
|
||||||
following formats:
|
using one of the following formats:
|
||||||
|
|
||||||
- `vX.Y.Z`
|
- `vX.Y.Z`
|
||||||
- `X.Y.Z`
|
- `X.Y.Z`
|
||||||
|
@ -322,17 +322,58 @@ Where `X.Y.Z` is a version that follows [semantic
|
||||||
versioning](https://semver.org/). For example, consider a project with the
|
versioning](https://semver.org/). For example, consider a project with the
|
||||||
following tags:
|
following tags:
|
||||||
|
|
||||||
|
- v1.0.0-pre1
|
||||||
- v1.0.0
|
- v1.0.0
|
||||||
- v1.1.0
|
- v1.1.0
|
||||||
- v2.0.0
|
- v2.0.0
|
||||||
|
|
||||||
If the `version` attribute is `2.1.0`, GitLab uses tag v2.0.0. And when the
|
If the `version` attribute is `2.1.0`, GitLab uses tag v2.0.0. And when the
|
||||||
version is `1.1.1`, or `1.2.0`, GitLab uses tag v1.1.0.
|
version is `1.1.1`, or `1.2.0`, GitLab uses tag v1.1.0. The tag `v1.0.0-pre1` is
|
||||||
|
never used, because pre-release tags are ignored.
|
||||||
|
|
||||||
If `from` is unspecified and no tag to use is found, the API produces an error.
|
If `from` is unspecified and no tag to use is found, the API produces an error.
|
||||||
To solve such an error, you must explicitly specify a value for the `from`
|
To solve such an error, you must explicitly specify a value for the `from`
|
||||||
attribute.
|
attribute.
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
For these examples we use the project ID 42, and assume the project is hosted on
|
||||||
|
GitLab.com. The example API token we use is `token`. We use
|
||||||
|
[curl](https://curl.se/) to perform the HTTP requests.
|
||||||
|
|
||||||
|
Let's start with a basic example:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
curl --header "PRIVATE-TOKEN: token" --data "version=1.0.0" "https://gitlab.com/api/v4/projects/42/repository/changelog"
|
||||||
|
```
|
||||||
|
|
||||||
|
This generates a changelog for version `1.0.0`. The start of the range of
|
||||||
|
commits to include is the tag of the last release. The end of the range is the
|
||||||
|
last commit on the target branch, which defaults to the project's default
|
||||||
|
branch. So if the last tag is `v0.9.0`, and the default branch is `main`, this
|
||||||
|
means the range of commits is `v0.9.0..main`.
|
||||||
|
|
||||||
|
If you want to generate the data on a different branch, you can do so as
|
||||||
|
follows:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
curl --header "PRIVATE-TOKEN: token" --data "version=1.0.0&branch=foo" "https://gitlab.com/api/v4/projects/42/repository/changelog"
|
||||||
|
```
|
||||||
|
|
||||||
|
This generates the data on the `foo` branch.
|
||||||
|
|
||||||
|
A different trailer to use is specified as follows:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
curl --header "PRIVATE-TOKEN: token" --data "version=1.0.0&trailer=Type" "https://gitlab.com/api/v4/projects/42/repository/changelog"
|
||||||
|
```
|
||||||
|
|
||||||
|
Or perhaps you want to store the results in a different file:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
curl --header "PRIVATE-TOKEN: token" --data "version=1.0.0&file=NEWS" "https://gitlab.com/api/v4/projects/42/repository/changelog"
|
||||||
|
```
|
||||||
|
|
||||||
### How it works
|
### How it works
|
||||||
|
|
||||||
Changelogs are generated based on commit titles. Commits are only included if
|
Changelogs are generated based on commit titles. Commits are only included if
|
||||||
|
|
|
@ -23,7 +23,7 @@ review:
|
||||||
rules:
|
rules:
|
||||||
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
|
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
- if: '$REVIEW_DISABLED'
|
- if: '$REVIEW_DISABLED'
|
||||||
when: never
|
when: never
|
||||||
|
@ -44,7 +44,7 @@ stop_review:
|
||||||
rules:
|
rules:
|
||||||
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
|
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
- if: '$REVIEW_DISABLED'
|
- if: '$REVIEW_DISABLED'
|
||||||
when: never
|
when: never
|
||||||
|
@ -73,7 +73,7 @@ staging:
|
||||||
rules:
|
rules:
|
||||||
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
|
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH != "master"'
|
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
- if: '$STAGING_ENABLED'
|
- if: '$STAGING_ENABLED'
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ canary:
|
||||||
rules:
|
rules:
|
||||||
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
|
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH != "master"'
|
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CANARY_ENABLED'
|
- if: '$CANARY_ENABLED'
|
||||||
when: manual
|
when: manual
|
||||||
|
@ -136,7 +136,7 @@ production:
|
||||||
when: never
|
when: never
|
||||||
- if: '$INCREMENTAL_ROLLOUT_MODE'
|
- if: '$INCREMENTAL_ROLLOUT_MODE'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||||
|
|
||||||
production_manual:
|
production_manual:
|
||||||
<<: *production_template
|
<<: *production_template
|
||||||
|
@ -148,9 +148,9 @@ production_manual:
|
||||||
when: never
|
when: never
|
||||||
- if: '$INCREMENTAL_ROLLOUT_MODE'
|
- if: '$INCREMENTAL_ROLLOUT_MODE'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH == "master" && $STAGING_ENABLED'
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $STAGING_ENABLED'
|
||||||
when: manual
|
when: manual
|
||||||
- if: '$CI_COMMIT_BRANCH == "master" && $CANARY_ENABLED'
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CANARY_ENABLED'
|
||||||
when: manual
|
when: manual
|
||||||
|
|
||||||
# This job implements incremental rollout on for every push to `master`.
|
# This job implements incremental rollout on for every push to `master`.
|
||||||
|
@ -184,7 +184,7 @@ production_manual:
|
||||||
when: never
|
when: never
|
||||||
- if: '$INCREMENTAL_ROLLOUT_MODE == "timed"'
|
- if: '$INCREMENTAL_ROLLOUT_MODE == "timed"'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH != "master"'
|
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
# $INCREMENTAL_ROLLOUT_ENABLED is for compatibility with pre-GitLab 11.4 syntax
|
# $INCREMENTAL_ROLLOUT_ENABLED is for compatibility with pre-GitLab 11.4 syntax
|
||||||
- if: '$INCREMENTAL_ROLLOUT_MODE == "manual" || $INCREMENTAL_ROLLOUT_ENABLED'
|
- if: '$INCREMENTAL_ROLLOUT_MODE == "manual" || $INCREMENTAL_ROLLOUT_ENABLED'
|
||||||
|
@ -197,7 +197,7 @@ production_manual:
|
||||||
when: never
|
when: never
|
||||||
- if: '$INCREMENTAL_ROLLOUT_MODE == "manual"'
|
- if: '$INCREMENTAL_ROLLOUT_MODE == "manual"'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH != "master"'
|
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
- if: '$INCREMENTAL_ROLLOUT_MODE == "timed"'
|
- if: '$INCREMENTAL_ROLLOUT_MODE == "timed"'
|
||||||
when: delayed
|
when: delayed
|
||||||
|
|
|
@ -23,7 +23,7 @@ review:
|
||||||
rules:
|
rules:
|
||||||
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
|
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
- if: '$REVIEW_DISABLED'
|
- if: '$REVIEW_DISABLED'
|
||||||
when: never
|
when: never
|
||||||
|
@ -44,7 +44,7 @@ stop_review:
|
||||||
rules:
|
rules:
|
||||||
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
|
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
- if: '$REVIEW_DISABLED'
|
- if: '$REVIEW_DISABLED'
|
||||||
when: never
|
when: never
|
||||||
|
@ -73,7 +73,7 @@ staging:
|
||||||
rules:
|
rules:
|
||||||
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
|
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH != "master"'
|
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
- if: '$STAGING_ENABLED'
|
- if: '$STAGING_ENABLED'
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ canary:
|
||||||
rules:
|
rules:
|
||||||
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
|
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH != "master"'
|
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CANARY_ENABLED'
|
- if: '$CANARY_ENABLED'
|
||||||
when: manual
|
when: manual
|
||||||
|
@ -135,7 +135,7 @@ production:
|
||||||
when: never
|
when: never
|
||||||
- if: '$INCREMENTAL_ROLLOUT_MODE'
|
- if: '$INCREMENTAL_ROLLOUT_MODE'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||||
|
|
||||||
production_manual:
|
production_manual:
|
||||||
<<: *production_template
|
<<: *production_template
|
||||||
|
@ -147,9 +147,9 @@ production_manual:
|
||||||
when: never
|
when: never
|
||||||
- if: '$INCREMENTAL_ROLLOUT_MODE'
|
- if: '$INCREMENTAL_ROLLOUT_MODE'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH == "master" && $STAGING_ENABLED'
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $STAGING_ENABLED'
|
||||||
when: manual
|
when: manual
|
||||||
- if: '$CI_COMMIT_BRANCH == "master" && $CANARY_ENABLED'
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CANARY_ENABLED'
|
||||||
when: manual
|
when: manual
|
||||||
|
|
||||||
# This job implements incremental rollout on for every push to `master`.
|
# This job implements incremental rollout on for every push to `master`.
|
||||||
|
@ -181,7 +181,7 @@ production_manual:
|
||||||
when: never
|
when: never
|
||||||
- if: '$INCREMENTAL_ROLLOUT_MODE == "timed"'
|
- if: '$INCREMENTAL_ROLLOUT_MODE == "timed"'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH != "master"'
|
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
# $INCREMENTAL_ROLLOUT_ENABLED is for compatibility with pre-GitLab 11.4 syntax
|
# $INCREMENTAL_ROLLOUT_ENABLED is for compatibility with pre-GitLab 11.4 syntax
|
||||||
- if: '$INCREMENTAL_ROLLOUT_MODE == "manual" || $INCREMENTAL_ROLLOUT_ENABLED'
|
- if: '$INCREMENTAL_ROLLOUT_MODE == "manual" || $INCREMENTAL_ROLLOUT_ENABLED'
|
||||||
|
@ -194,7 +194,7 @@ production_manual:
|
||||||
when: never
|
when: never
|
||||||
- if: '$INCREMENTAL_ROLLOUT_MODE == "manual"'
|
- if: '$INCREMENTAL_ROLLOUT_MODE == "manual"'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH != "master"'
|
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
- if: '$INCREMENTAL_ROLLOUT_MODE == "timed"'
|
- if: '$INCREMENTAL_ROLLOUT_MODE == "timed"'
|
||||||
when: delayed
|
when: delayed
|
||||||
|
|
|
@ -20,7 +20,7 @@ review_ec2:
|
||||||
when: never
|
when: never
|
||||||
- if: '$REVIEW_DISABLED'
|
- if: '$REVIEW_DISABLED'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
|
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
|
||||||
|
|
||||||
|
@ -34,6 +34,6 @@ production_ec2:
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_KUBERNETES_ACTIVE'
|
- if: '$CI_KUBERNETES_ACTIVE'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH != "master"'
|
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
|
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
|
||||||
|
|
|
@ -46,7 +46,7 @@ review_ecs:
|
||||||
when: never
|
when: never
|
||||||
- if: '$REVIEW_DISABLED'
|
- if: '$REVIEW_DISABLED'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
|
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ stop_review_ecs:
|
||||||
when: never
|
when: never
|
||||||
- if: '$REVIEW_DISABLED'
|
- if: '$REVIEW_DISABLED'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
|
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
|
||||||
when: manual
|
when: manual
|
||||||
|
@ -81,7 +81,7 @@ review_fargate:
|
||||||
when: never
|
when: never
|
||||||
- if: '$REVIEW_DISABLED'
|
- if: '$REVIEW_DISABLED'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
|
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ stop_review_fargate:
|
||||||
when: never
|
when: never
|
||||||
- if: '$REVIEW_DISABLED'
|
- if: '$REVIEW_DISABLED'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
|
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
|
||||||
when: manual
|
when: manual
|
||||||
|
@ -109,7 +109,7 @@ production_ecs:
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_KUBERNETES_ACTIVE'
|
- if: '$CI_KUBERNETES_ACTIVE'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH != "master"'
|
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
|
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
|
||||||
|
|
||||||
|
@ -120,6 +120,6 @@ production_fargate:
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_KUBERNETES_ACTIVE'
|
- if: '$CI_KUBERNETES_ACTIVE'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_BRANCH != "master"'
|
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
|
||||||
when: never
|
when: never
|
||||||
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
|
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
"codesandbox-api": "0.0.23",
|
"codesandbox-api": "0.0.23",
|
||||||
"compression-webpack-plugin": "^5.0.2",
|
"compression-webpack-plugin": "^5.0.2",
|
||||||
"copy-webpack-plugin": "^5.1.2",
|
"copy-webpack-plugin": "^5.1.2",
|
||||||
"core-js": "^3.8.3",
|
"core-js": "^3.9.0",
|
||||||
"cron-validator": "^1.1.1",
|
"cron-validator": "^1.1.1",
|
||||||
"cropper": "^2.3.0",
|
"cropper": "^2.3.0",
|
||||||
"css-loader": "^2.1.1",
|
"css-loader": "^2.1.1",
|
||||||
|
|
|
@ -4,6 +4,8 @@ require 'spec_helper'
|
||||||
|
|
||||||
RSpec.describe Explore::ProjectsController do
|
RSpec.describe Explore::ProjectsController do
|
||||||
shared_examples 'explore projects' do
|
shared_examples 'explore projects' do
|
||||||
|
let(:expected_default_sort) { 'latest_activity_desc' }
|
||||||
|
|
||||||
describe 'GET #index.json' do
|
describe 'GET #index.json' do
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
|
@ -12,6 +14,11 @@ RSpec.describe Explore::ProjectsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to respond_with(:success) }
|
it { is_expected.to respond_with(:success) }
|
||||||
|
|
||||||
|
it 'sets a default sort parameter' do
|
||||||
|
expect(controller.params[:sort]).to eq(expected_default_sort)
|
||||||
|
expect(assigns[:sort]).to eq(expected_default_sort)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET #trending.json' do
|
describe 'GET #trending.json' do
|
||||||
|
@ -22,6 +29,11 @@ RSpec.describe Explore::ProjectsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to respond_with(:success) }
|
it { is_expected.to respond_with(:success) }
|
||||||
|
|
||||||
|
it 'sets a default sort parameter' do
|
||||||
|
expect(controller.params[:sort]).to eq(expected_default_sort)
|
||||||
|
expect(assigns[:sort]).to eq(expected_default_sort)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET #starred.json' do
|
describe 'GET #starred.json' do
|
||||||
|
@ -32,6 +44,11 @@ RSpec.describe Explore::ProjectsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to respond_with(:success) }
|
it { is_expected.to respond_with(:success) }
|
||||||
|
|
||||||
|
it 'sets a default sort parameter' do
|
||||||
|
expect(controller.params[:sort]).to eq(expected_default_sort)
|
||||||
|
expect(assigns[:sort]).to eq(expected_default_sort)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET #trending' do
|
describe 'GET #trending' do
|
||||||
|
|
|
@ -13,11 +13,6 @@ FactoryBot.define do
|
||||||
deleted_designs { [] }
|
deleted_designs { [] }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Warning: this will intentionally result in an invalid version!
|
|
||||||
trait :empty do
|
|
||||||
designs_count { 0 }
|
|
||||||
end
|
|
||||||
|
|
||||||
trait :importing do
|
trait :importing do
|
||||||
issue { nil }
|
issue { nil }
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ FactoryBot.define do
|
||||||
filename,
|
filename,
|
||||||
content,
|
content,
|
||||||
message: "Automatically created file #{filename}",
|
message: "Automatically created file #{filename}",
|
||||||
branch_name: 'master'
|
branch_name: project.default_branch_or_master
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,6 @@ RSpec.describe 'factories' do
|
||||||
[:ci_job_artifact, :raw],
|
[:ci_job_artifact, :raw],
|
||||||
[:ci_job_artifact, :gzip],
|
[:ci_job_artifact, :gzip],
|
||||||
[:ci_job_artifact, :correct_checksum],
|
[:ci_job_artifact, :correct_checksum],
|
||||||
[:design_version, :empty],
|
|
||||||
[:environment, :non_playable],
|
[:environment, :non_playable],
|
||||||
[:go_module_commit, :files],
|
[:go_module_commit, :files],
|
||||||
[:go_module_commit, :package],
|
[:go_module_commit, :package],
|
||||||
|
|
|
@ -13,18 +13,19 @@ RSpec.describe Repositories::PreviousTagFinder do
|
||||||
tag2 = double(:tag2, name: 'v1.1.0')
|
tag2 = double(:tag2, name: 'v1.1.0')
|
||||||
tag3 = double(:tag3, name: 'v2.0.0')
|
tag3 = double(:tag3, name: 'v2.0.0')
|
||||||
tag4 = double(:tag4, name: '0.9.0')
|
tag4 = double(:tag4, name: '0.9.0')
|
||||||
tag5 = double(:tag4, name: 'v0.8.0-pre1')
|
tag5 = double(:tag5, name: 'v0.8.0-pre1')
|
||||||
|
tag6 = double(:tag6, name: 'v0.7.0')
|
||||||
|
|
||||||
allow(project.repository)
|
allow(project.repository)
|
||||||
.to receive(:tags)
|
.to receive(:tags)
|
||||||
.and_return([tag1, tag3, tag2, tag4, tag5])
|
.and_return([tag1, tag3, tag2, tag4, tag5, tag6])
|
||||||
|
|
||||||
expect(finder.execute('2.1.0')).to eq(tag3)
|
expect(finder.execute('2.1.0')).to eq(tag3)
|
||||||
expect(finder.execute('2.0.0')).to eq(tag2)
|
expect(finder.execute('2.0.0')).to eq(tag2)
|
||||||
expect(finder.execute('1.5.0')).to eq(tag2)
|
expect(finder.execute('1.5.0')).to eq(tag2)
|
||||||
expect(finder.execute('1.0.1')).to eq(tag1)
|
expect(finder.execute('1.0.1')).to eq(tag1)
|
||||||
expect(finder.execute('1.0.0')).to eq(tag4)
|
expect(finder.execute('1.0.0')).to eq(tag4)
|
||||||
expect(finder.execute('0.9.0')).to eq(tag5)
|
expect(finder.execute('0.9.0')).to eq(tag6)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,252 +3,260 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
RSpec.describe 'Auto-DevOps.gitlab-ci.yml' do
|
RSpec.describe 'Auto-DevOps.gitlab-ci.yml' do
|
||||||
|
using RSpec::Parameterized::TableSyntax
|
||||||
|
|
||||||
subject(:template) { Gitlab::Template::GitlabCiYmlTemplate.find('Auto-DevOps') }
|
subject(:template) { Gitlab::Template::GitlabCiYmlTemplate.find('Auto-DevOps') }
|
||||||
|
|
||||||
describe 'the created pipeline' do
|
where(:default_branch) do
|
||||||
let(:default_branch) { 'master' }
|
%w[master main]
|
||||||
let(:pipeline_branch) { default_branch }
|
end
|
||||||
let(:project) { create(:project, :auto_devops, :custom_repo, files: { 'README.md' => '' }) }
|
|
||||||
let(:user) { project.owner }
|
|
||||||
let(:service) { Ci::CreatePipelineService.new(project, user, ref: pipeline_branch ) }
|
|
||||||
let(:pipeline) { service.execute!(:push) }
|
|
||||||
let(:build_names) { pipeline.builds.pluck(:name) }
|
|
||||||
|
|
||||||
before do
|
with_them do
|
||||||
stub_ci_pipeline_yaml_file(template.content)
|
describe 'the created pipeline' do
|
||||||
allow_any_instance_of(Ci::BuildScheduleWorker).to receive(:perform).and_return(true)
|
let(:pipeline_branch) { default_branch }
|
||||||
allow(project).to receive(:default_branch).and_return(default_branch)
|
let(:project) { create(:project, :auto_devops, :custom_repo, files: { 'README.md' => '' }) }
|
||||||
end
|
let(:user) { project.owner }
|
||||||
|
let(:service) { Ci::CreatePipelineService.new(project, user, ref: pipeline_branch ) }
|
||||||
shared_examples 'no Kubernetes deployment job' do
|
let(:pipeline) { service.execute!(:push) }
|
||||||
it 'does not create any Kubernetes deployment-related builds' do
|
let(:build_names) { pipeline.builds.pluck(:name) }
|
||||||
expect(build_names).not_to include('production')
|
|
||||||
expect(build_names).not_to include('production_manual')
|
|
||||||
expect(build_names).not_to include('staging')
|
|
||||||
expect(build_names).not_to include('canary')
|
|
||||||
expect(build_names).not_to include('review')
|
|
||||||
expect(build_names).not_to include(a_string_matching(/rollout \d+%/))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'creates a build and a test job' do
|
|
||||||
expect(build_names).to include('build', 'test')
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when the project is set for deployment to AWS' do
|
|
||||||
let(:platform_value) { 'ECS' }
|
|
||||||
let(:review_prod_build_names) { build_names.select {|n| n.include?('review') || n.include?('production')} }
|
|
||||||
|
|
||||||
before do
|
before do
|
||||||
create(:ci_variable, project: project, key: 'AUTO_DEVOPS_PLATFORM_TARGET', value: platform_value)
|
stub_application_setting(default_branch_name: default_branch)
|
||||||
|
stub_ci_pipeline_yaml_file(template.content)
|
||||||
|
allow_any_instance_of(Ci::BuildScheduleWorker).to receive(:perform).and_return(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples 'no ECS job when AUTO_DEVOPS_PLATFORM_TARGET is not present' do |job_name|
|
shared_examples 'no Kubernetes deployment job' do
|
||||||
context 'when AUTO_DEVOPS_PLATFORM_TARGET is nil' do
|
it 'does not create any Kubernetes deployment-related builds' do
|
||||||
let(:platform_value) { nil }
|
expect(build_names).not_to include('production')
|
||||||
|
expect(build_names).not_to include('production_manual')
|
||||||
it 'does not trigger the job' do
|
expect(build_names).not_to include('staging')
|
||||||
expect(build_names).not_to include(job_name)
|
expect(build_names).not_to include('canary')
|
||||||
end
|
expect(build_names).not_to include('review')
|
||||||
end
|
expect(build_names).not_to include(a_string_matching(/rollout \d+%/))
|
||||||
|
|
||||||
context 'when AUTO_DEVOPS_PLATFORM_TARGET is empty' do
|
|
||||||
let(:platform_value) { '' }
|
|
||||||
|
|
||||||
it 'does not trigger the job' do
|
|
||||||
expect(build_names).not_to include(job_name)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it_behaves_like 'no Kubernetes deployment job'
|
it 'creates a build and a test job' do
|
||||||
|
expect(build_names).to include('build', 'test')
|
||||||
it_behaves_like 'no ECS job when AUTO_DEVOPS_PLATFORM_TARGET is not present' do
|
|
||||||
let(:job_name) { 'production_ecs' }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'creates an ECS deployment job for production only' do
|
context 'when the project is set for deployment to AWS' do
|
||||||
expect(review_prod_build_names).to contain_exactly('production_ecs')
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with FARGATE as a launch type' do
|
|
||||||
let(:platform_value) { 'FARGATE' }
|
|
||||||
|
|
||||||
it 'creates a FARGATE deployment job for production only' do
|
|
||||||
expect(review_prod_build_names).to contain_exactly('production_fargate')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'and we are not on the default branch' do
|
|
||||||
let(:platform_value) { 'ECS' }
|
let(:platform_value) { 'ECS' }
|
||||||
let(:pipeline_branch) { 'patch-1' }
|
let(:review_prod_build_names) { build_names.select {|n| n.include?('review') || n.include?('production')} }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
project.repository.create_branch(pipeline_branch)
|
create(:ci_variable, project: project, key: 'AUTO_DEVOPS_PLATFORM_TARGET', value: platform_value)
|
||||||
end
|
end
|
||||||
|
|
||||||
%w(review_ecs review_fargate).each do |job|
|
shared_examples 'no ECS job when AUTO_DEVOPS_PLATFORM_TARGET is not present' do |job_name|
|
||||||
it_behaves_like 'no ECS job when AUTO_DEVOPS_PLATFORM_TARGET is not present' do
|
context 'when AUTO_DEVOPS_PLATFORM_TARGET is nil' do
|
||||||
let(:job_name) { job }
|
let(:platform_value) { nil }
|
||||||
|
|
||||||
|
it 'does not trigger the job' do
|
||||||
|
expect(build_names).not_to include(job_name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when AUTO_DEVOPS_PLATFORM_TARGET is empty' do
|
||||||
|
let(:platform_value) { '' }
|
||||||
|
|
||||||
|
it 'does not trigger the job' do
|
||||||
|
expect(build_names).not_to include(job_name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'creates an ECS deployment job for review only' do
|
it_behaves_like 'no Kubernetes deployment job'
|
||||||
expect(review_prod_build_names).to contain_exactly('review_ecs', 'stop_review_ecs')
|
|
||||||
|
it_behaves_like 'no ECS job when AUTO_DEVOPS_PLATFORM_TARGET is not present' do
|
||||||
|
let(:job_name) { 'production_ecs' }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'creates an ECS deployment job for production only' do
|
||||||
|
expect(review_prod_build_names).to contain_exactly('production_ecs')
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with FARGATE as a launch type' do
|
context 'with FARGATE as a launch type' do
|
||||||
let(:platform_value) { 'FARGATE' }
|
let(:platform_value) { 'FARGATE' }
|
||||||
|
|
||||||
it 'creates an FARGATE deployment job for review only' do
|
it 'creates a FARGATE deployment job for production only' do
|
||||||
expect(review_prod_build_names).to contain_exactly('review_fargate', 'stop_review_fargate')
|
expect(review_prod_build_names).to contain_exactly('production_fargate')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
context 'and when the project has an active cluster' do
|
context 'and we are not on the default branch' do
|
||||||
let(:cluster) { create(:cluster, :project, :provided_by_gcp, projects: [project]) }
|
let(:platform_value) { 'ECS' }
|
||||||
|
let(:pipeline_branch) { 'patch-1' }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(cluster).to receive(:active?).and_return(true)
|
project.repository.create_branch(pipeline_branch, default_branch)
|
||||||
end
|
|
||||||
|
|
||||||
context 'on default branch' do
|
|
||||||
it 'triggers the deployment to Kubernetes, not to ECS' do
|
|
||||||
expect(build_names).not_to include('review')
|
|
||||||
expect(build_names).to include('production')
|
|
||||||
expect(build_names).not_to include('production_ecs')
|
|
||||||
expect(build_names).not_to include('review_ecs')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when the platform target is EC2' do
|
|
||||||
let(:platform_value) { 'EC2' }
|
|
||||||
|
|
||||||
it 'contains the build_artifact job, not the build job' do
|
|
||||||
expect(build_names).to include('build_artifact')
|
|
||||||
expect(build_names).not_to include('build')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when the project has no active cluster' do
|
|
||||||
it 'only creates a build and a test stage' do
|
|
||||||
expect(pipeline.stages_names).to eq(%w(build test))
|
|
||||||
end
|
|
||||||
|
|
||||||
it_behaves_like 'no Kubernetes deployment job'
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when the project has an active cluster' do
|
|
||||||
let!(:cluster) { create(:cluster, :project, :provided_by_gcp, projects: [project]) }
|
|
||||||
|
|
||||||
describe 'deployment-related builds' do
|
|
||||||
context 'on default branch' do
|
|
||||||
it 'does not include rollout jobs besides production' do
|
|
||||||
expect(build_names).to include('production')
|
|
||||||
expect(build_names).not_to include('production_manual')
|
|
||||||
expect(build_names).not_to include('staging')
|
|
||||||
expect(build_names).not_to include('canary')
|
|
||||||
expect(build_names).not_to include('review')
|
|
||||||
expect(build_names).not_to include(a_string_matching(/rollout \d+%/))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when STAGING_ENABLED=1' do
|
%w(review_ecs review_fargate).each do |job|
|
||||||
before do
|
it_behaves_like 'no ECS job when AUTO_DEVOPS_PLATFORM_TARGET is not present' do
|
||||||
create(:ci_variable, project: project, key: 'STAGING_ENABLED', value: '1')
|
let(:job_name) { job }
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it 'includes a staging job and a production_manual job' do
|
it 'creates an ECS deployment job for review only' do
|
||||||
expect(build_names).not_to include('production')
|
expect(review_prod_build_names).to contain_exactly('review_ecs', 'stop_review_ecs')
|
||||||
expect(build_names).to include('production_manual')
|
end
|
||||||
expect(build_names).to include('staging')
|
|
||||||
|
context 'with FARGATE as a launch type' do
|
||||||
|
let(:platform_value) { 'FARGATE' }
|
||||||
|
|
||||||
|
it 'creates an FARGATE deployment job for review only' do
|
||||||
|
expect(review_prod_build_names).to contain_exactly('review_fargate', 'stop_review_fargate')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'and when the project has an active cluster' do
|
||||||
|
let(:cluster) { create(:cluster, :project, :provided_by_gcp, projects: [project]) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
allow(cluster).to receive(:active?).and_return(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'on default branch' do
|
||||||
|
it 'triggers the deployment to Kubernetes, not to ECS' do
|
||||||
|
expect(build_names).not_to include('review')
|
||||||
|
expect(build_names).to include('production')
|
||||||
|
expect(build_names).not_to include('production_ecs')
|
||||||
|
expect(build_names).not_to include('review_ecs')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when the platform target is EC2' do
|
||||||
|
let(:platform_value) { 'EC2' }
|
||||||
|
|
||||||
|
it 'contains the build_artifact job, not the build job' do
|
||||||
|
expect(build_names).to include('build_artifact')
|
||||||
|
expect(build_names).not_to include('build')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when the project has no active cluster' do
|
||||||
|
it 'only creates a build and a test stage' do
|
||||||
|
expect(pipeline.stages_names).to eq(%w(build test))
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like 'no Kubernetes deployment job'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when the project has an active cluster' do
|
||||||
|
let!(:cluster) { create(:cluster, :project, :provided_by_gcp, projects: [project]) }
|
||||||
|
|
||||||
|
describe 'deployment-related builds' do
|
||||||
|
context 'on default branch' do
|
||||||
|
it 'does not include rollout jobs besides production' do
|
||||||
|
expect(build_names).to include('production')
|
||||||
|
expect(build_names).not_to include('production_manual')
|
||||||
|
expect(build_names).not_to include('staging')
|
||||||
expect(build_names).not_to include('canary')
|
expect(build_names).not_to include('canary')
|
||||||
expect(build_names).not_to include('review')
|
expect(build_names).not_to include('review')
|
||||||
expect(build_names).not_to include(a_string_matching(/rollout \d+%/))
|
expect(build_names).not_to include(a_string_matching(/rollout \d+%/))
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
context 'when CANARY_ENABLED=1' do
|
context 'when STAGING_ENABLED=1' do
|
||||||
before do
|
before do
|
||||||
create(:ci_variable, project: project, key: 'CANARY_ENABLED', value: '1')
|
create(:ci_variable, project: project, key: 'STAGING_ENABLED', value: '1')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'includes a staging job and a production_manual job' do
|
||||||
|
expect(build_names).not_to include('production')
|
||||||
|
expect(build_names).to include('production_manual')
|
||||||
|
expect(build_names).to include('staging')
|
||||||
|
expect(build_names).not_to include('canary')
|
||||||
|
expect(build_names).not_to include('review')
|
||||||
|
expect(build_names).not_to include(a_string_matching(/rollout \d+%/))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'includes a canary job and a production_manual job' do
|
context 'when CANARY_ENABLED=1' do
|
||||||
|
before do
|
||||||
|
create(:ci_variable, project: project, key: 'CANARY_ENABLED', value: '1')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'includes a canary job and a production_manual job' do
|
||||||
|
expect(build_names).not_to include('production')
|
||||||
|
expect(build_names).to include('production_manual')
|
||||||
|
expect(build_names).not_to include('staging')
|
||||||
|
expect(build_names).to include('canary')
|
||||||
|
expect(build_names).not_to include('review')
|
||||||
|
expect(build_names).not_to include(a_string_matching(/rollout \d+%/))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'outside of default branch' do
|
||||||
|
let(:pipeline_branch) { 'patch-1' }
|
||||||
|
|
||||||
|
before do
|
||||||
|
project.repository.create_branch(pipeline_branch, default_branch)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not include rollout jobs besides review' do
|
||||||
expect(build_names).not_to include('production')
|
expect(build_names).not_to include('production')
|
||||||
expect(build_names).to include('production_manual')
|
expect(build_names).not_to include('production_manual')
|
||||||
expect(build_names).not_to include('staging')
|
expect(build_names).not_to include('staging')
|
||||||
expect(build_names).to include('canary')
|
expect(build_names).not_to include('canary')
|
||||||
expect(build_names).not_to include('review')
|
expect(build_names).to include('review')
|
||||||
expect(build_names).not_to include(a_string_matching(/rollout \d+%/))
|
expect(build_names).not_to include(a_string_matching(/rollout \d+%/))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'outside of default branch' do
|
|
||||||
let(:pipeline_branch) { 'patch-1' }
|
|
||||||
|
|
||||||
before do
|
|
||||||
project.repository.create_branch(pipeline_branch)
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'does not include rollout jobs besides review' do
|
|
||||||
expect(build_names).not_to include('production')
|
|
||||||
expect(build_names).not_to include('production_manual')
|
|
||||||
expect(build_names).not_to include('staging')
|
|
||||||
expect(build_names).not_to include('canary')
|
|
||||||
expect(build_names).to include('review')
|
|
||||||
expect(build_names).not_to include(a_string_matching(/rollout \d+%/))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
describe 'build-pack detection' do
|
describe 'build-pack detection' do
|
||||||
using RSpec::Parameterized::TableSyntax
|
using RSpec::Parameterized::TableSyntax
|
||||||
|
|
||||||
where(:case_name, :files, :variables, :include_build_names, :not_include_build_names) do
|
where(:case_name, :files, :variables, :include_build_names, :not_include_build_names) do
|
||||||
'No match' | { 'README.md' => '' } | {} | %w() | %w(build test)
|
'No match' | { 'README.md' => '' } | {} | %w() | %w(build test)
|
||||||
'Buildpack' | { 'README.md' => '' } | { 'BUILDPACK_URL' => 'http://example.com' } | %w(build test) | %w()
|
'Buildpack' | { 'README.md' => '' } | { 'BUILDPACK_URL' => 'http://example.com' } | %w(build test) | %w()
|
||||||
'Explicit set' | { 'README.md' => '' } | { 'AUTO_DEVOPS_EXPLICITLY_ENABLED' => '1' } | %w(build test) | %w()
|
'Explicit set' | { 'README.md' => '' } | { 'AUTO_DEVOPS_EXPLICITLY_ENABLED' => '1' } | %w(build test) | %w()
|
||||||
'Explicit unset' | { 'README.md' => '' } | { 'AUTO_DEVOPS_EXPLICITLY_ENABLED' => '0' } | %w() | %w(build test)
|
'Explicit unset' | { 'README.md' => '' } | { 'AUTO_DEVOPS_EXPLICITLY_ENABLED' => '0' } | %w() | %w(build test)
|
||||||
'DOCKERFILE_PATH' | { 'README.md' => '' } | { 'DOCKERFILE_PATH' => 'Docker.file' } | %w(build test) | %w()
|
'DOCKERFILE_PATH' | { 'README.md' => '' } | { 'DOCKERFILE_PATH' => 'Docker.file' } | %w(build test) | %w()
|
||||||
'Dockerfile' | { 'Dockerfile' => '' } | {} | %w(build test) | %w()
|
'Dockerfile' | { 'Dockerfile' => '' } | {} | %w(build test) | %w()
|
||||||
'Clojure' | { 'project.clj' => '' } | {} | %w(build test) | %w()
|
'Clojure' | { 'project.clj' => '' } | {} | %w(build test) | %w()
|
||||||
'Go modules' | { 'go.mod' => '' } | {} | %w(build test) | %w()
|
'Go modules' | { 'go.mod' => '' } | {} | %w(build test) | %w()
|
||||||
'Go gb' | { 'src/gitlab.com/gopackage.go' => '' } | {} | %w(build test) | %w()
|
'Go gb' | { 'src/gitlab.com/gopackage.go' => '' } | {} | %w(build test) | %w()
|
||||||
'Gradle' | { 'gradlew' => '' } | {} | %w(build test) | %w()
|
'Gradle' | { 'gradlew' => '' } | {} | %w(build test) | %w()
|
||||||
'Java' | { 'pom.xml' => '' } | {} | %w(build test) | %w()
|
'Java' | { 'pom.xml' => '' } | {} | %w(build test) | %w()
|
||||||
'Multi-buildpack' | { '.buildpacks' => '' } | {} | %w(build test) | %w()
|
'Multi-buildpack' | { '.buildpacks' => '' } | {} | %w(build test) | %w()
|
||||||
'NodeJS' | { 'package.json' => '' } | {} | %w(build test) | %w()
|
'NodeJS' | { 'package.json' => '' } | {} | %w(build test) | %w()
|
||||||
'PHP' | { 'composer.json' => '' } | {} | %w(build test) | %w()
|
'PHP' | { 'composer.json' => '' } | {} | %w(build test) | %w()
|
||||||
'Play' | { 'conf/application.conf' => '' } | {} | %w(build test) | %w()
|
'Play' | { 'conf/application.conf' => '' } | {} | %w(build test) | %w()
|
||||||
'Python' | { 'Pipfile' => '' } | {} | %w(build test) | %w()
|
'Python' | { 'Pipfile' => '' } | {} | %w(build test) | %w()
|
||||||
'Ruby' | { 'Gemfile' => '' } | {} | %w(build test) | %w()
|
'Ruby' | { 'Gemfile' => '' } | {} | %w(build test) | %w()
|
||||||
'Scala' | { 'build.sbt' => '' } | {} | %w(build test) | %w()
|
'Scala' | { 'build.sbt' => '' } | {} | %w(build test) | %w()
|
||||||
'Static' | { '.static' => '' } | {} | %w(build test) | %w()
|
'Static' | { '.static' => '' } | {} | %w(build test) | %w()
|
||||||
end
|
|
||||||
|
|
||||||
with_them do
|
|
||||||
let(:project) { create(:project, :custom_repo, files: files) }
|
|
||||||
let(:user) { project.owner }
|
|
||||||
let(:service) { Ci::CreatePipelineService.new(project, user, ref: 'master' ) }
|
|
||||||
let(:pipeline) { service.execute(:push) }
|
|
||||||
let(:build_names) { pipeline.builds.pluck(:name) }
|
|
||||||
|
|
||||||
before do
|
|
||||||
stub_ci_pipeline_yaml_file(template.content)
|
|
||||||
allow_any_instance_of(Ci::BuildScheduleWorker).to receive(:perform).and_return(true)
|
|
||||||
variables.each do |(key, value)|
|
|
||||||
create(:ci_variable, project: project, key: key, value: value)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'creates a pipeline with the expected jobs' do
|
with_them do
|
||||||
expect(build_names).to include(*include_build_names)
|
let(:project) { create(:project, :custom_repo, files: files) }
|
||||||
expect(build_names).not_to include(*not_include_build_names)
|
let(:user) { project.owner }
|
||||||
|
let(:service) { Ci::CreatePipelineService.new(project, user, ref: default_branch ) }
|
||||||
|
let(:pipeline) { service.execute(:push) }
|
||||||
|
let(:build_names) { pipeline.builds.pluck(:name) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
stub_application_setting(default_branch_name: default_branch)
|
||||||
|
stub_ci_pipeline_yaml_file(template.content)
|
||||||
|
allow_any_instance_of(Ci::BuildScheduleWorker).to receive(:perform).and_return(true)
|
||||||
|
variables.each do |(key, value)|
|
||||||
|
create(:ci_variable, project: project, key: key, value: value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'creates a pipeline with the expected jobs' do
|
||||||
|
expect(build_names).to include(*include_build_names)
|
||||||
|
expect(build_names).not_to include(*not_include_build_names)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -35,7 +35,7 @@ module DesignManagementTestHelpers
|
||||||
|
|
||||||
def act_on_designs(designs, &block)
|
def act_on_designs(designs, &block)
|
||||||
issue = designs.first.issue
|
issue = designs.first.issue
|
||||||
version = build(:design_version, :empty, issue: issue).tap { |v| v.save!(validate: false) }
|
version = build(:design_version, designs_count: 0, issue: issue).tap { |v| v.save!(validate: false) }
|
||||||
designs.each do |d|
|
designs.each do |d|
|
||||||
yield.create!(design: d, version: version)
|
yield.create!(design: d, version: version)
|
||||||
end
|
end
|
||||||
|
|
|
@ -3407,10 +3407,10 @@ core-js-pure@^3.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.6.5.tgz#c79e75f5e38dbc85a662d91eea52b8256d53b813"
|
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.6.5.tgz#c79e75f5e38dbc85a662d91eea52b8256d53b813"
|
||||||
integrity sha512-lacdXOimsiD0QyNf9BC/mxivNJ/ybBGJXQFKzRekp1WTHoVUWsUHEn+2T8GJAzzIhyOuXA+gOxCVN3l+5PLPUA==
|
integrity sha512-lacdXOimsiD0QyNf9BC/mxivNJ/ybBGJXQFKzRekp1WTHoVUWsUHEn+2T8GJAzzIhyOuXA+gOxCVN3l+5PLPUA==
|
||||||
|
|
||||||
core-js@^3.1.3, core-js@^3.8.3:
|
core-js@^3.1.3, core-js@^3.9.0:
|
||||||
version "3.8.3"
|
version "3.9.0"
|
||||||
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.8.3.tgz#c21906e1f14f3689f93abcc6e26883550dd92dd0"
|
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.9.0.tgz#790b1bb11553a2272b36e2625c7179db345492f8"
|
||||||
integrity sha512-KPYXeVZYemC2TkNEkX/01I+7yd+nX3KddKwZ1Ww7SKWdI2wQprSgLmrTddT8nw92AjEklTsPBoSdQBhbI1bQ6Q==
|
integrity sha512-PyFBJaLq93FlyYdsndE5VaueA9K5cNB7CGzeCj191YYLhkQM0gdZR2SKihM70oF0wdqKSKClv/tEBOpoRmdOVQ==
|
||||||
|
|
||||||
core-js@~2.3.0:
|
core-js@~2.3.0:
|
||||||
version "2.3.0"
|
version "2.3.0"
|
||||||
|
|
Loading…
Reference in New Issue