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
8c0768d3
Commit
8c0768d3
authored
Jul 05, 2021
by
Tiffany Rea
Committed by
Sanad Liaquat
Jul 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a separate user to avoid same namespace
parent
62d706c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
7 deletions
+36
-7
qa/qa/page/project/import/github.rb
qa/qa/page/project/import/github.rb
+1
-0
qa/qa/specs/features/ee/browser_ui/4_verify/pipeline_for_project_mirror_github_spec.rb
...er_ui/4_verify/pipeline_for_project_mirror_github_spec.rb
+35
-7
No files found.
qa/qa/page/project/import/github.rb
View file @
8c0768d3
...
...
@@ -38,6 +38,7 @@ module QA
set_path
(
full_path
,
name
)
import_project
(
full_path
)
wait_for_success
go_to_project
(
name
)
end
private
...
...
qa/qa/specs/features/ee/browser_ui/4_verify/pipeline_for_project_mirror_github_spec.rb
View file @
8c0768d3
...
...
@@ -5,14 +5,26 @@ require 'faker'
require
'base64'
module
QA
context
'Verify'
,
:github
,
only:
{
subdomain: :stagin
g
}
do
context
'Verify'
,
:github
,
:requires_admin
,
only:
{
subdomain: :staging
},
quarantine:
{
issue:
'https://gitlab.com/gitlab-org/gitlab/-/issues/335045'
,
type: :bu
g
}
do
include
Support
::
Api
describe
'Pipeline for project mirrors Github'
do
let
(
:commit_message
)
{
"Update
#{
github_data
[
:file_name
]
}
-
#{
Time
.
now
}
"
}
let
(
:project_name
)
{
'github-project-with-pipeline'
}
let
(
:api_client
)
{
Runtime
::
API
::
Client
.
new
(
:gitlab
)
}
let
(
:github_client
)
{
Github
::
Client
::
Repos
::
Contents
.
new
oauth_token:
github_data
[
:access_token
]
}
let
(
:admin_api_client
)
{
Runtime
::
API
::
Client
.
as_admin
}
let
(
:user_api_client
)
{
Runtime
::
API
::
Client
.
new
(
:gitlab
,
user:
user
)
}
let
(
:group
)
do
Resource
::
Group
.
fabricate_via_api!
end
let
(
:user
)
do
Resource
::
User
.
fabricate_via_api!
do
|
resource
|
resource
.
api_client
=
admin_api_client
resource
.
hard_delete_on_api_removal
=
true
end
end
let
(
:import_project
)
do
EE
::
Resource
::
ImportRepoWithCICD
.
fabricate_via_browser_ui!
do
|
project
|
...
...
@@ -24,13 +36,21 @@ module QA
end
before
do
Flow
::
Login
.
sign_in
# Create both tokens before logging in the first time so that we don't need to log out in the middle of the test
admin_api_client
.
personal_access_token
user_api_client
.
personal_access_token
group
.
add_member
(
user
,
Resource
::
Members
::
AccessLevel
::
OWNER
)
Flow
::
Login
.
sign_in
(
as:
user
)
group
.
visit!
import_project
Page
::
Project
::
Menu
.
perform
(
&
:click_ci_cd_pipelines
)
end
after
do
remove_project
group
.
remove_via_api!
user
.
remove_via_api!
end
it
'user commits to GitHub triggers CI pipeline'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/144'
do
...
...
@@ -57,6 +77,8 @@ module QA
end
def
edit_github_file
Runtime
::
Logger
.
info
"Making changes to Github file."
file
=
github_client
.
get
github_data
[
:repo_owner
],
github_data
[
:repo_name
],
github_data
[
:file_name
]
file_sha
=
file
.
body
[
'sha'
]
file_path
=
file
.
body
[
'path'
]
...
...
@@ -73,17 +95,23 @@ module QA
end
def
import_project_id
request
=
Runtime
::
API
::
Request
.
new
(
api_client
,
import_project
.
api_get_path
)
request
=
Runtime
::
API
::
Request
.
new
(
user_
api_client
,
import_project
.
api_get_path
)
JSON
.
parse
(
get
(
request
.
url
))[
'id'
]
end
def
trigger_project_mirror
request
=
Runtime
::
API
::
Request
.
new
(
api_client
,
"/projects/
#{
import_project_id
}
/mirror/pull"
)
post
(
request
.
url
,
nil
)
Runtime
::
Logger
.
info
"Triggering pull mirror request."
request
=
Runtime
::
API
::
Request
.
new
(
user_api_client
,
"/projects/
#{
import_project_id
}
/mirror/pull"
)
Support
::
Retrier
.
retry_until
(
max_attempts:
6
,
sleep_interval:
10
)
do
response
=
post
(
request
.
url
,
nil
)
Runtime
::
Logger
.
info
"Mirror pull request response:
#{
response
}
"
response
.
code
==
Support
::
Api
::
HTTP_STATUS_OK
end
end
def
remove_project
delete_project_request
=
Runtime
::
API
::
Request
.
new
(
api_client
,
"/projects/
#{
CGI
.
escape
(
"
#{
Runtime
::
Namespace
.
path
}
/
#{
import_project
.
name
}
"
)
}
"
)
delete_project_request
=
Runtime
::
API
::
Request
.
new
(
user_
api_client
,
"/projects/
#{
CGI
.
escape
(
"
#{
Runtime
::
Namespace
.
path
}
/
#{
import_project
.
name
}
"
)
}
"
)
delete
delete_project_request
.
url
end
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