Skip to content

Commit 11800f1

Browse files
committed
Simplify version.config
Since we adjusted our release procedure recently we do no longer need to keep track of update and downgrade version separately and can instead combine them as previous_version, simplifying the version.config file. For now we have to keep downgrade_to_version in version.config until after we released 2.20
1 parent 3ce0359 commit 11800f1

15 files changed

+38
-41
lines changed

.github/workflows/apt-arm-packages.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ jobs:
7070
id: versions
7171
run: |
7272
# read expected version from version.config
73-
# version will only be a proper version in a release branch so we use update_from_version
73+
# version will only be a proper version in a release branch so we use previous_version
7474
# as fallback for main
7575
if grep '^version = [0-9.]\+$' version.config; then
7676
version=$(grep '^version = ' version.config | sed -e 's!^version = !!')
7777
else
78-
version=$(grep '^update_from_version = ' version.config | sed -e 's!^update_from_version = !!')
78+
version=$(grep '^previous_version = ' version.config | sed -e 's!^previous_version = !!')
7979
fi
8080
echo "version=${version}" >>$GITHUB_OUTPUT
8181

.github/workflows/apt-packages.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ jobs:
6464
id: versions
6565
run: |
6666
# read expected version from version.config
67-
# version will only be a proper version in a release branch so we use update_from_version
67+
# version will only be a proper version in a release branch so we use previous_version
6868
# as fallback for main
6969
if grep '^version = [0-9.]\+$' version.config; then
7070
version=$(grep '^version = ' version.config | sed -e 's!^version = !!')
7171
else
72-
version=$(grep '^update_from_version = ' version.config | sed -e 's!^update_from_version = !!')
72+
version=$(grep '^previous_version = ' version.config | sed -e 's!^previous_version = !!')
7373
fi
7474
echo "version=${version}" >>$GITHUB_OUTPUT
7575

.github/workflows/docker-images.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ jobs:
5353
id: versions
5454
run: |
5555
# read expected version from version.config
56-
# version will only be a proper version in a release branch so we use update_from_version
56+
# version will only be a proper version in a release branch so we use previous_version
5757
# as fallback for main
5858
if grep '^version = [0-9.]\+$' version.config; then
5959
version=$(grep '^version = ' version.config | sed -e 's!^version = !!')
6060
else
61-
version=$(grep '^update_from_version = ' version.config | sed -e 's!^update_from_version = !!')
61+
version=$(grep '^previous_version = ' version.config | sed -e 's!^previous_version = !!')
6262
fi
6363
echo "version=${version}" >>$GITHUB_OUTPUT
6464

.github/workflows/homebrew.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
if grep '^version = [0-9.]\+$' version.config; then
5353
version=$(grep '^version = ' version.config | sed -e 's!^version = !!')
5454
else
55-
version=$(grep '^update_from_version = ' version.config | sed -e 's!^update_from_version = !!')
55+
version=$(grep '^previous_version = ' version.config | sed -e 's!^previous_version = !!')
5656
fi
5757
installed_version=$(psql -X -t \
5858
-c "SELECT extversion FROM pg_extension WHERE extname='timescaledb';" \

.github/workflows/pgspot.yaml

+8-13
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,10 @@ jobs:
5353
5454
- name: Build timescaledb sqlfiles
5555
run: |
56-
downgrade_to=$(grep '^downgrade_to_version = ' version.config | sed -e 's!^[^=]\+ = !!')
56+
previous_version=$(grep '^previous_version = ' version.config | sed -e 's!^[^=]\+ = !!')
5757
git fetch --tags
5858
./bootstrap -DGENERATE_DOWNGRADE_SCRIPT=ON
59-
# We use downgrade_to_version instead of update_from_version because
60-
# when the release PR for a new version has been merged to main but
61-
# the version is not tagged yet update_from_version will not exist yet.
62-
# In all other situations update_from_version and downgrade_to_version
63-
# should point to the same version.
64-
git checkout ${downgrade_to}
59+
git checkout ${previous_version}
6560
make -C build sqlfile sqlupdatescripts
6661
git checkout ${GITHUB_SHA}
6762
make -C build sqlfile sqlupdatescripts
@@ -70,19 +65,19 @@ jobs:
7065
- name: Run pgspot
7166
run: |
7267
version=$(grep '^version = ' version.config | sed -e 's!^[^=]\+ = !!')
73-
downgrade_to=$(grep '^downgrade_to_version = ' version.config | sed -e 's!^[^=]\+ = !!')
68+
previous_version=$(grep '^previous_version = ' version.config | sed -e 's!^[^=]\+ = !!')
7469
7570
# Show files used
76-
ls -la build/sql/timescaledb--${version}.sql build/sql/timescaledb--${downgrade_to}--${version}.sql \
77-
build/sql/timescaledb--${version}--${downgrade_to}.sql
71+
ls -la build/sql/timescaledb--${version}.sql build/sql/timescaledb--${previous_version}--${version}.sql \
72+
build/sql/timescaledb--${version}--${previous_version}.sql
7873
7974
# The next pgspot execution tests the installation script by itself
8075
pgspot ${{ env.PGSPOT_OPTS }} build/sql/timescaledb--${version}.sql
8176
# The next pgspot execution tests the update script to the latest version
8277
# we prepend the installation script here so pgspot can correctly keep track of created objects
83-
pgspot ${{ env.PGSPOT_OPTS }} -a build/sql/timescaledb--${downgrade_to}.sql \
84-
build/sql/timescaledb--${downgrade_to}--${version}.sql
78+
pgspot ${{ env.PGSPOT_OPTS }} -a build/sql/timescaledb--${previous_version}.sql \
79+
build/sql/timescaledb--${previous_version}--${version}.sql
8580
# The next pgspot execution tests the downgrade script to the previous version
8681
# we prepend the installation script here so pgspot can correctly keep track of created objects
8782
pgspot ${{ env.PGSPOT_OPTS }} -a build/sql/timescaledb--${version}.sql \
88-
build/sql/timescaledb--${version}--${downgrade_to}.sql
83+
build/sql/timescaledb--${version}--${previous_version}.sql

.github/workflows/rpm-packages.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ jobs:
7171
id: versions
7272
run: |
7373
# read expected version from version.config
74-
# version will only be a proper version in a release branch so we use update_from_version
74+
# version will only be a proper version in a release branch so we use previous_version
7575
# as fallback for main
7676
if grep '^version = [0-9.]\+$' version.config; then
7777
version=$(grep '^version = ' version.config | sed -e 's!^version = !!')
7878
else
79-
version=$(grep '^update_from_version = ' version.config | sed -e 's!^update_from_version = !!')
79+
version=$(grep '^previous_version = ' version.config | sed -e 's!^previous_version = !!')
8080
fi
8181
echo "version=${version}" >>$GITHUB_OUTPUT
8282

.github/workflows/windows-packages.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ jobs:
5757
- name: Get version
5858
id: version
5959
run: |
60-
# version will only be a proper version in a release branch so we use update_from_version
60+
# version will only be a proper version in a release branch so we use previous_version
6161
# as fallback for main
6262
if (grep '^version = [0-9.]\+$' version.config)
6363
{
6464
$version=sed -n 's!^version = !!p' version.config
6565
} else {
66-
$version=sed -n 's!^update_from_version = !!p' version.config
66+
$version=sed -n 's!^previous_version = !!p' version.config
6767
}
6868
cat version.config
6969
echo "Determined version: "

CMakeLists.txt

+8-6
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,20 @@ if(VERSION_CONFIG
7676
endif()
7777
endif()
7878

79+
# fallback for < 2.20 downgrade can be removed after we release 2.20
7980
if(VERSION_CONFIG
8081
MATCHES
81-
".*update_from_version[\t ]*=[\t ]*([0-9]+\\.[0-9]+\\.[0-9]+(-[a-z]+[0-9]*)?).*"
82+
".*downgrade_to_version[\t ]*=[\t ]*([0-9]+\\.[0-9]+\\.[0-9]+(-[a-z]+[0-9]*)?).*"
8283
)
8384
set(UPDATE_FROM_VERSION ${CMAKE_MATCH_1})
85+
set(DOWNGRADE_TO_VERSION ${CMAKE_MATCH_1})
86+
set(PREVIOUS_VERSION ${CMAKE_MATCH_1})
8487
endif()
8588

86-
if(VERSION_CONFIG
87-
MATCHES
88-
".*downgrade_to_version[\t ]*=[\t ]*([0-9]+\\.[0-9]+\\.[0-9]+(-[a-z]+[0-9]*)?).*"
89+
if(VERSION_CONFIG MATCHES
90+
".*previous_version[\t ]*=[\t ]*([0-9]+\\.[0-9]+\\.[0-9]+(-[a-z]+[0-9]*)?).*"
8991
)
90-
set(DOWNGRADE_TO_VERSION ${CMAKE_MATCH_1})
92+
set(PREVIOUS_VERSION ${CMAKE_MATCH_1})
9193
endif()
9294

9395
# a hack to avoid change of SQL extschema variable
@@ -119,7 +121,7 @@ endif()
119121

120122
message(
121123
STATUS
122-
"TimescaleDB version ${PROJECT_VERSION_MOD}. Can be updated from version ${UPDATE_FROM_VERSION}"
124+
"TimescaleDB version ${PROJECT_VERSION_MOD}. Can be updated from version ${PREVIOUS_VERSION}"
123125
)
124126
message(STATUS "Build type is ${CMAKE_BUILD_TYPE}")
125127

scripts/changelog/generate.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ get_version_config_var() {
1818
}
1919

2020
RELEASE_NEXT=$(get_version_config_var '^version')
21-
RELEASE_PREVIOUS=$(get_version_config_var '^update_from_version')
21+
RELEASE_PREVIOUS=$(get_version_config_var '^previous_version')
2222

2323
echo "Building CHANGELOG"
2424
{

scripts/test_downgrade.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fi
1616
BUILD_DIR="build_update_pg${PG_MAJOR_VERSION}"
1717

1818
CURRENT_VERSION=$(grep '^version ' version.config | awk '{ print $3 }')
19-
PREV_VERSION=$(grep '^downgrade_to_version ' version.config | awk '{ print $3 }')
19+
PREV_VERSION=$(grep '^previous_version ' version.config | awk '{ print $3 }')
2020

2121
if [ ! -d "${BUILD_DIR}" ]; then
2222
echo "Initializing build directory"

scripts/test_update_from_version.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
set -e
1010
set -u
1111

12-
FROM_VERSION=${FROM_VERSION:-$(grep '^downgrade_to_version ' version.config | awk '{ print $3 }')}
12+
FROM_VERSION=${FROM_VERSION:-$(grep '^previous_version ' version.config | awk '{ print $3 }')}
1313
TO_VERSION=${TO_VERSION:-$(grep '^version ' version.config | awk '{ print $3 }')}
1414

1515
TEST_REPAIR=${TEST_REPAIR:-false}

scripts/test_updates.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ VERSIONS=""
1818
FAILED_VERSIONS=""
1919

2020
ALL_VERSIONS=$(git tag --sort=taggerdate | grep -P '^[2]\.[0-9]+\.[0-9]+$')
21-
MAX_VERSION=$(grep '^downgrade_to_version ' version.config | awk '{ print $3 }')
21+
MAX_VERSION=$(grep '^previous_version ' version.config | awk '{ print $3 }')
2222

2323
# major version is always 2 atm
2424
max_minor_version=$(echo "${MAX_VERSION}" | awk -F. '{print $2}')

sql/CMakeLists.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ else()
105105
SOURCE_VERSION
106106
${PROJECT_VERSION_MOD}
107107
TARGET_VERSION
108-
${DOWNGRADE_TO_VERSION}
108+
${PREVIOUS_VERSION}
109109
INPUT_DIRECTORY
110110
${CMAKE_CURRENT_SOURCE_DIR}/updates
111111
FILES
@@ -235,12 +235,12 @@ set(MOD_FILE_REGEX
235235

236236
# We'd like to process the updates in reverse (descending) order
237237
if(EXISTS
238-
"${CMAKE_CURRENT_SOURCE_DIR}/updates/${UPDATE_FROM_VERSION}--${PROJECT_VERSION_MOD}.sql"
238+
"${CMAKE_CURRENT_SOURCE_DIR}/updates/${PREVIOUS_VERSION}--${PROJECT_VERSION_MOD}.sql"
239239
)
240240
set(MOD_FILES_LIST ${MOD_FILES_VERSIONED})
241241
else()
242242
set(MOD_FILES_LIST
243-
"${MOD_FILES_VERSIONED};updates/${UPDATE_FROM_VERSION}--${PROJECT_VERSION_MOD}.sql"
243+
"${MOD_FILES_VERSIONED};updates/${PREVIOUS_VERSION}--${PROJECT_VERSION_MOD}.sql"
244244
)
245245
endif()
246246

@@ -259,7 +259,7 @@ set(CURR_MOD_FILES "${LASTEST_MOD_VERSIONED}")
259259
foreach(transition_mod_file ${MOD_FILES_LIST})
260260

261261
if(NOT (${transition_mod_file} MATCHES ${MOD_FILE_REGEX}))
262-
message(FATAL_ERROR "Cannot parse update file name ${mod_file}")
262+
message(FATAL_ERROR "Cannot parse update file name ${transition_mod_file}")
263263
endif()
264264

265265
set(START_VERSION ${CMAKE_MATCH_1})

sql/updates/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ not to any other preceeding versions.
8282

8383
The source and target versions are found in be found in the file
8484
`version.config` file in the root of the source tree, where `version`
85-
is the source version and `downgrade_to_version` is the target
85+
is the source version and `previous_version` is the target
8686
version. Note that we have a separate field for the downgrade.
8787

8888
A downgrade file consists of:
@@ -122,7 +122,7 @@ script to the immediately preceeding version.
122122
### When releasing a new version
123123

124124
When releasing a new version, please rename the file `reverse-dev.sql`
125-
to `<version>--<downgrade_to_version>.sql` and add that name to
125+
to `<version>--<previous_version>.sql` and add that name to
126126
`REV_FILES` variable in the `sql/CMakeLists.txt`. This will allow
127127
generation of downgrade scripts for any version in that list, but it
128128
is currently not added.

version.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version = 2.20.0-dev
2-
update_from_version = 2.19.2
2+
previous_version = 2.19.2
33
downgrade_to_version = 2.19.2

0 commit comments

Comments
 (0)