Skip to content

Commit

Permalink
ci: allow release preparation magic to also be used for real releases
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelColledge committed Jul 27, 2023
1 parent f9275ce commit 4df8920
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 28 deletions.
6 changes: 3 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ variables:
RELEASE_BRANCH: drbd-9.1
DRBD_VERSION_BASE: 9.1.0
DRBD9_TESTS_REF: master
BUILD_HELPERS_VERSION: 4847343a16f5f9500f7c53ed7aa681962706d8ba
BUILD_HELPERS_VERSION: cad23b57db14b7676808fa645c4561bc66c3e204
# we have to change the way GitLab CI clones the repository.
# by default, it is shallow, which gives us a wrong commit count when
# we do `git rev-list --count origin/master` below.
Expand All @@ -17,7 +17,7 @@ stages:

.setup-lbbuild:
before_script:
- . gitlab-utils.sh && . .gitlab/gitlab-utils.sh
- . gitlab-utils.sh
- ci_prepare_tools
- ci_fetch_rq
- ci_fetch_lbbuildctl
Expand Down Expand Up @@ -48,7 +48,7 @@ stages:
set -x
drbd_dummy_release "$version" "$release" "$rel_version"
./.gitlab/drbd-prepare-release.sh "$version" "$release" "$rel_version"
make FORCE=1 PRESERVE_DEBIAN=1 REL_VERSION="$rel_version" tarball
curl -isSf -u $LINBIT_REGISTRY_USER:$LINBIT_REGISTRY_PASSWORD \
--upload-file drbd-*.tar.gz \
Expand Down
25 changes: 25 additions & 0 deletions .gitlab/changelog.awk
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Can be used to add a release to the ChangeLog
#
# Example:
# awk -f changelog.awk -v REL_VERSION=9.9.9 ChangeLog > ChangeLog.ci

BEGIN {
if (REL_VERSION == "")
die("REL_VERSION is not set")
}

!added && /api:/ {
print REL_VERSION " " $2
print "--------"
print ""
print " * bug fixes"
print ""
added = 1
}

{print}

function die(msg) {
print(msg) > "/dev/stderr"
exit 1
}
30 changes: 30 additions & 0 deletions .gitlab/drbd-prepare-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Replace the drbd version number in all necessary places
#
# Example:
# version=9.1.15+ptf.16.g0a58e61fcd09
# PATH=~/work/projects/build-helpers/build-helpers:"$PATH" ./.gitlab/drbd-prepare-release.sh "$version" 1 "$version"
#
# Example of a real release:
# version=9.1.16
# PATH=~/work/projects/build-helpers/build-helpers:"$PATH" DRBD_SOURCE_ONLINE=yes ./.gitlab/drbd-prepare-release.sh "$version" 1 "$version"

version="$1"
release="$2"
rel_version="$3"

DIR="$(dirname "$(readlink -f "$0")")"

dummy-release.sh drbd "$version" "$release" drbd-kernel.spec --source-online ${DRBD_SOURCE_ONLINE:-no}

sed -re "s/(#define REL_VERSION) .*/\1 \"$rel_version\"/g" drbd/linux/drbd_config.h > drbd/linux/drbd_config.h.tmp
mv drbd/linux/drbd_config.h{.tmp,}

for i in 7 8 9; do
sed -re "s/(ENV DRBD_VERSION) .*/\1 $rel_version/g" docker/Dockerfile.rhel${i} > docker/Dockerfile.rhel${i}.tmp
mv docker/Dockerfile.rhel${i}{.tmp,}
done

awk -f "$DIR/changelog.awk" -v REL_VERSION="$rel_version" ChangeLog > ChangeLog.tmp
mv ChangeLog{.tmp,}
25 changes: 0 additions & 25 deletions .gitlab/gitlab-utils.sh

This file was deleted.

0 comments on commit 4df8920

Please sign in to comment.