Skip to content

Commit

Permalink
Automatically include meta-buildpack as dependency for decorators
Browse files Browse the repository at this point in the history
Fixes #143
  • Loading branch information
guidowb committed Oct 28, 2016
1 parent 0ae5072 commit ae5d448
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 19 deletions.
5 changes: 4 additions & 1 deletion sample/src/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ pip install --no-binary :all: --download vendor -r requirements.txt
zip -r "${RESOURCES_DIR}/app.zip" *

cd "${BUILDPACK_DIR}"
zip -r "${RESOURCES_DIR}/buildpack.zip" *
zip -r "${RESOURCES_DIR}/buildpack.zip" bin/detect bin/compile bin/release

cd "${BUILDPACK_DIR}"
zip -r "${RESOURCES_DIR}/decorator.zip" bin/detect bin/compile bin/decorate
20 changes: 20 additions & 0 deletions sample/src/buildpack/bin/decorate
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
# bin/decorate <build-dir>

# tile-generator
#
# Copyright (c) 2015-Present Pivotal Software, Inc. All Rights Reserved.
#
# 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.

exit 1
4 changes: 4 additions & 0 deletions sample/tile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ packages:
buildpack_order: 99 # 99 (or higher) means go to the end of the list
path: resources/buildpack.zip

- name: noop-decorator # A decorator buildpack
type: decorator
path: resources/decorator.zip

- name: app3
type: docker-app
image: guidowb/sample-cf-app # Start command must be specified in the Dockerfile (CMD)
Expand Down
38 changes: 20 additions & 18 deletions tile_generator/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def normalize_jobs(self):
for job in release.get('jobs', []):
job['type'] = job.get('type', job['name'])
job['template'] = job.get('template', job['type'])

def release_for_package(self, package):
release_name = package['name'] if package.get('is_bosh_release', False) else self['name']
release = self.release_by_name(release_name)
Expand Down Expand Up @@ -233,23 +233,25 @@ def add_dependencies(self):
'name': 'docker-boshrelease',
'path': 'https://bosh.io/d/github.com/cf-platform-eng/docker-boshrelease' + version_param,
}]
# if requires_meta_buildpack:
# self['releases'] += [{
# 'name': 'meta-buildpack',
# 'path': 'github://cf-platform-eng/meta-buildpack/meta-buildpack.tgz',
# 'jobs': [
# {
# 'name': 'deploy-all',
# 'type': 'deploy-all',
# 'is_errand': True
# },
# {
# 'name': 'delete-all',
# 'type': 'delete-all',
# 'is_errand': True
# }
# ]
# }]
if requires_meta_buildpack:
self['releases'] += [{
'name': 'meta-buildpack',
'path': 'github://cf-platform-eng/meta-buildpack/meta-buildpack.tgz',
'jobs': [
{
'name': 'deploy-meta-buildpack',
'type': 'deploy-all',
'lifecycle': 'errand',
'post_deploy': True
},
{
'name': 'delete-meta-buildpack',
'type': 'delete-all',
'lifecycle': 'errand',
'pre_delete': True
}
]
}]

def save_history(self):
with open(HISTORY_FILE, 'wb') as history_file:
Expand Down

0 comments on commit ae5d448

Please sign in to comment.