Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(test): add IT progress message #239

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/coa/env_bootstrapper/bosh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def deploy_git_server(manifest)
file.write(manifest.to_yaml)
file.close
client.deploy("git-server", file.path)
logger.log_and_puts :info, "git-server is available at #{git_server_ip}"
ensure
file&.unlink
end
Expand Down
17 changes: 16 additions & 1 deletion lib/coa/env_bootstrapper/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def initialize(bosh, prereqs)
end

def push_templates_repo
logger.log_and_puts :info, "Creating templates repo"
init_and_push(TEMPLATES_REPO_DIR, "paas-templates")

Dir.chdir TEMPLATES_REPO_DIR do
Expand All @@ -31,6 +32,8 @@ def push_templates_repo
end

def push_secrets_repo(concourse_config)
logger.log_and_puts :info, "Creating secrets repo"

write_concourse_credentials(concourse_config)
write_git_config
write_bosh_ca_cert_file
Expand All @@ -39,6 +42,7 @@ def push_secrets_repo(concourse_config)
end

def push_cf_ops_automation
logger.log_and_puts :info, "Creating cf_ops_automation repo"
Dir.chdir PROJECT_ROOT_DIR do
remote_name = SecureRandom.hex
branch_name = SecureRandom.hex
Expand Down Expand Up @@ -76,20 +80,31 @@ def remote_exists?(remote_name)

def init_and_push(repo_path, repo_name)
coa_submodule_path = "shared-files/cf-ops-automation-reference-dataset-submodule-sample"
git_commit_message_file = ".git/coa_commit"
Dir.chdir repo_path do
latest_coa_commit_detail = run_cmd "git log -1"
submodule_commit_reference = templates_coa_reference_dataset_submodule_sha1(coa_submodule_path, repo_path)
run_cmd "git init ."
run_cmd "git config --local user.email '[email protected]'"
run_cmd "git config --local user.name 'Fake User For COA Bootstrapper Pipeline'"
File.open(git_commit_message_file, 'w') { |file| file.write "Original COA commit:\n";file.write latest_coa_commit_detail }
run_cmd "git remote remove origin" if remote_exists?("origin")
run_cmd "git remote add origin git://#{server_ip}/#{repo_name}"
create_git_submodule_from_templates_repo(coa_submodule_path, repo_path, submodule_commit_reference)
run_cmd "git add -A && git commit -m 'Commit'", fail_silently: true
run_cmd "git add -A && git commit --file #{git_commit_message_file}", fail_silently: true
run_cmd "git checkout master"
bosh_sourced_cmd "git push origin master --force" # not working with virtualbox? `bucc routes`
end
end

def cleanup_templates_coa_git_info(repo_path)
return unless repo_path == TEMPLATES_REPO_DIR
Dir.chdir repo_path do
run_cmd "rm -rf .git"
run_cmd "rm -f .gitmodules"
end
end

def templates_coa_reference_dataset_submodule_sha1(coa_submodule_path, repo_path)
return unless repo_path == TEMPLATES_REPO_DIR
extract_submodule_commit_reference(coa_submodule_path)
Expand Down