Skip to content

Commit

Permalink
CASMCMS-8713: Temporarily modify PyYAML install procedure in Dockerfi…
Browse files Browse the repository at this point in the history
…le to workaround upstream PyYAML issue
  • Loading branch information
mharding-hpe committed Jul 17, 2023
1 parent 06a17ab commit c2d1e02
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 7 deletions.
6 changes: 2 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### changed

- dependabot: Bump `semver` from 3.0.0 to 3.0.1

### Dependencies
- Bump `gitpython` from 3.1.31 to 3.1.32 (#88)
- Bump `semver` from 3.0.0 to 3.0.1
- Temporarily modify [`Dockerfile`](Dockerfile) procedure used to install `PyYAML`, to work around https://github.com/yaml/pyyaml/issues/601

## [1.9.5] - 2023-05-31

Expand Down
38 changes: 35 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,41 @@ RUN apk add --upgrade --no-cache apk-tools && \
curl \
py3-pip && \
apk -U upgrade --no-cache
ADD requirements.txt constraints.txt ./
RUN pip3 install --no-cache-dir -r requirements.txt && \
rm -rf requirements.txt constraints.txt && \

# The addition of the requirements-pyyaml.txt and requirements-non-pyyaml.txt files is to work around
# a problem installing the PyYAML Python module. A change was also made to the pip3 install commands to
# use these files. This work around essentially forces the install of the PyYAML module to use a
# version of Cython that is < 3.0 (this restriction was added to constraints.txt along with the changes
# here in the Dockerfile).
#
# These workarounds are necessary until one of the following things happens:
# * PyYAML publishes an update which constrains its build environment to using Cython < 3.0, so that
# we don't have to manually impose that constraint.
# * A combination of Cython and PyYAML versions are released that allow PyYAML to build under Alpine using
# Cython >= 3.0, so that we don't need to manually constrain the Cython version.
# * A PyYAML wheel is available for Alpine, so that the build environment is a non-issue.
#
# Currently there is a PyYAML PR up which would do the first item on that list: https://github.com/yaml/pyyaml/pull/702
# If that PR merges and is added to a PyYAML release, then the following steps should be done to undo the workaround:
#
# * Update constraints.txt with the PyYAML version that contains the workaround
# * Delete requirements-pyyaml.txt requirements-non-pyyaml.txt from the repository
# * Remove requirements-pyyaml.txt requirements-non-pyyaml.txt from the ADD and rm lines in this Dockerfile
# * Remove the Cython constraint from constraints.txt
# * Modify the following Dockerfile lines from:
#
# pip3 install --no-cache-dir -r requirements-pyyaml.txt --no-build-isolation && \
# pip3 install --no-cache-dir -r requirements-non-pyyaml.txt && \
#
# to:
#
# pip3 install --no-cache-dir -r requirements.txt && \

ADD requirements.txt constraints.txt requirements-pyyaml.txt requirements-non-pyyaml.txt ./
RUN pip3 install --upgrade pip wheel \
pip3 install --no-cache-dir -r requirements-pyyaml.txt --no-build-isolation && \
pip3 install --no-cache-dir -r requirements-non-pyyaml.txt && \
rm -rf requirements.txt constraints.txt requirements-pyyaml.txt requirements-non-pyyaml.txt && \
mkdir -p /opt/csm && \
chown nobody:nobody /opt/csm

Expand Down
1 change: 1 addition & 0 deletions constraints.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Cython<3.0
gitdb==4.0.10
GitPython==3.1.32
semver==3.0.1
Expand Down
3 changes: 3 additions & 0 deletions requirements-non-pyyaml.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-c constraints.txt
GitPython
semver
3 changes: 3 additions & 0 deletions requirements-pyyaml.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-c constraints.txt
Cython
PyYAML

0 comments on commit c2d1e02

Please sign in to comment.