Skip to content

Commit 2e8d0f3

Browse files
committed
Add el8 support
Update circleci config, Makefile, and rpm spec to support building of el8 package.
1 parent 1e6efbc commit 2e8d0f3

File tree

3 files changed

+45
-15
lines changed

3 files changed

+45
-15
lines changed

.circleci/config.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ jobs:
7171
docker:
7272
- image: circleci/python:2.7
7373
environment:
74-
DISTROS: trusty xenial bionic el6 el7
75-
DOCKER_DISTROS: trusty bionic centos6 centos7
74+
DISTROS: trusty xenial bionic el6 el7 el8
75+
DOCKER_DISTROS: trusty xenial bionic centos6 centos7 centos8
7676
DOCKER_RUN: |-
7777
docker run -w /code/st2-sso-backend --volumes-from st2-sso-backend-vol
7878
-e PKG_VERSION=$PKG_VERSION
@@ -132,7 +132,10 @@ jobs:
132132
docker cp st2-sso-backend-vol:/code/st2-sso-backend/build/x86_64/st2-sso-backend-${PKG_VERSION}-${PKG_RELEASE}.x86_64.rpm ~/st2-sso-backend/build/el6
133133
# 4. Build RHEL 7 packages
134134
eval ${DOCKER_RUN} stackstorm/buildpack:centos7 make play rpm
135-
docker cp st2-sso-backend-vol:/code/st2-sso-backend/build/x86_64/st2-sso-backend-${PKG_VERSION}-${PKG_RELEASE}.x86_64.rpm ~/st2-sso-backend/build//el7
135+
docker cp st2-sso-backend-vol:/code/st2-sso-backend/build/x86_64/st2-sso-backend-${PKG_VERSION}-${PKG_RELEASE}.x86_64.rpm ~/st2-sso-backend/build/el7
136+
# 5. Build RHEL 8 packages
137+
eval ${DOCKER_RUN} stackstorm/buildpack:centos8 "yum install -y which; make play rpm"
138+
docker cp st2-sso-backend-vol:/code/st2-sso-backend/build/x86_64/st2-sso-backend-${PKG_VERSION}-${PKG_RELEASE}.x86_64.rpm ~/st2-sso-backend/build/el8
136139
# List poduced artifacts
137140
ls -la ~/st2-sso-backend/build/*/*
138141
- store_artifacts:
@@ -149,7 +152,7 @@ jobs:
149152
- image: circleci/ruby:2.4
150153
working_directory: /tmp/deploy
151154
environment:
152-
DISTROS: trusty xenial bionic el6 el7
155+
DISTROS: trusty xenial bionic el6 el7 el8
153156
steps:
154157
- checkout
155158
- attach_workspace:

Makefile

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
# Proprietary and confidential
44

55
ROOT_DIR ?= $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
6-
6+
CURRENT_DIR ?= $(shell pwd)
77
PKG_NAME := st2-sso-backend
88
PKG_RELEASE ?= 1
99
WHEELSDIR ?= opt/stackstorm/share/wheels
1010
VIRTUALENV_DIR ?= virtualenv
1111
ST2_REPO_PATH ?= /tmp/st2
1212
ST2_REPO_URL ?= [email protected]:StackStorm/st2.git
13-
ST2_REPO_BRANCH ?= st2auth-sso
13+
ST2_REPO_BRANCH ?= master
1414

1515
# Packaging Options
1616
PKGDISTDIR = dist
@@ -21,14 +21,19 @@ EGGINFODIR = *.egg-info
2121
ifneq (,$(wildcard /etc/debian_version))
2222
DEBIAN := 1
2323
DEB_DISTRO := $(shell lsb_release -cs)
24+
REDHAT_DISTRO := 0
2425
else
2526
REDHAT := 1
27+
REDHAT_DISTRO := $(shell rpm --eval '%{rhel}')
2628
DEB_DISTRO := unstable
2729
endif
2830

2931
ifeq ($(DEB_DISTRO),bionic)
3032
PYTHON_BINARY := /usr/bin/python3
3133
PIP_BINARY := /usr/local/bin/pip3
34+
else ifeq ($(shell test $(REDHAT_DISTRO) -ge 8; echo $$?), 0)
35+
PYTHON_BINARY := $(shell which python3)
36+
PIP_BINARY := $(shell which pip3)
3237
else
3338
PYTHON_BINARY := python
3439
PIP_BINARY := pip
@@ -51,7 +56,7 @@ space_char +=
5156
COMPONENTS = $(wildcard $(ST2_REPO_PATH)/st2*)
5257
COMPONENTS_RUNNERS := $(wildcard $(ST2_REPO_PATH)/contrib/runners/*)
5358
COMPONENTS_WITH_RUNNERS := $(COMPONENTS) $(COMPONENTS_RUNNERS)
54-
COMPONENT_PYTHONPATH = $(subst $(space_char),:,$(realpath $(COMPONENTS_WITH_RUNNERS))):$(ST2_REPO_PATH)
59+
COMPONENT_PYTHONPATH = $(subst $(space_char),:,$(realpath $(COMPONENTS_WITH_RUNNERS))):$(ST2_REPO_PATH):$(CURRENT_DIR)
5560
COMPONENTS_TEST := $(foreach component,$(filter-out $(COMPONENT_SPECIFIC_TESTS),$(COMPONENTS_WITH_RUNNERS)),$(component))
5661
COMPONENTS_TEST_COMMA := $(subst $(slash),$(dot),$(subst $(space_char),$(comma),$(COMPONENTS_TEST)))
5762
COMPONENTS_TEST_MODULES := $(subst $(slash),$(dot),$(COMPONENTS_TEST_DIRS))
@@ -80,8 +85,9 @@ endif
8085
.PHONY: play
8186
play:
8287
@echo "DEBIAN=$(DEBIAN)"
83-
@echo "REDHAT=$(REDHAT)"
8488
@echo "DEB_DISTRO=$(DEB_DISTRO)"
89+
@echo "REDHAT=$(REDHAT)"
90+
@echo "REDHAT_DISTRO=$(REDHAT_DISTRO)"
8591
@echo "PYTHON_BINARY=$(PYTHON_BINARY)"
8692
@echo "PIP_BINARY=$(PIP_BINARY)"
8793
@echo "PKG_VERSION=$(PKG_VERSION)"
@@ -199,24 +205,39 @@ compilepy3:
199205
@echo ""
200206
@echo "================== register metrics drivers ======================"
201207
@echo ""
202-
203208
# Install st2common to register metrics drivers
204209
(. $(VIRTUALENV_DIR)/bin/activate; cd $(ST2_REPO_PATH)/st2common; python setup.py develop --no-deps)
205-
206210
@echo ""
207211
@echo "================== register sso backends ======================"
208212
@echo ""
209213
(. $(VIRTUALENV_DIR)/bin/activate; python setup.py develop --no-deps)
210214

211-
212215
.PHONY: requirements
213-
requirements: virtualenv .clone_st2_repo .install-runners-and-deps
216+
requirements: .clone_st2_repo virtualenv
214217
@echo
215218
@echo "==================== requirements ===================="
216219
@echo
217220
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r /tmp/st2/requirements.txt
218221
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r /tmp/st2/test-requirements.txt
219222
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r requirements.txt
223+
@echo ""
224+
@echo "================== install runners ===================="
225+
@echo ""
226+
@for component in $(COMPONENTS_RUNNERS); do \
227+
echo "==========================================================="; \
228+
echo "Installing runner:" $$component; \
229+
echo "==========================================================="; \
230+
(. $(VIRTUALENV_DIR)/bin/activate; cd $$component; python setup.py develop --no-deps); \
231+
done
232+
@echo ""
233+
@echo "================== register metrics drivers ======================"
234+
@echo ""
235+
# Install st2common to register metrics drivers
236+
(. $(VIRTUALENV_DIR)/bin/activate; cd $(ST2_REPO_PATH)/st2common; python setup.py develop --no-deps)
237+
@echo ""
238+
@echo "================== register sso backends ======================"
239+
@echo ""
240+
(. $(VIRTUALENV_DIR)/bin/activate; python setup.py develop --no-deps)
220241

221242
.PHONY: requirements-ci
222243
requirements-ci:
@@ -233,7 +254,7 @@ $(VIRTUALENV_DIR)/bin/activate:
233254
@echo
234255
@echo "==================== virtualenv ===================="
235256
@echo
236-
test -d $(VIRTUALENV_DIR) || virtualenv --no-site-packages $(VIRTUALENV_DIR)
257+
test -d $(VIRTUALENV_DIR) || virtualenv $(VIRTUALENV_DIR)
237258

238259
# Setup PYTHONPATH in bash activate script...
239260
# Delete existing entries (if any)

rpm/st2-sso-backend.spec

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
%define pkg_version %(python setup.py --version 2>/dev/null)
1+
%define pyexe %(which python)
2+
3+
%if 0%{?rhel} >= 8
4+
%define pyexe %(which python3)
5+
%endif
6+
7+
%define pkg_version %(%{pyexe} setup.py --version 2>/dev/null)
8+
29
%define version %(echo "${PKG_VERSION:-%{pkg_version}}")
3-
#define epoch %(_epoch=`echo %{version} | grep -q dev || echo 1`; echo "${_epoch:-0}")
410
%define release %(echo "${PKG_RELEASE:-1}")
511
%define st2dir /opt/stackstorm
612
%define st2wheels %{st2dir}/share/wheels

0 commit comments

Comments
 (0)