Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
01ff8fda
Commit
01ff8fda
authored
Apr 07, 2022
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'add-verify-approval-job' into 'master'
Add verify approval job See merge request gitlab-org/gitlab!84588
parents
f01daf14
670a1375
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
0 deletions
+52
-0
.gitlab/ci/rules.gitlab-ci.yml
.gitlab/ci/rules.gitlab-ci.yml
+10
-0
.gitlab/ci/setup.gitlab-ci.yml
.gitlab/ci/setup.gitlab-ci.yml
+9
-0
tooling/bin/find_app_sec_approval
tooling/bin/find_app_sec_approval
+33
-0
No files found.
.gitlab/ci/rules.gitlab-ci.yml
View file @
01ff8fda
...
...
@@ -73,6 +73,9 @@
.if-merge-request-labels-skip-undercoverage
:
&if-merge-request-labels-skip-undercoverage
if
:
'
$CI_MERGE_REQUEST_LABELS
=~
/pipeline:skip-undercoverage/'
.if-merge-request-labels-jh-contribution
:
&if-merge-request-labels-jh-contribution
if
:
'
$CI_MERGE_REQUEST_LABELS
=~
/JiHu
contribution/'
.if-security-merge-request
:
&if-security-merge-request
if
:
'
$CI_PROJECT_NAMESPACE
==
"gitlab-org/security"
&&
$CI_MERGE_REQUEST_IID'
...
...
@@ -1682,6 +1685,13 @@
-
<<
:
*if-default-refs
changes
:
*code-backstage-patterns
.setup:rules:jh-contribution:
rules
:
-
<<
:
*if-jh
when
:
never
-
<<
:
*if-merge-request-labels-jh-contribution
.setup:rules:generate-frontend-fixtures-mapping:
rules
:
-
<<
:
*if-not-ee
...
...
.gitlab/ci/setup.gitlab-ci.yml
View file @
01ff8fda
...
...
@@ -68,6 +68,15 @@ verify-tests-yml:
-
install_tff_gem
-
scripts/verify-tff-mapping
verify-approvals
:
extends
:
-
.setup:rules:jh-contribution
needs
:
[]
script
:
-
source scripts/utils.sh
-
install_gitlab_gem
-
tooling/bin/find_app_sec_approval
generate-frontend-fixtures-mapping
:
extends
:
-
.setup:rules:generate-frontend-fixtures-mapping
...
...
tooling/bin/find_app_sec_approval
0 → 100755
View file @
01ff8fda
#!/usr/bin/env ruby
# frozen_string_literal: true
require
'gitlab'
# This script is used to confirm that AppSec has approved upstream JiHu contributions
#
# It will error if the approval is missing from the MR when it is run.
gitlab_token
=
ENV
.
fetch
(
'PROJECT_TOKEN_FOR_CI_SCRIPTS_API_USAGE'
)
gitlab_endpoint
=
ENV
.
fetch
(
'CI_API_V4_URL'
)
mr_project_path
=
ENV
[
'CI_MERGE_REQUEST_PROJECT_PATH'
]
mr_iid
=
ENV
[
'CI_MERGE_REQUEST_IID'
]
approval_label
=
"sec-planning::complete"
warn
"WARNING: CI_MERGE_REQUEST_PROJECT_PATH is missing."
if
mr_project_path
.
to_s
.
empty?
warn
"WARNING: CI_MERGE_REQUEST_IID is missing."
if
mr_iid
.
to_s
.
empty?
unless
mr_project_path
&&
mr_iid
warn
"ERROR: Exiting as this does not appear to be a merge request pipeline."
exit
end
Gitlab
.
configure
do
|
config
|
config
.
endpoint
=
gitlab_endpoint
config
.
private_token
=
gitlab_token
end
if
Gitlab
.
merge_request
(
mr_project_path
,
mr_iid
).
labels
.
include?
(
approval_label
)
puts
'INFO: No action required.'
else
abort
(
'ERROR: This merge request has not been approved by application security and is required prior to merge.'
)
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment