Skip to content

Commit

Permalink
hack: add bundle tarball generation
Browse files Browse the repository at this point in the history
given that we don't yet have a public image registry that we can push
the bundle to, by generating a bundle tarball that goes to `/release` we
can not only preserve the ability for one to still install cartographer,
but also incentivize people to always relocate[^1]

[^1]: sure, once OSS, it's certainly useful to also have the 0-attrition
`kubectl apply -f <release_url>`

Signed-off-by: Ciro S. Costa <ciroscosta@vmware.com>
  • Loading branch information
Ciro S. Costa committed Sep 22, 2021
1 parent dc80591 commit 0db5853
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
3 changes: 2 additions & 1 deletion hack/release-notes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ checksums() {
local assets_directory=$1

pushd $assets_directory &>/dev/null
find . -name "*.yaml" -type f | xargs sha256sum
find . -name "*" ! -name $(basename $DESTINATION) -type f |
xargs sha256sum
popd &>/dev/null
}

Expand Down
20 changes: 16 additions & 4 deletions hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,16 @@ create_imgpkg_bundle() {
$SCRATCH/bundle/config/cartographer.yaml

kbld -f $SCRATCH/bundle/config/cartographer.yaml \
--imgpkg-lock-output $SCRATCH/bundle/.imgpkg/images.yml >/dev/null
--imgpkg-lock-output $SCRATCH/bundle/.imgpkg/images.yml \
>/dev/null

imgpkg push -f $SCRATCH/bundle \
--bundle $BUNDLE \
--lock-output $SCRATCH/bundle.lock.yaml

imgpkg copy \
--bundle $(image_from_lockfile $SCRATCH/bundle.lock.yaml) \
--to-tar $SCRATCH/bundle.tar
}

# generates the final release directory containing the files that are meant to
Expand All @@ -117,24 +122,31 @@ create_imgpkg_bundle() {
# │   └── package-metadata.yaml
# │   └── package.yaml
#
# ├── bundle.tar.gz
#
# └── release.yaml
#
generate_release() {
local bundle_image=$(awk -F"image: " '{if ($2) print $2;}' $SCRATCH/bundle.lock.yaml)

rm -rf ./release
mkdir -p ./release/package

cp $SCRATCH/bundle.tar ./release
cp $SCRATCH/bundle/config/cartographer.yaml ./release
for package_fpath in ./packaging/package*.yaml; do
ytt --ignore-unknown-comments \
-f ./packaging/values.yaml \
-f $package_fpath \
--data-value image=$bundle_image \
--data-value image=$(image_from_lockfile $SCRATCH/bundle.lock.yaml) \
--data-value releasedAt=$RELEASE_DATE \
--data-value version=$RELEASE_VERSION > \
./release/package/$(basename $package_fpath)
done
}

image_from_lockfile() {
local lockfile=$1

awk -F"image: " '{if ($2) print $2;}' $lockfile
}

main "$@"

0 comments on commit 0db5853

Please sign in to comment.