-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3173 from cloudfoundry/release-mtar
feat: release versioned mtar file
- Loading branch information
Showing
19 changed files
with
419 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,8 @@ | ||
#! /usr/bin/env bash | ||
|
||
# NOTE: you can run this locally for testing !!! | ||
# beware that it adds a commit you need to drop each time also you need to remove dev_releases from root. | ||
# | ||
# DEPLOYMENT=foo \ | ||
# GITHUB_TOKEN="ghp_..." \ | ||
# PREV_VERSION=12.2.1 \ | ||
# DEST="${PWD}/../../../build" \ | ||
# VERSION="12.3.0" \ | ||
# BUILD_OPTS="--force" \ | ||
# AUTOSCALER_CI_BOT_NAME="foo" \ | ||
# AUTOSCALER_CI_BOT_EMAIL="[email protected]" \ | ||
# AUTOSCALER_CI_BOT_SIGNING_KEY_PUBLIC="ssh-ed25519 AAAA... [email protected]" \ | ||
# AUTOSCALER_CI_BOT_SIGNING_KEY_PRIVATE="-----BEGIN OPENSSH PRIVATE KEY----- | ||
# b3Bl... | ||
# -----END OPENSSH PRIVATE KEY-----" \ | ||
# ./ci/autoscaler/scripts/release-autoscaler.sh | ||
# ./script/local_release_autoscaler.sh | ||
|
||
|
||
[ -n "${DEBUG}" ] && set -x | ||
|
@@ -56,6 +43,17 @@ function create_release() { | |
--tarball="${build_path}/artifacts/${release_file}" | ||
} | ||
|
||
function create_mtar() { | ||
set -e | ||
mkdir -p "${build_path}/artifacts" | ||
local version=$1 | ||
local build_path=$2 | ||
echo " - creating autorscaler mtar artifact" | ||
pushd "${autoscaler_dir}" > /dev/null | ||
make mta-release VERSION="${version}" DEST="${build_path}/artifacts/" | ||
popd > /dev/null | ||
} | ||
|
||
function create_tests() { | ||
set -e | ||
mkdir -p "${build_path}/artifacts" | ||
|
@@ -136,19 +134,24 @@ pushd "${autoscaler_dir}" > /dev/null | |
if [ "${PERFORM_BOSH_RELEASE}" == "true" ]; then | ||
RELEASE_TGZ="app-autoscaler-v${VERSION}.tgz" | ||
ACCEPTANCE_TEST_TGZ="app-autoscaler-acceptance-tests-v${VERSION}.tgz" | ||
AUTOSCALER_MTAR="app-autoscaler-release-v${VERSION}.mtar" | ||
create_release "${VERSION}" "${build_path}" "${RELEASE_TGZ}" | ||
create_tests "${VERSION}" "${build_path}" | ||
create_mtar "${VERSION}" "${build_path}" | ||
[ "${CI}" = "true" ] && commit_release | ||
|
||
sha256sum "${build_path}/artifacts/"* > "${build_path}/artifacts/files.sum.sha256" | ||
ACCEPTANCE_SHA256=$( grep "${ACCEPTANCE_TEST_TGZ}$" "${SUM_FILE}" | awk '{print $1}' ) | ||
RELEASE_SHA256=$( grep "${RELEASE_TGZ}$" "${SUM_FILE}" | awk '{print $1}') | ||
MTAR_SHA256=$( grep "${AUTOSCALER_MTAR}$" "${SUM_FILE}" | awk '{print $1}') | ||
else | ||
ACCEPTANCE_SHA256="dummy-sha" | ||
RELEASE_SHA256="dummy-sha" | ||
MTAR_SHA256="dummy-sha" | ||
fi | ||
export ACCEPTANCE_SHA256 | ||
export RELEASE_SHA256 | ||
export MTAR_SHA256 | ||
|
||
cat >> "${build_path}/changelog.md" <<EOF | ||
|
@@ -164,6 +167,10 @@ releases: | |
version: ${VERSION} | ||
url: https://storage.googleapis.com/app-autoscaler-releases/releases/app-autoscaler-acceptance-tests-v${VERSION}.tgz | ||
sha1: sha256:${ACCEPTANCE_SHA256} | ||
- name: app-autoscaler-mtar | ||
version: ${VERSION} | ||
url: https://storage.googleapis.com/app-autoscaler-releases/releases/app-autoscaler-release-v${VERSION}.mtar | ||
sha1: sha256:${MTAR_SHA256} | ||
\`\`\` | ||
EOF | ||
echo "---------- Changelog file ----------" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#! /usr/bin/env bash | ||
# | ||
# shellcheck disable=SC1091 | ||
# | ||
set -euo pipefail | ||
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
DEPLOYMENT=foo | ||
DEBUG=true | ||
DEST="${script_dir}/../build" | ||
BUILD_OPTS="--force" | ||
AUTOSCALER_CI_BOT_NAME="foo" | ||
AUTOSCALER_CI_BOT_EMAIL="[email protected]" | ||
PREV_VERSION="$(yq ".properties.\"autoscaler.apiserver.info.build\".default" jobs/golangapiserver/spec)" | ||
|
||
VERSION="$(cat "${script_dir}/../VERSION")-pre" | ||
|
||
export DEPLOYMENT | ||
export DEBUG | ||
export DEST | ||
export BUILD_OPTS | ||
export AUTOSCALER_CI_BOT_NAME | ||
export AUTOSCALER_CI_BOT_EMAIL | ||
export PREV_VERSION | ||
export VERSION | ||
|
||
# check for GITHUB_TOKEN | ||
if [ -z "${GITHUB_TOKEN}" ]; then | ||
echo "GITHUB_TOKEN is not set" | ||
exit 1 | ||
fi | ||
|
||
find_or_create_ssh_key() { | ||
if [ -f ~/.ssh/id_ed25519 ]; then | ||
echo "ssh key already exists" | ||
return | ||
fi | ||
|
||
ssh-keygen -t ed25519 -C "${AUTOSCALER_CI_BOT_EMAIL}" -f ~/.ssh/id_ed25519 -N "" | ||
} | ||
|
||
prerelease() { | ||
pushd "${script_dir}/.." > /dev/null | ||
make clean generate-fakes generate-openapi-generated-clients-and-servers go-mod-tidy go-mod-vendor db scheduler | ||
popd > /dev/null | ||
} | ||
|
||
delete_dev_releases() { | ||
rm -rf dev_releases | ||
} | ||
|
||
|
||
release_autoscaler() { | ||
AUTOSCALER_CI_BOT_SIGNING_KEY_PUBLIC=$(cat ~/.ssh/id_ed25519.pub) | ||
AUTOSCALER_CI_BOT_SIGNING_KEY_PRIVATE=$(cat ~/.ssh/id_ed25519) | ||
export AUTOSCALER_CI_BOT_SIGNING_KEY_PUBLIC | ||
export AUTOSCALER_CI_BOT_SIGNING_KEY_PRIVATE | ||
|
||
source "${script_dir}/../ci/autoscaler/scripts/release-autoscaler.sh" | ||
echo "beware that it adds a commit you need to drop each time also you need to remove dev_releases from root." | ||
} | ||
|
||
main() { | ||
find_or_create_ssh_key | ||
delete_dev_releases | ||
prerelease | ||
release_autoscaler | ||
} | ||
|
||
main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
build/ | ||
fakes/ | ||
mta_archives/ | ||
mta.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.