Skip to content

Commit

Permalink
build, packages: handle different RedHat release
Browse files Browse the repository at this point in the history
Create a tree under packages/redhat to handle
multiple releases.
Adapt paths in the buildchain to the new scheme.

Refs: #2164
  • Loading branch information
alexandre-allard committed Dec 21, 2020
1 parent 4f873e7 commit a9f08ef
Show file tree
Hide file tree
Showing 19 changed files with 273 additions and 172 deletions.
38 changes: 20 additions & 18 deletions buildchain/buildchain/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


from pathlib import Path
from typing import Any, Iterator, Tuple
from typing import Any, Dict, Iterator, Tuple

from buildchain import config
from buildchain import constants
Expand Down Expand Up @@ -45,22 +45,25 @@ def _builder_image(
)


RPM_BUILDER : LocalImage = _builder_image(
name='rpm',
dockerfile=constants.ROOT/'packages/redhat/Dockerfile',
file_dep=[
constants.ROOT/'packages/redhat/yum_repositories/kubernetes.repo',
constants.ROOT/'packages/redhat/yum_repositories/saltstack.repo'
],
build_args={
# Used to template the SaltStack repository definition
'SALT_VERSION': versions.SALT_VERSION,
},
)
RPM_BUILDER : Dict[str, LocalImage] = {
'7': _builder_image(
name='redhat-7-rpm',
dockerfile=constants.ROOT/'packages/redhat/7/Dockerfile',
build_context=constants.ROOT/'packages/redhat',
file_dep=[
constants.ROOT/'packages/redhat/common/yum_repositories/kubernetes.repo',
constants.ROOT/'packages/redhat/common/yum_repositories/saltstack.repo',
],
build_args={
# Used to template the SaltStack repository definition
'SALT_VERSION': versions.SALT_VERSION,
},
),
}

DEB_BUILDER : LocalImage = _builder_image(
name='deb',
dockerfile=constants.ROOT/'packages/debian/Dockerfile',
name='ubuntu-18.04-deb',
dockerfile=constants.ROOT/'packages/debian/18.04/Dockerfile',
)

DOC_BUILDER : LocalImage = _builder_image(
Expand Down Expand Up @@ -94,12 +97,11 @@ def _builder_image(


_BUILDERS : Tuple[LocalImage, ...] = (
RPM_BUILDER,
DEB_BUILDER,
DOC_BUILDER,
GO_BUILDER,
UI_BUILDER,
)
) + tuple(RPM_BUILDER.values()) \
+ tuple(DEB_BUILDER.values())


__all__ = utils.export_only_tasks(__name__)
8 changes: 4 additions & 4 deletions buildchain/buildchain/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# Root of the repositories on the ISO.
REPO_ROOT : Path = ISO_ROOT/'packages'
# Root of the RedHat repositories on the ISO.
REPO_RPM_ROOT : Path = REPO_ROOT/'redhat'
REPO_REDHAT_ROOT : Path = REPO_ROOT/'redhat'
# Root of the Debian repositories on the ISO.
REPO_DEB_ROOT : Path = REPO_ROOT/'debian'
# Root for the images on the ISO.
Expand All @@ -48,8 +48,8 @@
DOCS_BUILD_ROOT : Path = config.BUILD_ROOT/'docs'
# Root for the packages that we build ourselves.
PKG_ROOT : Path = config.BUILD_ROOT/'packages'
# Root for the RPM packages that we build ourselves.
PKG_RPM_ROOT : Path = PKG_ROOT/'redhat'
# Root for the Redhat packages that we build ourselves.
PKG_REDHAT_ROOT : Path = PKG_ROOT/'redhat'
# Root for the Debian packages that we build ourselves.
PKG_DEB_ROOT : Path = PKG_ROOT/'debian'
# Root of the Vagrant environment folder.
Expand All @@ -65,7 +65,7 @@

# Docker entrypoints.
DEBIAN_ENTRYPOINT : Path = ROOT/'packages/debian/entrypoint.sh'
REDHAT_ENTRYPOINT : Path = ROOT/'packages/redhat/entrypoint.sh'
REDHAT_ENTRYPOINT : Path = ROOT/'packages/redhat/common/entrypoint.sh'

# Path to UI static files.
UI_PUBLIC : Path = ROOT/'ui/public'
Expand Down
2 changes: 1 addition & 1 deletion buildchain/buildchain/docker_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

RPMLINTRC_MOUNT : Mount = utils.bind_ro_mount(
target=Path('/rpmbuild/rpmlintrc'),
source=constants.ROOT/'packages'/'redhat'/'rpmlintrc',
source=constants.ROOT/'packages'/'redhat'/'common'/'rpmlintrc',
)


Expand Down
Loading

0 comments on commit a9f08ef

Please sign in to comment.