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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
338bb2ac
Commit
338bb2ac
authored
Feb 12, 2018
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused codes and address feedback
parent
bc2739a5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
47 deletions
+21
-47
qa/qa/factory/resource/runner.rb
qa/qa/factory/resource/runner.rb
+1
-11
qa/qa/service/runner.rb
qa/qa/service/runner.rb
+4
-18
qa/qa/specs/features/project/deploy_key_clone_spec.rb
qa/qa/specs/features/project/deploy_key_clone_spec.rb
+16
-18
No files found.
qa/qa/factory/resource/runner.rb
View file @
338bb2ac
...
...
@@ -4,7 +4,7 @@ module QA
module
Factory
module
Resource
class
Runner
<
Factory
::
Base
attr_writer
:name
,
:tags
,
:image
,
:executor
,
:docker_image
attr_writer
:name
,
:tags
,
:image
dependency
Factory
::
Resource
::
Project
,
as: :project
do
|
project
|
project
.
name
=
'project-with-ci-cd'
...
...
@@ -23,14 +23,6 @@ module QA
@image
||
'gitlab/gitlab-runner:alpine'
end
def
executor
@executor
||
'shell'
end
def
docker_image
@docker_image
||
'ubuntu/16.04'
end
def
fabricate!
project
.
visit!
...
...
@@ -44,8 +36,6 @@ module QA
runner
.
address
=
runners
.
coordinator_address
runner
.
tags
=
tags
runner
.
image
=
image
runner
.
executor
=
executor
runner
.
docker_image
=
docker_image
runner
.
register!
end
end
...
...
qa/qa/service/runner.rb
View file @
338bb2ac
...
...
@@ -6,15 +6,13 @@ module QA
include
Scenario
::
Actable
include
Service
::
Shellout
attr_accessor
:token
,
:address
,
:tags
,
:image
,
:executor
,
:docker_image
attr_accessor
:token
,
:address
,
:tags
,
:image
def
initialize
(
name
)
@image
=
'gitlab/gitlab-runner:alpine'
@name
=
name
||
"qa-runner-
#{
SecureRandom
.
hex
(
4
)
}
"
@network
=
Runtime
::
Scenario
.
attributes
[
:network
]
||
'test'
@tags
=
%w[qa test]
@image
=
'gitlab/gitlab-runner:alpine'
@executor
=
'shell'
@docker_image
=
'ubuntu/16.04'
end
def
pull
...
...
@@ -28,28 +26,16 @@ module QA
-e CI_SERVER_URL=
#{
@address
}
-e REGISTER_NON_INTERACTIVE=true
-e REGISTRATION_TOKEN=
#{
@token
}
-e RUNNER_EXECUTOR=
#{
@executor
}
-e DOCKER_IMAGE=
#{
@docker_image
}
-e RUNNER_EXECUTOR=shell
-e RUNNER_TAG_LIST=
#{
@tags
.
join
(
','
)
}
-e RUNNER_NAME=
#{
@name
}
#{
@image
}
-c '
#{
docker_commands
}
'
#{
@image
}
-c '
gitlab-runner register && gitlab-runner run
'
CMD
end
def
remove!
shell
"docker rm -f
#{
@name
}
"
end
private
def
docker_commands
commands
=
[
'gitlab-runner register'
,
'gitlab-runner run'
]
commands
.
join
(
' && '
)
end
end
end
end
qa/qa/specs/features/
cicd/pull_with_deploy_key
_spec.rb
→
qa/qa/specs/features/
project/deploy_key_clone
_spec.rb
View file @
338bb2ac
require
'digest/sha1'
module
QA
feature
'
pull codes with
a deploy key'
,
:core
,
:docker
do
feature
'
cloning code using
a deploy key'
,
:core
,
:docker
do
let
(
:runner_name
)
{
"qa-runner-
#{
Time
.
now
.
to_i
}
"
}
after
do
Service
::
Runner
.
new
(
runner_name
).
remove!
end
scenario
'user set
up a deploy key and use it to pull from CI job
'
do
scenario
'user set
s up a deploy key to clone code using pipelines
'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
project
=
Factory
::
Resource
::
Project
.
fabricate!
do
|
resource
|
resource
.
name
=
'
cicd-pull-with-deploy-key
'
resource
.
name
=
'
deploy-key-clone-project
'
end
Factory
::
Resource
::
Runner
.
fabricate!
do
|
runner
|
runner
.
project
=
project
runner
.
name
=
runner_name
runner
.
tags
=
%w[qa docker]
runner
.
executor
=
'shell'
runner
.
image
=
'gitlab/gitlab-runner:ubuntu'
end
...
...
@@ -47,8 +46,7 @@ module QA
repository_uri
=
Git
::
Repository
.
parse_uri
(
repository_url
)
gitlab_ci
=
<<~
YAML
gitlab_ci
=
<<~
YAML
cat-config:
script:
- mkdir -p ~/.ssh
...
...
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