summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-02-12 20:50:15 +0800
committerLin Jen-Shin <godfat@godfat.org>2018-02-12 21:16:25 +0800
commit338bb2ac975bb5c4a7d8074c126029d86074e251 (patch)
treebf82630ad277d97f1fb804e71c885970ff0db5b1
parentbc2739a52ff9a5366d3d668ef0ee07e91974c540 (diff)
downloadgitlab-ce-338bb2ac975bb5c4a7d8074c126029d86074e251.tar.gz
Remove unused codes and address feedback
-rw-r--r--qa/qa/factory/resource/runner.rb12
-rw-r--r--qa/qa/service/runner.rb22
-rw-r--r--qa/qa/specs/features/project/deploy_key_clone_spec.rb (renamed from qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb)34
3 files changed, 21 insertions, 47 deletions
diff --git a/qa/qa/factory/resource/runner.rb b/qa/qa/factory/resource/runner.rb
index da0f4b8f520..03b69eb1bdf 100644
--- a/qa/qa/factory/resource/runner.rb
+++ b/qa/qa/factory/resource/runner.rb
@@ -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
diff --git a/qa/qa/service/runner.rb b/qa/qa/service/runner.rb
index 1362d1b1410..d0ee33c69f2 100644
--- a/qa/qa/service/runner.rb
+++ b/qa/qa/service/runner.rb
@@ -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
diff --git a/qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb b/qa/qa/specs/features/project/deploy_key_clone_spec.rb
index c1fa8d5b58a..297e677175f 100644
--- a/qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb
+++ b/qa/qa/specs/features/project/deploy_key_clone_spec.rb
@@ -1,26 +1,25 @@
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 setup a deploy key and use it to pull from CI job' do
+ scenario 'user sets 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,20 +46,19 @@ module QA
repository_uri = Git::Repository.parse_uri(repository_url)
- gitlab_ci =
- <<~YAML
- cat-config:
- script:
- - mkdir -p ~/.ssh
- - ssh-keyscan -p #{repository_uri.port || 22} #{repository_uri.host} >> ~/.ssh/known_hosts
- - eval $(ssh-agent -s)
- - echo "$DEPLOY_KEY" | ssh-add -
- - git clone #{repository_url}
- - sha1sum #{project.name}/.gitlab-ci.yml
- tags:
- - qa
- - docker
- YAML
+ gitlab_ci = <<~YAML
+ cat-config:
+ script:
+ - mkdir -p ~/.ssh
+ - ssh-keyscan -p #{repository_uri.port || 22} #{repository_uri.host} >> ~/.ssh/known_hosts
+ - eval $(ssh-agent -s)
+ - echo "$DEPLOY_KEY" | ssh-add -
+ - git clone #{repository_url}
+ - sha1sum #{project.name}/.gitlab-ci.yml
+ tags:
+ - qa
+ - docker
+ YAML
sha1sum = Digest::SHA1.hexdigest(gitlab_ci)