Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1843342: Get RPM and Kuryr version from git #267

Merged
merged 1 commit into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions openshift-kuryr-kubernetes-rhel8.spec
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ with OpenStack networking.
%global commit 0000000

Name: openshift-%project
Version: 4.6.1
Release: 1%{?dist}
Version: %{_version}
Release: %{_release}%{?dist}
Summary: OpenStack networking integration with OpenShift and Kubernetes
License: ASL 2.0
URL: http://docs.openstack.org/developer/kuryr-kubernetes/
Expand Down Expand Up @@ -112,6 +112,11 @@ rm -f requirements.txt
rm -f test-requirements.txt
rm -f doc/requirements.txt

# Need to commit it to make sure no .devxyz will get added to version by pbr.
git commit -a --amend -m "Manage requirements on our own"
# Tagging will make sure pbr uses this as version.
git tag -a -m "%{version}" "%{version}"

# Kill egg-info in order to generate new SOURCES.txt
rm -rf kuryr_kubernetes.egg-info

Expand Down
13 changes: 9 additions & 4 deletions tools/build-rpm-rhel8.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
#!/bin/bash -x

version=4.6.1
source_path=_output/SOURCES

mkdir -p ${source_path}

# Getting version from last tag in git
version=`git describe --tags --abbrev=0`
version=${version#openshift-kuryr-} # remove prefix
release=${version#*-} # remove prefix
version=${version%-*} # remove date suffix

# NOTE(dulek): rpmbuild requires that inside the tar there will be a
# ${service}-${version} directory, hence this --transform option.
# Also note that for some reason it doesn't work without excluding
# .git directory. Excluding .tox is convenient for local builds.
# We exclude .git as rpmbuild will do its own `git init`.
# Excluding .tox is convenient for local builds.
tar -czvf ${source_path}/kuryr-kubernetes.tar.gz --exclude=.git --exclude=.tox --transform "flags=r;s|\.|kuryr-kubernetes-${version}|" .
cp kuryr.logrotate ${source_path}
cp kuryr-controller.service ${source_path}
Expand All @@ -20,5 +25,5 @@ curl http://base-openstack-4-6.ocp.svc > /etc/yum.repos.d/base-openstack-4-6.rep

yum install -y python3-pbr python3-devel

rpmbuild -ba -D "_topdir `pwd`/_output" openshift-kuryr-kubernetes-rhel8.spec
rpmbuild -ba -D "_version $version" -D "_release $release" -D "_topdir `pwd`/_output" openshift-kuryr-kubernetes-rhel8.spec
createrepo _output/RPMS/noarch