Commit a4539949 authored by Guillaume Quintard's avatar Guillaume Quintard Committed by Dridi Boukelmoune

[cci] better weekly handling

if version is trunk, change it to the current date and add a flag file
so that packages can be suffixed with -weekly/.weekly depending on the
platform
parent 08593cb9
...@@ -105,24 +105,13 @@ jobs: ...@@ -105,24 +105,13 @@ jobs:
- run: - run:
name: Update changelog version name: Update changelog version
command: | command: |
VERSION=$(./configure --version | awk 'NR == 1 {print $NF}') if [ -e .is_weekly ]; then
WEEKLY='-weekly'
# VERSION looks like 5.2.1 or 5.2.0-rc1
MAJOR=${VERSION%.*} # 5.2
MINOR=${VERSION##*.} # 1 or 0-rc1
MINOR=${MINOR%%-*} # 1 or 0
RELEASE=${VERSION#*-} # 5.2.1 or rc1
RELEASE=${RELEASE#$VERSION} # '' or rc1
# Take version override set on Jenkins builds into account.
if [ "$VERSION" = "trunk" ]; then
DEBVERSION=`date "+%Y%m%d"`-weekly~<< parameters.release >>
else else
DEBVERSION="$MAJOR.$MINOR"-1~<< parameters.release >> WEEKLY=
fi fi
VERSION=$(./configure --version | awk 'NR == 1 {print $NF}')$WEEKLY~<< parameters.release >>
sed -i -e "s|@SECTION@|varnish-$MAJOR|" "debian/control" sed -i -e "s|@VERSION@|$VERSION|" "debian/changelog"
sed -i -e "s|@VERSION@|$DEBVERSION|" "debian/changelog"
- run: - run:
name: Install Build-Depends packages name: Install Build-Depends packages
command: | command: |
...@@ -143,7 +132,7 @@ jobs: ...@@ -143,7 +132,7 @@ jobs:
paths: paths:
- debs/varnish*.deb - debs/varnish*.deb
- debs/varnish*.dsc - debs/varnish*.dsc
build_alpine: build_apks:
description: Build alpine apks description: Build alpine apks
docker: docker:
- image: alpine - image: alpine
...@@ -178,16 +167,8 @@ jobs: ...@@ -178,16 +167,8 @@ jobs:
command: | command: |
tar xavf varnish-*.tar.gz tar xavf varnish-*.tar.gz
VERSION=$(varnish-*/configure --version | awk 'NR == 1 {print $NF}') VERSION=$(varnish-*/configure --version | awk 'NR == 1 {print $NF}')
if [ "$VERSION" = trunk ]; then sed -i "s/@VERSION@/$VERSION/" APKBUILD
WEEKLYVERSION=`date "+%Y%m%d"` rm -rf varnish-*/
sed -i \
-e "s@^pkgver=.*@pkgver=$WEEKLYVERSION@" \
-e "s@^builddir=.*@builddir=\"\$srcdir/varnish-$VERSION\"@" \
-e "s@^source=.*@source=varnish-trunk.tar.gz@" APKBUILD
else
sed -i "s@^pkgver=.*@pkgver=$VERSION@" APKBUILD
fi
rm -rf varnish-$VERSION
- run: - run:
name: Fix checksums, build name: Fix checksums, build
command: | command: |
...@@ -212,11 +193,17 @@ jobs: ...@@ -212,11 +193,17 @@ jobs:
- run: - run:
name: Create the dist tarball name: Create the dist tarball
command: | command: |
# if version is "trunk", it's a weekly tarball, override the version
if grep 'AC_INIT.*trunk.*' ./configure.ac; then
sed -i -e "s/^AC_INIT.*trunk.*/AC_INIT([Varnish], [$(date +%Y%m%d)], [varnish-dev@varnish-cache.org])/" ./configure.ac
touch .is_weekly
fi
./autogen.des --quiet ./autogen.des --quiet
make dist -j 16 make dist -j 16
- persist_to_workspace: - persist_to_workspace:
root: . root: .
paths: paths:
- .is_weekly
- varnish*.tar.gz - varnish*.tar.gz
- tools/*.suppr - tools/*.suppr
tar_pkg_tools: tar_pkg_tools:
...@@ -340,33 +327,22 @@ jobs: ...@@ -340,33 +327,22 @@ jobs:
# use python3 # use python3
sed -i '1 i\%global __python %{__python3}' "$DIST_DIR"/redhat/varnish.spec sed -i '1 i\%global __python %{__python3}' "$DIST_DIR"/redhat/varnish.spec
[ -n "$DIST" ] if [ -e .is_weekly ]; then
VERSION=$("$DIST_DIR"/configure --version | awk 'NR == 1 {print $NF}') WEEKLY='.weekly'
else
# VERSION looks like 5.2.1 or 5.2.0-rc1 WEEKLY=
MAJOR=${VERSION%.*} # 5.2 fi
MINOR=${VERSION##*.} # 1 or 0-rc1 VERSION=$("$DIST_DIR"/configure --version | awk 'NR == 1 {print $NF}')$WEEKLY
MINOR=${MINOR%%-*} # 1 or 0
RELEASE=${VERSION#*-} # 5.2.1 or rc1
RELEASE=${RELEASE#$VERSION} # '' or rc1
cp -r -L "$DIST_DIR"/redhat/* "$DIST_DIR"/ cp -r -L "$DIST_DIR"/redhat/* "$DIST_DIR"/
tar zcf "$DIST_DIR.tgz" --exclude "$DIST_DIR/redhat" "$DIST_DIR"/ tar zcf "$DIST_DIR.tgz" --exclude "$DIST_DIR/redhat" "$DIST_DIR"/
if [ "$VERSION" = "trunk" ]; then RPMVERSION="$VERSION"
RPMVERSION=`date "+%Y%m%d"`
else
RPMVERSION="$MAJOR.$MINOR"
fi
RESULT_DIR="rpms" RESULT_DIR="rpms"
CUR_DIR="$(pwd)" CUR_DIR="$(pwd)"
rpmbuild() { rpmbuild() {
if [ -n "$RELEASE" ]
then
set -- --define "v_rc $RELEASE" "$@"
fi
command rpmbuild \ command rpmbuild \
--define "_smp_mflags -j10" \ --define "_smp_mflags -j10" \
--define "dist $DIST" \ --define "dist $DIST" \
...@@ -422,7 +398,8 @@ workflows: ...@@ -422,7 +398,8 @@ workflows:
<<: *pkg_req <<: *pkg_req
- build_centos_7: - build_centos_7:
<<: *pkg_req <<: *pkg_req
- build_alpine: - build_apks:
name: build_alpine
<<: *pkg_req <<: *pkg_req
- push_packages: - push_packages:
requires: requires:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment