Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
Revert "Merge pull request #539 from stevekuznetsov/skuznets/jenkins"
Browse files Browse the repository at this point in the history
This reverts commit eabc55f, reversing
changes made to b2200a2.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
  • Loading branch information
stevekuznetsov committed May 10, 2017
1 parent 8f5f653 commit cd03a63
Show file tree
Hide file tree
Showing 11 changed files with 204 additions and 48 deletions.
11 changes: 3 additions & 8 deletions hack/test.sh
Expand Up @@ -122,18 +122,13 @@ test_vagrant install-docker --docker.version=1.12.6 \
--repo='oso-rhui-rhel-server-*'
validate_version 'docker' '1.12.6'

test_vagrant clone-upstream-repos --clean --repo origin-web-console
test_vagrant checkout-repos --repo origin-web-console
test_vagrant clone-upstream-repos --clean
test_vagrant checkout-repos
test_vagrant build-origin-base-images
test_vagrant install-origin-assets-base

test_vagrant clone-upstream-repos --clean --repo origin
test_vagrant checkout-repos --repo origin
test_vagrant build-origin-base-images
test_vagrant install-origin
test_vagrant build-origin --images

test_vagrant clone-upstream-repos --clean --repo source-to-image
test_vagrant checkout-repos --repo source-to-image
test_vagrant build-sti --binary-only

popd
Expand Down
2 changes: 2 additions & 0 deletions lib/vagrant-openshift/action.rb
Expand Up @@ -395,7 +395,9 @@ def self.install_rhc(options)
autoload :BuildStiBaseWindows, action_root.join("build_sti_base_windows")
autoload :PrepareSshConfig, action_root.join("prepare_ssh_config")
autoload :SyncLocalRepository, action_root.join("sync_local_repository")
autoload :SyncUpstreamRepository, action_root.join("sync_upstream_repository")
autoload :LocalOriginCheckout, action_root.join("local_origin_checkout")
autoload :CreateBareRepoPlaceholders, action_root.join("create_bare_repo_placeholders")
autoload :RunOriginTests, action_root.join("run_origin_tests")
autoload :RunOriginAssetTests, action_root.join("run_origin_asset_tests")
autoload :RunStiTests, action_root.join("run_sti_tests")
Expand Down
19 changes: 10 additions & 9 deletions lib/vagrant-openshift/action/checkout_repositories.rb
Expand Up @@ -28,26 +28,27 @@ def initialize(app, env, options={})

def call(env)
git_clone_commands = "set -e\n"
repo_name = @options[:repo]
bare_repo_name = repo_name + "-bare"
bare_repo_path = Constants.build_dir + bare_repo_name
repo_path = Constants.build_dir + repo_name
Constants.repos_for_name(@options[:repo]).each do |repo_name, url|
bare_repo_name = repo_name + "-bare"
bare_repo_path = Constants.build_dir + bare_repo_name
repo_path = Constants.build_dir + repo_name

git_clone_commands += %{
git_clone_commands += %{
if [ -d #{bare_repo_path} ]; then
rm -rf #{repo_path}
echo 'Cloning #{repo_name} ...'
git clone --quiet --recurse-submodules #{bare_repo_path} #{repo_path}
}

if @options[:branch] && @options[:branch][repo_name]
git_clone_commands += "cd #{repo_path}; git checkout --quiet #{@options[:branch][repo_name]}; cd #{Constants.build_dir};\n"
end
git_clone_commands += %{
if @options[:branch] && @options[:branch][repo_name]
git_clone_commands += "cd #{repo_path}; git checkout --quiet #{@options[:branch][repo_name]}; cd #{Constants.build_dir};\n"
end
git_clone_commands += %{
else
MISSING_REPO+='#{bare_repo_name}'
fi
}
end

git_clone_commands += %{
if [ -n \"$MISSING_REPO\" ]; then
Expand Down
15 changes: 8 additions & 7 deletions lib/vagrant-openshift/action/clean.rb
Expand Up @@ -28,14 +28,15 @@ def initialize(app, env, options={})

def call(env)
git_clone_commands = ""
repo_name = @options[:repo]
bare_repo_name = repo_name + "-bare"
wc_repo_name = repo_name + "-bare-working_copy"
bare_repo_path = Constants.build_dir + bare_repo_name
repo_path = Constants.build_dir + repo_name
wc_repo_path = Constants.build_dir + wc_repo_name
Constants.repos_for_name(@options[:repo]).each do |repo_name, url|
bare_repo_name = repo_name + "-bare"
wc_repo_name = repo_name + "-bare-working_copy"
bare_repo_path = Constants.build_dir + bare_repo_name
repo_path = Constants.build_dir + repo_name
wc_repo_path = Constants.build_dir + wc_repo_name

git_clone_commands += "rm -rf #{bare_repo_path}; \n"
git_clone_commands += "rm -rf #{bare_repo_path}; \n"
end
do_execute env[:machine], git_clone_commands

@app.call(env)
Expand Down
17 changes: 9 additions & 8 deletions lib/vagrant-openshift/action/clone_upstream_repositories.rb
Expand Up @@ -36,19 +36,20 @@ def call(env)
}}

git_clone_commands = "set -e\n"
repo_name = @options[:repo]
bare_repo_name = repo_name + "-bare"
bare_repo_path = Constants.build_dir + bare_repo_name
Constants.repos_for_name(@options[:repo]).each do |repo_name, url|
bare_repo_name = repo_name + "-bare"
bare_repo_path = Constants.build_dir + bare_repo_name

if @options[:clean]
git_clone_commands += "rm -fr #{bare_repo_path};\n"
end
if @options[:clean]
git_clone_commands += "rm -fr #{bare_repo_path};\n"
end

git_clone_commands += %{
git_clone_commands += %{
if [ ! -d #{bare_repo_path} ]; then
git clone --quiet --bare #{Constants.repo_url_for_name(repo_name)} #{bare_repo_path} >/dev/null
git clone --quiet --bare #{url} #{bare_repo_path} >/dev/null
fi
}
end

sudo(env[:machine], "mkdir -p #{Constants.build_dir}")
sudo(env[:machine], "mkdir -p #{Constants.build_dir + "builder"} && chown -R #{ssh_user}:#{ssh_group} #{Constants.build_dir}")
Expand Down
53 changes: 53 additions & 0 deletions lib/vagrant-openshift/action/create_bare_repo_placeholders.rb
@@ -0,0 +1,53 @@
#--
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#++

module Vagrant
module Openshift
module Action
class CreateBareRepoPlaceholders
include CommandHelper

def initialize(app, env)
@app = app
@env = env
end

def call(env)
remote_write(env[:machine], "/root/.ssh/config", "root:root", "0600") {
%{Host github.com
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
}}

git_clone_commands = ""
Constants.repos(env).each do |repo_name, url|
bare_repo_name = repo_name + "-bare"
bare_repo_path = Constants.build_dir + bare_repo_name

git_clone_commands += "[ ! -d #{bare_repo_path} ] && git init --bare #{bare_repo_path};\n"
end

ssh_user = env[:machine].ssh_info[:username]
sudo(env[:machine], "mkdir -p #{Constants.build_dir}")
sudo(env[:machine], "mkdir -p #{Constants.build_dir + "builder"} && chown -R #{ssh_user}:#{ssh_user} #{Constants.build_dir}")
do_execute env[:machine], git_clone_commands

@app.call(env)
end
end
end
end
end
4 changes: 3 additions & 1 deletion lib/vagrant-openshift/action/local_origin_checkout.rb
Expand Up @@ -38,7 +38,9 @@ def call(env)
end
Dir.chdir(go_path) do
commands = "echo 'Waiting for the cloning process to finish'\n"
commands += repo_checkout_bash_command(@options[:repo], Constants.repo_url_for_name(@options[:repo]))
Constants.repos_for_name(@options[:repo]).each do |repo, url|
commands += repo_checkout_bash_command(repo, url)
end

system(commands)
puts "Origin repositories cloned into #{Dir.pwd}"
Expand Down
17 changes: 9 additions & 8 deletions lib/vagrant-openshift/action/sync_local_repository.rb
Expand Up @@ -29,17 +29,18 @@ def initialize(app, env, options={})
def call(env)
env[:machine].env.ui.info("Synchronizing local sources")

repo_name = @options[:repo]
local_repo = Pathname.new(File.expand_path(File.join(env[:machine].env.root_path, "..", repo_name)))
unless local_repo.exist?
local_repo = Pathname.new(File.expand_path(File.join(env[:machine].env.root_path, repo_name)))
Constants.repos_for_name(@options[:repo]).each do |repo_name, url|
local_repo = Pathname.new(File.expand_path(File.join(env[:machine].env.root_path, "..", repo_name)))
unless local_repo.exist?
env[:machine].ui.warn "Missing local clone of repository #{repo_name}"
next
local_repo = Pathname.new(File.expand_path(File.join(env[:machine].env.root_path, repo_name)))
unless local_repo.exist?
env[:machine].ui.warn "Missing local clone of repository #{repo_name}"
next
end
end
end

Dir.chdir(local_repo) { sync_repo(env[:machine], repo_name) }
Dir.chdir(local_repo) { sync_repo(env[:machine], repo_name) }
end

@app.call(env)
end
Expand Down
66 changes: 66 additions & 0 deletions lib/vagrant-openshift/action/sync_upstream_repository.rb
@@ -0,0 +1,66 @@
#--
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#++

module Vagrant
module Openshift
module Action
class SyncUpstreamRepository
include CommandHelper

def initialize(app, env)
@app = app
@env = env
end

def call(env)
env[:machine].env.ui.info("Synchronizing upstream sources\n")
command = "set -e\n"

Constants.repos(env).each do |repo_name, url|

branch="master"

bare_repo_name = repo_name + "-bare"
bare_repo_wc_name = repo_name + "-bare-working_copy"
bare_repo_path = Constants.build_dir + bare_repo_name
bare_repo_wc_path = Constants.build_dir + bare_repo_wc_name

command += "export GIT_SSH=#{Constants.git_ssh};\n" unless Constants.git_ssh.nil? or Constants.git_ssh.empty?
command += %{
if [ ! -d #{bare_repo_wc_path} ]; then
echo 'Cloning #{repo_name} ...'
git clone -l --quiet #{bare_repo_path} #{bare_repo_wc_path}
fi
cd #{bare_repo_wc_path}
git remote add upstream #{url}
git fetch upstream
git checkout master
git reset --hard upstream/#{branch}
git push origin master -f
}
end

do_execute(env[:machine], command)

env[:machine].env.ui.info("Done")
@app.call(env)
end

end
end
end
end
5 changes: 0 additions & 5 deletions lib/vagrant-openshift/command/clone_upstream_repositories.rb
Expand Up @@ -28,7 +28,6 @@ def self.synopsis
def execute
options = {}
options[:clean] = false
options[:repo] = 'origin'

opts = OptionParser.new do |o|
o.banner = "Usage: vagrant clone-upstream-repositories"
Expand All @@ -37,10 +36,6 @@ def execute
o.on("-c", "--clean", "Remove the current bare repositories on disk if present") do |c|
options[:clean] = true
end

o.on("-r [repo-name]", "--repo [repo-name]", String, "Clone the specified repo. Default is 'origin'.") do |f|
options[:repo] = f
end
end

# Parse the options
Expand Down
43 changes: 41 additions & 2 deletions lib/vagrant-openshift/constants.rb
Expand Up @@ -19,8 +19,47 @@ module Vagrant
module Openshift
class Constants

def self.repo_url_for_name(name)
"https://github.com/openshift/#{name}.git"
def self.repos(env)
openshift_repos
end

def self.logging_repos(env)
aggregated_logging_repos
end

def self.openshift_repos
{
'origin' => 'https://github.com/openshift/origin.git',
'source-to-image' => 'https://github.com/openshift/source-to-image.git',
'origin-web-console' => 'https://github.com/openshift/origin-web-console.git'
}
end

def self.console_repos
{
'origin-web-console' => 'https://github.com/openshift/origin-web-console.git'
}
end

def self.aggregated_logging_repos
{
'origin-aggregated-logging' => 'https://github.com/openshift/origin-aggregated-logging.git'
}
end

def self.repos_for_name(reponame)
{
'origin' => openshift_repos,
nil => openshift_repos,
'origin-console' => console_repos,
'origin-aggregated-logging' => aggregated_logging_repos,
'origin-metrics' => {
'origin-metrics' => 'https://github.com/openshift/origin-metrics.git'
},
'openshift-ansible' => {
'openshift-ansible' => 'https://github.com/openshift/openshift-ansible.git'
}
}[reponame]
end

def self.git_branch_current
Expand Down

0 comments on commit cd03a63

Please sign in to comment.