forked from cloudfoundry/cloud_controller_ng
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stack association to buildpack model
[#153256959] [#154527662] - Add "stack" to buildpack model, which will be nil by default - Buildpacks are now unique over name AND stack - Sets buildpack stack from manifest.yml in buildpack zip on creation - Validate buildpack model stack against stack in buildpack zip manifest.yml - Validate stack exists upon buildpack bits upload - Include stack name in serialized buildpack filename - Only provide buildpacks for the relevant stack (or those with a nil stack) to the staging container - Handle buildpack stacks appropriately in the buildpack installer - Use fork of rubyzip/rubyzip to work around rubyzip/rubyzip#236 NOTE: The API checkshum has changed due to adding stack as an input Signed-off-by: Dave Goddard <dave@goddard.id.au> Signed-off-by: Victoria Henry <vhenry@pivotal.io> Signed-off-by: Jackson Feeny <jacksonfeeny@gmail.com> Signed-off-by: Tyler Phelan <tphelan@pivotal.io> Signed-off-by: Andrew Meyer <ameyer@pivotal.io> Signed-off-by: Leah Hanson <lhanson@pivotal.io> Signed-off-by: Eric Promislow <eric.promislow@suse.com> Signed-off-by: Lisa Cho <lcho@pivotal.io>
- Loading branch information
Showing
34 changed files
with
780 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
db/migrations/20180102183100_add_stack_to_buildpack_table.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Sequel.migration do | ||
up do | ||
alter_table(:buildpacks) do | ||
add_column :stack, String, size: 255, null: true | ||
drop_index :name, unique: true | ||
add_index [:name, :stack], unique: true, name: :unique_name_and_stack | ||
end | ||
end | ||
|
||
down do | ||
alter_table(:buildpacks) do | ||
drop_index [:name, :stack], unique: true, name: :unique_name_and_stack | ||
drop_column :stack | ||
add_index :name, unique: true, name: :buildpacks_name_index | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module VCAP::CloudController | ||
module Buildpacks | ||
class StackNameExtractor | ||
ONE_MEGABYTE = 1024 * 1024 | ||
|
||
def self.extract_from_file(bits_file_path) | ||
bits_file_path = bits_file_path.path if bits_file_path.respond_to?(:path) | ||
Zip::File.open(bits_file_path) do |zip_file| | ||
zip_file.each do |entry| | ||
if entry.name == 'manifest.yml' | ||
raise CloudController::Errors::BuildpackError.new('buildpack manifest is too large') if entry.size > ONE_MEGABYTE | ||
return YAML.safe_load(entry.get_input_stream.read).dig('stack') | ||
end | ||
end | ||
end | ||
nil | ||
rescue Psych::Exception | ||
raise CloudController::Errors::BuildpackError.new('buildpack manifest is not valid') | ||
rescue Zip::Error | ||
raise CloudController::Errors::BuildpackError.new('buildpack zipfile is not valid') | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module CloudController | ||
module Errors | ||
class BuildpackError < StandardError; end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
default: "default-stack-name" | ||
|
||
stacks: | ||
- name: "cflinuxfs2" | ||
description: "cflinuxfs2" | ||
- name: "default-stack-name" | ||
description: "default-stack-description" | ||
- name: "cider" | ||
description: "cider-description" | ||
- name: "windows2012R2" | ||
description: "windows2012R2-description" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
default: "default-stack-name" | ||
|
||
stacks: | ||
- name: "cflinuxfs2" | ||
description: "cflinuxfs2" | ||
- name: "default-stack-name" | ||
description: "default-stack-description" | ||
- name: "cider" | ||
description: "cider-description" | ||
- name: "windows2016" | ||
description: "windows2016-description" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
default: "default-stack-name" | ||
|
||
stacks: | ||
- name: "cflinuxfs2" | ||
description: "cflinuxfs2" | ||
- name: "default-stack-name" | ||
description: "default-stack-description" | ||
- name: "cider" | ||
description: "cider-description" | ||
- name: "windows2012R2" | ||
description: "windows2012R2-description" | ||
- name: "windows2016" | ||
description: "windows2016-description" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.