Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

Commit

Permalink
Upgrade the java and tc server buildpacks directly
Browse files Browse the repository at this point in the history
- The java and tc server buildpacks work with both cflinuxfs2 and cflinuxfs3. We have to upgrade them directly instead of using stage and promote phases because there is no way to stage them with stack association. We assume that older versions of these buildpacks already exist on the foundation and that they are stack associated when we perform an upgrade.

Co-authored-by: Daniel Thornton <[email protected]>
  • Loading branch information
Danny Joyce and dwillist committed Oct 31, 2018
1 parent 0dac6cc commit 2e185ad
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 43 deletions.
26 changes: 26 additions & 0 deletions tasks/upgrade-buildpack/task.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -eu

# Copyright 2017-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.

cf api $CF_API_URI --skip-ssl-validation
cf auth $CF_USERNAME $CF_PASSWORD

for STACK_NAME in $STACKS;
do
echo Upgrading ${TARGET_BUILDPACK_NAME} ${STACK_NAME}...
cf update-buildpack $TARGET_BUILDPACK_NAME -s $STACK_NAME -p buildpack/*.zip --enable
done
36 changes: 36 additions & 0 deletions tasks/upgrade-buildpack/task.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2017-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.

---
platform: linux

image_resource:
type: docker-image
source:
repository: pcfnorm/rootfs


inputs:
- name: buildpack
- name: pcf-pipelines

params:
CF_API_URI:
CF_USERNAME:
CF_PASSWORD:
TARGET_BUILDPACK_NAME:
STACKS:

run:
path: pcf-pipelines/tasks/upgrade-buildpack/task.sh
51 changes: 8 additions & 43 deletions upgrade-buildpacks/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,40 +240,23 @@ jobs:
TARGET_BUILDPACK_NAME: go_buildpack
STACKS: "cflinuxfs2 cflinuxfs3"

- name: stage-java-buildpack
- name: upgrade-java-buildpack
serial_groups: [cc-api]
plan:
- aggregate:
- get: pcf-pipelines
- get: buildpack
passed: [regulator]
resource: java-buildpack
passed: [regulator]
trigger: true
params:
globs:
- "*offline*"

- task: stage
file: pcf-pipelines/tasks/stage-buildpack/task.yml
params:
<<: *cf_api_params
BUILDPACK_NAME: java_buildpack_offline_latest
STACKS: "cflinuxfs2 cflinuxfs3"

- name: promote-java-buildpack
serial_groups: [cc-api]
plan:
- aggregate:
- get: java-buildpack
passed: [stage-java-buildpack]
trigger: true
params: {globs: []}
- get: pcf-pipelines
- task: promote
file: pcf-pipelines/tasks/promote-buildpack/task.yml
- task: upgrade
file: pcf-pipelines/tasks/upgrade-buildpack/task.yml
params:
<<: *cf_api_params
SOURCE_BUILDPACK_NAME: java_buildpack_offline_latest
TARGET_BUILDPACK_NAME: java_buildpack_offline
STACKS: "cflinuxfs2 cflinuxfs3"

Expand Down Expand Up @@ -447,40 +430,22 @@ jobs:
TARGET_BUILDPACK_NAME: staticfile_buildpack
STACKS: "cflinuxfs2 cflinuxfs3"

- name: stage-tcserver-buildpack
- name: upgrade-tcserver-buildpack
serial_groups: [cc-api]
plan:
- aggregate:
- get: pcf-pipelines
- get: buildpack
passed: [regulator]
resource: tc-buildpack
passed: [regulator]
trigger: true
params:
globs:
- "*offline*"

- task: stage
file: pcf-pipelines/tasks/stage-buildpack/task.yml
params:
<<: *cf_api_params
BUILDPACK_NAME: tc_buildpack_latest
STACKS: "cflinuxfs2 cflinuxfs3"

- name: promote-tcserver-buildpack
serial_groups: [cc-api]
plan:
- aggregate:
- get: tc-buildpack
passed: [stage-tcserver-buildpack]
trigger: true
params: {globs: []}
- get: pcf-pipelines

- task: promote
file: pcf-pipelines/tasks/promote-buildpack/task.yml
- task: upgrade
file: pcf-pipelines/tasks/upgrade-buildpack/task.yml
params:
<<: *cf_api_params
SOURCE_BUILDPACK_NAME: tc_buildpack_latest
TARGET_BUILDPACK_NAME: tc_buildpack
STACKS: "cflinuxfs2 cflinuxfs3"

0 comments on commit 2e185ad

Please sign in to comment.