-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/v0.9' into v0.9-rename-github-workflows
- Loading branch information
Showing
2 changed files
with
90 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
# Description: build fleet binary and image with debug flags | ||
|
||
set -euxo pipefail | ||
|
||
export GOARCH="${GOARCH:-amd64}" | ||
export CGO_ENABLED=0 | ||
export GOOS=linux | ||
|
||
# fleet | ||
go build -gcflags='all=-N -l' -o bin/fleetcontroller-linux-"$GOARCH" ./cmd/fleetcontroller | ||
|
||
# fleet agent | ||
go build -gcflags='all=-N -l' -o "bin/fleet-linux-$GOARCH" ./cmd/fleetcli | ||
go build -gcflags='all=-N -l' -o "bin/fleetagent-linux-$GOARCH" ./cmd/fleetagent |
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,75 @@ | ||
#!/bin/bash | ||
# | ||
# Submit new Fleet version against a test fork of rancher/charts | ||
|
||
set -ue | ||
|
||
PREV_FLEET_VERSION="$1" # e.g. 0.5.2-rc.3 | ||
NEW_FLEET_VERSION="$2" | ||
PREV_CHART_VERSION="$3" # e.g. 101.2.0 | ||
NEW_CHART_VERSION="$4" | ||
UUID="$5" # for ttl.sh image resolution | ||
|
||
if [ -z "${GITHUB_WORKSPACE:-}" ]; then | ||
CHARTS_DIR="$(dirname -- "$0")/../../../charts" | ||
else | ||
CHARTS_DIR="${GITHUB_WORKSPACE}/charts" | ||
fi | ||
|
||
pushd "${CHARTS_DIR}" > /dev/null | ||
|
||
if [ ! -e ~/.gitconfig ]; then | ||
git config --global user.name "fleet-bot" | ||
git config --global user.email [email protected] | ||
fi | ||
|
||
if [ ! -f bin/charts-build-scripts ]; then | ||
make pull-scripts | ||
fi | ||
|
||
if grep -q "version: ${PREV_CHART_VERSION}" ./packages/fleet/fleet/package.yaml && grep -q "${PREV_FLEET_VERSION}" ./packages/fleet/fleet/package.yaml; then | ||
|
||
find ./packages/fleet/ -type f -exec sed -i -e "s/${PREV_FLEET_VERSION}/${NEW_FLEET_VERSION}/g" {} \; | ||
find ./packages/fleet/ -type f -exec sed -i -e "s/version: ${PREV_CHART_VERSION}/version: ${NEW_CHART_VERSION}/g" {} \; | ||
else | ||
echo "Previous Fleet version references do not exist in ./packages/fleet/ so replacing it with the new version is not possible. Exiting..." | ||
exit 1 | ||
fi | ||
|
||
for i in fleet fleet-crd fleet-agent; do | ||
yq --inplace "del( .${i}.[] | select(. == \"${PREV_CHART_VERSION}+up${PREV_FLEET_VERSION}\") )" release.yaml | ||
yq --inplace ".${i} += [\"${NEW_CHART_VERSION}+up${NEW_FLEET_VERSION}\"]" release.yaml | ||
done | ||
|
||
git add packages/fleet release.yaml | ||
git commit -m "Updating to Fleet v${NEW_FLEET_VERSION}" | ||
|
||
NEW_FULL_VERSION=${NEW_CHART_VERSION}+up${NEW_FLEET_VERSION} | ||
|
||
for suffix in '' '-agent' '-crd'; do | ||
chart_dir=charts/fleet$suffix/${NEW_FULL_VERSION} | ||
mkdir -p $chart_dir | ||
cp -r ../fleet/charts/fleet$suffix/* $chart_dir | ||
cd $chart_dir | ||
|
||
# Replace rancher/fleet and rancher/fleet-agent image names, but not eg. rancher/kubectl | ||
sed -i \ | ||
-e "s@repository: rancher/\(fleet.*\).*@repository: ttl.sh/rancher-\\1-$UUID@" \ | ||
-e "s/tag: dev/tag: 1h/" \ | ||
values.yaml | ||
|
||
cd - | ||
|
||
helm package \ | ||
--version="$NEW_FULL_VERSION" \ | ||
--app-version="$NEW_FLEET_VERSION" \ | ||
-d ./assets/fleet$suffix \ | ||
$chart_dir | ||
done | ||
|
||
make index # Merge new chart entries into `index.yaml` | ||
|
||
git add assets/fleet* charts/fleet* index.yaml | ||
git commit -m "Autogenerated changes for Fleet v${NEW_FLEET_VERSION}" | ||
|
||
popd > /dev/null |