Skip to content

Commit

Permalink
bootstrap-coa-env(*) Remove bucc from Docker file, make misc correcti…
Browse files Browse the repository at this point in the history
…ons and improvement
  • Loading branch information
lucaspinto committed Jul 19, 2018
1 parent 64a0209 commit 4fe5f23
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 45 deletions.
6 changes: 0 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ RUN curl -sfL "https://codeclimate.com/downloads/test-reporter/test-reporter-lat
RUN curl -sfL "https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc" > /usr/local/bin/gh-md-toc \
&& chmod a+x /usr/local/bin/gh-md-toc

RUN curl -sfL "https://github.com/starkandwayne/bucc/archive/v0.5.0.tar.gz" > bucc.tar.gz \
&& tar -xzf bucc.tar.gz \
&& cp bucc-0.5.0/bin/bucc /usr/local/bin/bucc \
&& chmod a+x /usr/local/bin/bucc \
&& rm -rf bucc.tar.gz bucc-0.5.0

# Download BOSH v2 CLI
RUN curl -o /usr/local/bin/bosh https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-3.0.1-linux-amd64 \
&& echo "58e6853291c3535e77e5128af9f0e8e4303dd57e5a329aa976f197c010517975 */usr/local/bin/bosh" | shasum -a 256 -c - \
Expand Down
6 changes: 6 additions & 0 deletions ci/bootstrap-coa-env-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ resources:
skip_ssl_verification: ((cf-ops-automation-git-insecure))
paths: [ "Gemfile*", "Dockerfile" ]

- name: bucc
type: git
source:
uri: https://github.com/starkandwayne/bucc

jobs:
- name: build-cached-image
plan:
Expand All @@ -42,6 +47,7 @@ jobs:
trigger: true
- get: cf-ops-automation
trigger: true
- get: bucc
- task: generate_private_params_file
file: cf-ops-automation/concourse/tasks/generate_coa_env_bootstrap_private_prereqs.yml
params:
Expand Down
11 changes: 5 additions & 6 deletions ci/bootstrap_coa_env/prereqs.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
inactive_steps:
- deploy_transiant_infra
# - upload_stemcell
- upload_cloud_config
# - install_git_server
- upload_stemcell
# - upload_cloud_config
# - install_git_server

bucc:
path: /Users/lucaspinto/workspace/src/github.com/starkandwayne/bucc/bin/
path: bucc/bin/
cpi: virtualbox

stemcell:
Expand Down Expand Up @@ -78,7 +78,7 @@ pipeline_credentials:
secrets-branch: master
paas-templates-branch: master
cf-ops-automation-uri: http://github.com/orange-cloudfoundry/cf-ops-automation/
cf-ops-automation-branch: 113_coa_env_bootstrap
cf-ops-automation-branch: master
cf-ops-automation-tag-filter: ""
iaas-type: virtualbox
s3-stemcell-access-key-id: ""
Expand All @@ -90,4 +90,3 @@ pipeline_credentials:
stemcell-version: "3586.25"
s3-stemcell-endpoint: https://s3.amazonaws.com
s3-stemcell-skip-ssl-verification: false

7 changes: 3 additions & 4 deletions concourse/pipelines/template/depls-pipeline.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ resources:
source:
bucket: ((s3-stemcell-bucket))
region_name: ((s3-stemcell-region-name))
# customization is required to remove bosh prefix in stemcell name
regexp: ((stemcell-name-prefix))/bosh-stemcell-(.*)-((stemcell-main-name)).tgz
regexp: ((stemcell-name-prefix))((stemcell-main-name))/bosh-stemcell-(.*)-((stemcell-main-name)).tgz
access_key_id: ((s3-stemcell-access-key-id))
secret_access_key: ((s3-stemcell-secret-key))
endpoint: ((s3-stemcell-endpoint))
Expand Down Expand Up @@ -452,7 +451,7 @@ jobs:
- get: secrets-full-writer
params: { submodules: none}
- get: bosh-stemcell
version: { path: ((stemcell-name-prefix))/bosh-stemcell-((stemcell-version))-((stemcell-main-name)).tgz }
version: { path: ((stemcell-name-prefix))((stemcell-main-name))/bosh-stemcell-((stemcell-version))-((stemcell-main-name)).tgz }
trigger: true
attempts: 2
- get: cf-ops-automation
Expand Down Expand Up @@ -831,7 +830,7 @@ jobs:
echo "check-resource -r $BUILD_PIPELINE_NAME/<%= name %> --from version:((<%= name %>-version))" >> result-dir/flight-plan
<% end %>
<% end %>
echo "check-resource -r $BUILD_PIPELINE_NAME/bosh-stemcell --from path:((stemcell-name-prefix))/bosh-stemcell-((stemcell-version))-((stemcell-main-name)).tgz" >> result-dir/flight-plan
echo "check-resource -r $BUILD_PIPELINE_NAME/bosh-stemcell --from path:((stemcell-name-prefix))((stemcell-main-name))/bosh-stemcell-((stemcell-version))-((stemcell-main-name)).tgz" >> result-dir/flight-plan
params:
BUILD_PIPELINE_NAME: <%= depls %>-generated
- task: fly-into-concourse
Expand Down
2 changes: 1 addition & 1 deletion lib/coa_env_bootstrapper/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def self.run(prereqs_path)
ceb = new(prereqs_path)
ceb.run
ensure
ceb.config_dir && FileUtils.remove_entry_secure(ceb.config_dir)
ceb&.config_dir && FileUtils.remove_entry_secure(ceb.config_dir)
end

def run
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env ruby -w


def credential_list(pipelines_path)
creds_list = []

Expand All @@ -12,9 +11,13 @@ def credential_list(pipelines_path)
creds_list << pipeline_content.scan(/\(\(([\w|-]*)\)\)/).flatten.uniq
end

creds_list.flatten.uniq
creds_list.flatten.uniq.sort
end

path = ARGV[0]
creds = credential_list(path)
puts creds.join("\n")
if path = ARGV[0]
creds = credential_list(path)
puts "Found credentials in alphabetical order:"
puts creds.join("\n")
else
puts "Usage:\n./scripts/extract_pipeline_credentials_list.rb </path/to/pipeline> OR\n./scripts/extract_pipeline_credentials_list.rb </path/to/pipelines/directory>"
end
3 changes: 0 additions & 3 deletions spec/helpers/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@ def fixtures_dir(path = '')
File.join(File.join(File.dirname(__FILE__), '..', path, 'fixtures'))
end

def new_tmpdir_path
File.join(File.join(File.dirname(__FILE__), '../..', 'tmp', SecureRandom.uuid))
end
6 changes: 2 additions & 4 deletions spec/lib/coa_env_bootstrapper/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,9 @@
end

describe '#write_source_profile' do
let(:tmpdirpath) { new_tmpdir_path }
let(:tmpdirpath) { Dir.mktmpdir }

before { FileUtils.mkdir tmpdirpath }

after { FileUtils.rmdir tmpdirpath }
after { FileUtils.remove_entry_secure tmpdirpath }

context 'when we pass a set of bosh credentials' do
let(:bosh_yml_path) { File.join(fixtures_dir('lib'), 'coa_env_bootstrapper', 'bosh_prereqs.yml') }
Expand Down
12 changes: 4 additions & 8 deletions spec/lib/coa_env_bootstrapper/bosh_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,10 @@
let(:cloud_config_fixtures_path) { File.join(fixtures_dir('lib'), 'coa_env_bootstrapper', 'cloud_config.yml') }
let(:ceb) { CoaEnvBootstrapper::Base.new([cloud_config_fixtures_path]) }
let(:bosh) { described_class.new(ceb) }
let(:tmpdirpath) { File.join("tmp", "upload_cloud_config") }
let(:tmpdirpath) { Dir.mktmpdir("upload_cloud_config") }
let(:cloud_config_yaml) { File.join(tmpdirpath, 'cloud-config.yml') }

before { FileUtils.mkdir tmpdirpath }

after { FileUtils.rm_r tmpdirpath }
after { FileUtils.remove_entry_secure tmpdirpath }

it "creates a cloud-config from the prereqs and uploads it" do
allow(bosh).to receive(:run_cmd)
Expand All @@ -87,12 +85,10 @@
let(:git_server_manifest_path) { File.join(fixtures_dir('lib'), 'coa_env_bootstrapper', 'git_server_manifest.yml') }
let(:ceb) { CoaEnvBootstrapper::Base.new([git_server_manifest_path]) }
let(:bosh) { described_class.new(ceb) }
let(:tmpdirpath) { new_tmpdir_path }
let(:tmpdirpath) { Dir.mktmpdir }
let(:manifest_path) { File.join(tmpdirpath, 'git-server.yml') }

before { FileUtils.mkdir tmpdirpath }

after { FileUtils.rm_r tmpdirpath }
after { FileUtils.remove_entry_secure tmpdirpath }

context "when the release is not already uploaded" do
let(:command_answer) { "" }
Expand Down
6 changes: 2 additions & 4 deletions spec/lib/coa_env_bootstrapper/concourse_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'coa_env_bootstrapper/concourse'

describe CoaEnvBootstrapper::Concourse do
let(:config_dir) { new_tmpdir_path }
let(:config_dir) { Dir.mktmpdir }
let(:fly_login_cmd) do
"fly login --target concourse-target \
--concourse-url http://example.com \
Expand All @@ -15,9 +15,7 @@
let(:pipeline_creds_path) { File.join(fixtures_dir('lib'), 'coa_env_bootstrapper', 'pipeline_creds.yml') }
let(:ceb) { CoaEnvBootstrapper::Base.new([concourse_creds_path]) }

before { FileUtils.mkdir config_dir }

after { FileUtils.rm_r config_dir }
after { FileUtils.remove_entry_secure config_dir }

describe '.new'

Expand Down
6 changes: 2 additions & 4 deletions spec/lib/coa_env_bootstrapper/git_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@
end

context "when there is a config dir" do
let(:tmpdir_path) { new_tmpdir_path }
let(:tmpdirpath) { Dir.mktmpdir }

before { FileUtils.mkdir tmpdir_path }

after { FileUtils.rm_r tmpdir_path }
after { FileUtils.remove_entry_secure tmpdirpath }

it "runs a set of git commands"
end
Expand Down
Empty file removed tmp/.gitkeep
Empty file.

0 comments on commit 4fe5f23

Please sign in to comment.