#!/bin/bash -l

set -o errexit
set -o nounset
set -o pipefail

tar xvf pack-release/pack-0.0.9-linux.tar.gz -o pack

cnbs=(nodejs npm yarn)
erbCmd=""

for i in "${cnbs[@]}"; do
  buildpack="${i}-cnb"
  pushd "$buildpack"
    path=$(./scripts/package.sh | grep -e "packaged into" | awk -F' ' '{print $4}')
  popd
  erbCmd+="packaged_${i}=$path "
done

erbCmd+="./buildpacks-ci/tasks/update-builder-image/builder-template.toml.erb > final.toml"
erb "$erbCmd"

./pack add-stack org.cloudfoundry.stacks.cflinuxfs3 -b cfbuildpacks/cflinuxfs3-cnb-experimental:build -r cfbuildpacks/cflinuxfs3-cnb-experimental:run
./buildpacks-ci/scripts/start-docker >/dev/null

img_name="cloudfoundry/cnb"
./pack create-builder "$img_name" --builder-config ./final.toml --stack org.cloudfoundry.stacks.cflinuxfs3
docker save "$img_name" -o ./docker-artifacts/builder.tgz

#!/bin/bash -l

set -o errexit
set -o nounset
set -o pipefail

tar xvf pack-release/pack-0.0.9-linux.tar.gz -o pack

cnbs=(nodejs npm yarn)
erbCmd="erb "

for i in "${cnbs[@]}"; do
  buildpack="${i}-cnb"
  pushd "$buildpack"
    path=$(./scripts/package.sh | grep -e "packaged into" | awk -F' ' '{print $4}')
  popd
  erbCmd+="packaged_${i}=$path "
done

erbCmd+="./buildpacks-ci/tasks/update-builder-image/builder-template.toml.erb > final.toml"
eval $erbCmd

./pack add-stack org.cloudfoundry.stacks.cflinuxfs3 -b cfbuildpacks/cflinuxfs3-cnb-experimental:build -r cfbuildpacks/cflinuxfs3-cnb-experimental:run
./buildpacks-ci/scripts/start-docker >/dev/null

img_name="cloudfoundry/cnb"
./pack create-builder "$img_name" --builder-config ./final.toml --stack org.cloudfoundry.stacks.cflinuxfs3
docker save "$img_name" -o ./docker-artifacts/builder.tgz

Fix bug in erb command
Fix bug in erb command

[#163709831]

Co-authored-by: Don Nguyen <1487e49252176236e14c0d247a7bbbd5e8c39a5d@pivotal.io>
