Skip to content

Commit 8883c54

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent 555532c commit 8883c54

28 files changed

+682
-347
lines changed

.gitlab/ci/build-images.gitlab-ci.yml

+7-6
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,18 @@ build-qa-image:
2323
script:
2424
- run_timed_command "scripts/build_qa_image"
2525

26-
# This image is used by:
27-
# - The `CNG` pipelines (via the `review-build-cng` job): https://gitlab.com/gitlab-org/build/CNG/-/blob/cfc67136d711e1c8c409bf8e57427a644393da2f/.gitlab-ci.yml#L335
28-
# - The `omnibus-gitlab` pipelines (via the `e2e:package-and-test` job): https://gitlab.com/gitlab-org/omnibus-gitlab/-/blob/dfd1ad475868fc84e91ab7b5706aa03e46dc3a86/.gitlab-ci.yml#L130
2926
build-assets-image:
3027
extends:
3128
- .base-image-build
3229
- .build-images:rules:build-assets-image
3330
stage: build-images
3431
needs: ["compile-production-assets"]
3532
script:
36-
# TODO: Change the image tag to be the MD5 of assets files and skip image building if the image exists
37-
# We'll also need to pass GITLAB_ASSETS_TAG to the trigerred omnibus-gitlab pipeline similarly to how we do it for trigerred CNG pipelines
38-
# https://gitlab.com/gitlab-org/gitlab/issues/208389
33+
- skopeo login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
3934
- run_timed_command "scripts/build_assets_image"
35+
artifacts:
36+
expire_in: 7 days
37+
paths:
38+
# The `cached-assets-hash.txt` file is used in `review-build-cng-env` (`.gitlab/ci/review-apps/main.gitlab-ci.yml`)
39+
# to pass the assets image tag to the CNG downstream pipeline.
40+
- cached-assets-hash.txt

.gitlab/ci/frontend.gitlab-ci.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
fi
2929
fi
3030
- assets_compile_script
31+
- echo -n "${GITLAB_ASSETS_HASH}" > "cached-assets-hash.txt"
3132

3233
compile-production-assets:
3334
extends:
@@ -43,6 +44,7 @@ compile-production-assets:
4344
# These assets are used in multiple locations:
4445
# - in `build-assets-image` job to create assets image for packaging systems
4546
# - GitLab UI for integration tests: https://gitlab.com/gitlab-org/gitlab-ui/-/blob/e88493b3c855aea30bf60baee692a64606b0eb1e/.storybook/preview-head.pug#L1
47+
- cached-assets-hash.txt
4648
- public/assets/
4749
- "${WEBPACK_COMPILE_LOG_PATH}"
4850
when: always
@@ -73,9 +75,6 @@ update-assets-compile-production-cache:
7375
- .assets-compile-cache-push
7476
- .shared:rules:update-cache
7577
stage: prepare
76-
script:
77-
- !reference [compile-production-assets, script]
78-
- echo -n "${GITLAB_ASSETS_HASH}" > "cached-assets-hash.txt"
7978
artifacts: {} # This job's purpose is only to update the cache.
8079

8180
update-assets-compile-test-cache:

.gitlab/ci/package-and-test/main.gitlab-ci.yml

+35-18
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,6 @@ stages:
3838
extends:
3939
- .gitlab-qa-install
4040

41-
.omnibus-env:
42-
variables:
43-
BUILD_ENV: build.env
44-
script:
45-
- |
46-
SECURITY_SOURCES=$([[ ! "$CI_PROJECT_NAMESPACE" =~ ^gitlab-org\/security ]] || echo "true")
47-
echo "SECURITY_SOURCES=${SECURITY_SOURCES:-false}" > $BUILD_ENV
48-
echo "OMNIBUS_GITLAB_CACHE_UPDATE=${OMNIBUS_GITLAB_CACHE_UPDATE:-false}" >> $BUILD_ENV
49-
for version_file in *_VERSION; do echo "$version_file=$(cat $version_file)" >> $BUILD_ENV; done
50-
echo "OMNIBUS_GITLAB_RUBY3_BUILD=${OMNIBUS_GITLAB_RUBY3_BUILD:-false}" >> $BUILD_ENV
51-
echo "OMNIBUS_GITLAB_CACHE_EDITION=${OMNIBUS_GITLAB_CACHE_EDITION:-GITLAB}" >> $BUILD_ENV
52-
echo "Built environment file for omnibus build:"
53-
cat $BUILD_ENV
54-
artifacts:
55-
reports:
56-
dotenv: $BUILD_ENV
57-
5841
.update-script:
5942
script:
6043
- export QA_COMMAND="bundle exec gitlab-qa Test::Omnibus::UpdateFromPrevious $RELEASE $GITLAB_VERSION $UPDATE_TYPE -- $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS"
@@ -108,9 +91,42 @@ dont-interrupt-me:
10891

10992
trigger-omnibus-env:
11093
extends:
111-
- .omnibus-env
11294
- .rules:omnibus-build
11395
stage: .pre
96+
needs:
97+
# We need this job because we need its `cached-assets-hash.txt` artifact, so that we can pass the assets image tag to the downstream omnibus-gitlab pipeline.
98+
- pipeline: $PARENT_PIPELINE_ID
99+
job: build-assets-image
100+
variables:
101+
BUILD_ENV: build.env
102+
before_script:
103+
- |
104+
# This is duplicating the function from `scripts/utils.sh` since `.gitlab/ci/package-and-test/main.gitlab-ci.yml` can be included in other projects.
105+
function assets_image_tag() {
106+
local cache_assets_hash_file="cached-assets-hash.txt"
107+
108+
if [[ -n "${CI_COMMIT_TAG}" ]]; then
109+
echo -n "${CI_COMMIT_REF_NAME}"
110+
elif [[ -f "${cache_assets_hash_file}" ]]; then
111+
echo -n "assets-hash-$(cat ${cache_assets_hash_file} | cut -c1-10)"
112+
else
113+
echo -n "${CI_COMMIT_SHA}"
114+
fi
115+
}
116+
script:
117+
- |
118+
SECURITY_SOURCES=$([[ ! "$CI_PROJECT_NAMESPACE" =~ ^gitlab-org\/security ]] || echo "true")
119+
echo "SECURITY_SOURCES=${SECURITY_SOURCES:-false}" > $BUILD_ENV
120+
echo "OMNIBUS_GITLAB_CACHE_UPDATE=${OMNIBUS_GITLAB_CACHE_UPDATE:-false}" >> $BUILD_ENV
121+
for version_file in *_VERSION; do echo "$version_file=$(cat $version_file)" >> $BUILD_ENV; done
122+
echo "OMNIBUS_GITLAB_RUBY3_BUILD=${OMNIBUS_GITLAB_RUBY3_BUILD:-false}" >> $BUILD_ENV
123+
echo "OMNIBUS_GITLAB_CACHE_EDITION=${OMNIBUS_GITLAB_CACHE_EDITION:-GITLAB}" >> $BUILD_ENV
124+
echo "GITLAB_ASSETS_TAG=$(assets_image_tag)" >> $BUILD_ENV
125+
echo "Built environment file for omnibus build:"
126+
cat $BUILD_ENV
127+
artifacts:
128+
reports:
129+
dotenv: $BUILD_ENV
114130

115131
trigger-omnibus:
116132
extends: .rules:omnibus-build
@@ -128,6 +144,7 @@ trigger-omnibus:
128144
GITLAB_SHELL_VERSION: $GITLAB_SHELL_VERSION
129145
GITLAB_WORKHORSE_VERSION: $GITLAB_WORKHORSE_VERSION
130146
GITLAB_VERSION: $CI_COMMIT_SHA
147+
GITLAB_ASSETS_TAG: $GITLAB_ASSETS_TAG
131148
IMAGE_TAG: $CI_COMMIT_SHA
132149
TOP_UPSTREAM_SOURCE_PROJECT: $CI_PROJECT_PATH
133150
SECURITY_SOURCES: $SECURITY_SOURCES

.gitlab/ci/qa.gitlab-ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ e2e:package-and-test:
7474
- build-qa-image
7575
- e2e-test-pipeline-generate
7676
variables:
77+
# This is needed by `trigger-omnibus-env` (`.gitlab/ci/package-and-test/main.gitlab-ci.yml`).
78+
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
7779
SKIP_MESSAGE: Skipping package-and-test due to mr containing only quarantine changes!
7880
RELEASE: "${REGISTRY_HOST}/${REGISTRY_GROUP}/build/omnibus-gitlab-mirror/gitlab-ee:${CI_COMMIT_SHA}"
7981
GITLAB_QA_IMAGE: "${CI_REGISTRY_IMAGE}/gitlab-ee-qa:${CI_COMMIT_SHA}"

.gitlab/ci/review-apps/main.gitlab-ci.yml

+11-5
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,25 @@ review-build-cng-env:
3434
- .review:rules:review-build-cng
3535
image: ${REGISTRY_HOST}/${REGISTRY_GROUP}/gitlab-build-images/debian-${DEBIAN_VERSION}-ruby-${RUBY_VERSION}:bundler-2.3
3636
stage: prepare
37-
needs: []
37+
needs:
38+
# We need this job because we need its `cached-assets-hash.txt` artifact, so that we can pass the assets image tag to the downstream CNG pipeline.
39+
- pipeline: $PARENT_PIPELINE_ID
40+
job: build-assets-image
41+
variables:
42+
BUILD_ENV: build.env
3843
before_script:
3944
- source ./scripts/utils.sh
4045
- install_gitlab_gem
4146
script:
42-
- ruby -r./scripts/trigger-build.rb -e "puts Trigger.variables_for_env_file(Trigger::CNG.new.variables)" > build.env
47+
- 'ruby -r./scripts/trigger-build.rb -e "puts Trigger.variables_for_env_file(Trigger::CNG.new.variables)" > $BUILD_ENV'
48+
- echo "GITLAB_ASSETS_TAG=$(assets_image_tag)" >> $BUILD_ENV
4349
- ruby -e 'puts "FULL_RUBY_VERSION=#{RUBY_VERSION}"' >> build.env
44-
- cat build.env
50+
- cat $BUILD_ENV
4551
artifacts:
4652
reports:
47-
dotenv: build.env
53+
dotenv: $BUILD_ENV
4854
paths:
49-
- build.env
55+
- $BUILD_ENV
5056
expire_in: 7 days
5157
when: always
5258

.gitlab/ci/review.gitlab-ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ start-review-app-pipeline:
6262
# They need to be explicitly passed on to the child pipeline.
6363
# https://docs.gitlab.com/ee/ci/pipelines/multi_project_pipelines.html#pass-cicd-variables-to-a-downstream-pipeline-by-using-the-variables-keyword
6464
variables:
65+
# This is needed by `review-build-cng-env` (`.gitlab/ci/review-apps/main.gitlab-ci.yml`).
66+
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
6567
SCHEDULE_TYPE: $SCHEDULE_TYPE
6668
DAST_RUN: $DAST_RUN
6769
SKIP_MESSAGE: Skipping review-app due to mr containing only quarantine changes!

Dockerfile.assets

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Simple container to store assets for later use
22
FROM scratch
3-
ADD public/assets /assets/
3+
COPY public/assets /assets/
44
CMD /bin/true

doc/ci/pipelines/settings.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,8 @@ when merging a merge request would cause the project's test coverage to decline.
284284
Follow these steps to enable the `Coverage-Check` MR approval rule:
285285

286286
1. Set up a [`coverage`](../yaml/index.md#coverage) regular expression for all jobs you want to include in the overall coverage value.
287-
1. Go to your project and select **Settings > General**.
288-
1. Expand **Merge request approvals**.
289-
1. Select **Enable** next to the `Coverage-Check` approval rule.
287+
1. Go to your project and select **Settings > Merge requests**.
288+
1. Under **Merge request approvals**, select **Enable** next to the `Coverage-Check` approval rule.
290289
1. Select the **Target branch**.
291290
1. Set the number of **Approvals required** to greater than zero.
292291
1. Select the users or groups to provide approval.

doc/development/database/efficient_in_operator_queries.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ The technique can only optimize `IN` queries that satisfy the following requirem
160160
in the following order: `column_for_the_in_query`, `order by column 1`, and
161161
`order by column 2`.
162162
- The columns in the `ORDER BY` clause are distinct
163-
(the combination of the columns uniquely identifies one particular column in the table).
163+
(the combination of the columns uniquely identifies one particular row in the table).
164164

165165
WARNING:
166166
This technique does not improve the performance of the `COUNT(*)` queries.
+7-90
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,11 @@
11
---
2-
stage: none
3-
group: unassigned
4-
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2+
redirect_to: 'software_design.md'
3+
remove_date: '2023-01-24'
54
---
65

7-
# Backend directory structure
6+
This document was moved to [another location](software_design.md)
87

9-
## Use namespaces to define bounded contexts
10-
11-
A healthy application is divided into macro and sub components that represent the contexts at play,
12-
whether they are related to business domain or infrastructure code.
13-
14-
As GitLab code has so many features and components it's hard to see what contexts are involved.
15-
We should expect any class to be defined inside a module/namespace that represents the contexts where it operates.
16-
17-
When we namespace classes inside their domain:
18-
19-
- Similar terminology becomes unambiguous as the domain clarifies the meaning:
20-
For example, `MergeRequests::Diff` and `Notes::Diff`.
21-
- Top-level namespaces could be associated to one or more groups identified as domain experts.
22-
- We can better identify the interactions and coupling between components.
23-
For example, several classes inside `MergeRequests::` domain interact more with `Ci::`
24-
domain and less with `ImportExport::`.
25-
26-
```ruby
27-
# bad
28-
class MyClass
29-
end
30-
31-
# good
32-
module MyDomain
33-
class MyClass
34-
end
35-
end
36-
```
37-
38-
### About namespace naming
39-
40-
A good guideline for naming a top-level namespace (bounded context) is to use the related
41-
[feature category](https://gitlab.com/gitlab-com/www-gitlab-com/-/blob/master/data/categories.yml). For example, `Continuous Integration` feature category maps to `Ci::` namespace.
42-
43-
Alternatively a new class could be added to `Projects::` or `Groups::` if it's either:
44-
45-
- Strictly related to one of these domains. For example `Projects::Alias`.
46-
- A new component that does not have yet a more specific domain. In this case, when
47-
a more explicit domain does emerge we would need to move the class to a more specific
48-
namespace.
49-
50-
Do not use the [stage or group name](https://about.gitlab.com/handbook/product/categories/#devops-stages)
51-
since a feature category could be reassigned to a different group in the future.
52-
53-
```ruby
54-
# bad
55-
module Create
56-
class Commit
57-
end
58-
end
59-
60-
# good
61-
module Repositories
62-
class Commit
63-
end
64-
end
65-
```
66-
67-
On the other hand, a feature category may sometimes be too granular. Features tend to be
68-
treated differently according to Product and Marketing, while they may share a lot of
69-
domain models and behavior under the hood. In this case, having too many bounded contexts
70-
could make them shallow and more coupled with other contexts.
71-
72-
Bounded contexts (or top-level namespaces) can be seen as macro-components in the overall app.
73-
Good bounded contexts should be [deep](https://medium.com/@nakabonne/depth-of-module-f62dac3c2fdb)
74-
so consider having nested namespaces to further break down complex parts of the domain.
75-
For example, `Ci::Config::`.
76-
77-
For example, instead of having separate and granular bounded contexts like: `ContainerScanning::`,
78-
`ContainerHostSecurity::`, `ContainerNetworkSecurity::`, we could have:
79-
80-
```ruby
81-
module ContainerSecurity
82-
module HostSecurity
83-
end
84-
85-
module NetworkSecurity
86-
end
87-
88-
module Scanning
89-
end
90-
end
91-
```
92-
93-
If classes that are defined into a namespace have a lot in common with classes in other namespaces,
94-
chances are that these two namespaces are part of the same bounded context.
8+
<!-- This redirect file can be deleted after <2023-01-24>. -->
9+
<!-- Redirects that point to other docs in the same project expire in three months. -->
10+
<!-- Redirects that point to docs in a different project or site (link is not relative and starts with `https:`) expire in one year. -->
11+
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/redirects.html -->

doc/development/feature_development.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Consult these topics for information on contributing to specific GitLab features
1919

2020
### General
2121

22-
- [Directory structure](directory_structure.md)
22+
- [Software design guides](software_design.md)
2323
- [GitLab EventStore](event_store.md) to publish/subscribe to domain events
2424
- [GitLab utilities](utilities.md)
2525
- [Newlines style guide](newlines_styleguide.md)

doc/development/i18n/externalization.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,7 @@ expect(wrapper.text()).toEqual(MSG_ALERT_SETTINGS_FORM_ERROR);
284284

285285
### Dynamic translations
286286

287-
Sometimes there are dynamic translations that the parser can't find when running
288-
`bin/rake gettext:find`. For these scenarios you can use the [`N_` method](https://github.com/grosser/gettext_i18n_rails/blob/c09e38d481e0899ca7d3fc01786834fa8e7aab97/Readme.md#unfound-translations-with-rake-gettextfind).
289-
There's also an alternative method to [translate messages from validation errors](https://github.com/grosser/gettext_i18n_rails/blob/c09e38d481e0899ca7d3fc01786834fa8e7aab97/Readme.md#option-a).
287+
For more details you can see how we [keep translations dynamic](#keep-translations-dynamic).
290288

291289
## Working with special content
292290

@@ -764,6 +762,10 @@ class MyPresenter
764762
end
765763
```
766764
765+
Sometimes there are dynamic translations that the parser can't find when running
766+
`bin/rake gettext:find`. For these scenarios you can use the [`N_` method](https://github.com/grosser/gettext_i18n_rails/blob/c09e38d481e0899ca7d3fc01786834fa8e7aab97/Readme.md#unfound-translations-with-rake-gettextfind).
767+
There's also an alternative method to [translate messages from validation errors](https://github.com/grosser/gettext_i18n_rails/blob/c09e38d481e0899ca7d3fc01786834fa8e7aab97/Readme.md#option-a).
768+
767769
### Splitting sentences
768770
769771
Never split a sentence, as it assumes the sentence's grammar and structure is the same in all

doc/development/reusing_abstractions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ Several base classes implement the service classes convention. You may consider
198198
- `BaseGroupService` for services scoped to groups.
199199

200200
Classes that are not service objects should be
201-
[created elsewhere](directory_structure.md#use-namespaces-to-define-bounded-contexts),
201+
[created elsewhere](software_design.md#use-namespaces-to-define-bounded-contexts),
202202
such as in `lib`.
203203

204204
#### ServiceResponse

0 commit comments

Comments
 (0)