Skip to content

Commit

Permalink
Merge branch 'release/v0.9' into v0.9-rename-github-workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
olblak authored Jul 12, 2024
2 parents 1c2898e + 49994b3 commit aafbd42
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/scripts/build-fleet-binaries.sh
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
75 changes: 75 additions & 0 deletions .github/scripts/release-against-test-charts.sh
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

0 comments on commit aafbd42

Please sign in to comment.