From 2e185adf2634d08ca54542540ea7917dd18bf579 Mon Sep 17 00:00:00 2001 From: Danny Joyce Date: Wed, 31 Oct 2018 11:07:32 -0400 Subject: [PATCH] Upgrade the java and tc server buildpacks directly - 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 --- tasks/upgrade-buildpack/task.sh | 26 ++++++++++++++++ tasks/upgrade-buildpack/task.yml | 36 ++++++++++++++++++++++ upgrade-buildpacks/pipeline.yml | 51 +++++--------------------------- 3 files changed, 70 insertions(+), 43 deletions(-) create mode 100755 tasks/upgrade-buildpack/task.sh create mode 100644 tasks/upgrade-buildpack/task.yml diff --git a/tasks/upgrade-buildpack/task.sh b/tasks/upgrade-buildpack/task.sh new file mode 100755 index 000000000..5c729f611 --- /dev/null +++ b/tasks/upgrade-buildpack/task.sh @@ -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 \ No newline at end of file diff --git a/tasks/upgrade-buildpack/task.yml b/tasks/upgrade-buildpack/task.yml new file mode 100644 index 000000000..1eba6c059 --- /dev/null +++ b/tasks/upgrade-buildpack/task.yml @@ -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 diff --git a/upgrade-buildpacks/pipeline.yml b/upgrade-buildpacks/pipeline.yml index 675b88046..a8152efd3 100644 --- a/upgrade-buildpacks/pipeline.yml +++ b/upgrade-buildpacks/pipeline.yml @@ -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" @@ -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"