Skip to content

Commit

Permalink
Merge pull request #307 from maouw/deprecate_addgroup
Browse files Browse the repository at this point in the history
Deprecate addgroup
  • Loading branch information
arokem authored Feb 26, 2024
2 parents 33c73bf + ef81704 commit 7c8b442
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ["3.10", "3.11"]

steps:
- name: Checkout repo
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
max-parallel: 8
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ["3.10", "3.11"]

steps:
- name: Checkout repo
Expand All @@ -19,9 +19,9 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install software
run: |
python -m pip install --upgrade pip --use-feature=2020-resolver
python -m pip install coveralls --use-feature=2020-resolver
python -m pip install .[dev] --use-feature=2020-resolver
python -m pip install --upgrade pip
python -m pip install coveralls
python -m pip install .[dev]
python -m pip install https://github.com/bboe/coveralls-python/archive/github_actions.zip
- name: Configure
run: |
Expand Down
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
repos:
- repo: https://github.com/python/black
rev: 22.1.0
rev: 23.7.0
hooks:
- id: black
language_version: python3.9
1 change: 1 addition & 0 deletions cloudknot/aws/base_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ def get_s3_params():

# Use set_s3_params to check for name availability
# and write to config file
bucket = bucket.replace("_", "-") # S3 does not allow underscores
set_s3_params(bucket=bucket, policy=policy, sse=sse)

if policy is None:
Expand Down
7 changes: 3 additions & 4 deletions cloudknot/cloudknot.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
import logging
import os

try:
from collections.abc import Iterable, namedtuple
except ImportError:
from collections import Iterable, namedtuple
from collections.abc import Iterable
from collections import namedtuple

from concurrent.futures import ThreadPoolExecutor

from . import aws
Expand Down
19 changes: 9 additions & 10 deletions cloudknot/data/docker_reqs_ref_data/py3/ref1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,17 @@ RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Create a default user. Available via runtime flag `--user cloudknot-user`.
# Add user to "staff" group.
# Give user a home directory.
RUN (id -u cloudknot-user >/dev/null 2>&1 || useradd cloudknot-user) \
&& addgroup cloudknot-user staff \
&& mkdir -p /home/cloudknot-user \
&& chown -R cloudknot-user:staff /home/cloudknot-user
RUN groupadd -f staff \
&& useradd --create-home --groups staff "cloudknot-user"

ENV HOME /home/cloudknot-user
# Copy the python script
COPY --chown="cloudknot-user" "unit-testing-func.py" "/home/cloudknot-user/"

# Set user
USER "cloudknot-user"

# Set working directory
WORKDIR /home/cloudknot-user
WORKDIR "/home/cloudknot-user"

# Set entrypoint
ENTRYPOINT ["python", "/home/cloudknot-user/unit-testing-func.py"]

# Copy the python script
COPY unit-testing-func.py /home/cloudknot-user/
ENTRYPOINT ["/home/cloudknot-user/unit-testing-func.py"]
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
import boto3
import cloudpickle
import os
Expand Down
19 changes: 9 additions & 10 deletions cloudknot/data/docker_reqs_ref_data/py3/ref2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,17 @@ RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Create a default user. Available via runtime flag `--user unit-test-username`.
# Add user to "staff" group.
# Give user a home directory.
RUN (id -u unit-test-username >/dev/null 2>&1 || useradd unit-test-username) \
&& addgroup unit-test-username staff \
&& mkdir -p /home/unit-test-username \
&& chown -R unit-test-username:staff /home/unit-test-username
RUN groupadd -f staff \
&& useradd --create-home --groups staff "unit-test-username"

ENV HOME /home/unit-test-username
# Copy the python script
COPY --chown="unit-test-username" "test-func-input.py" "/home/unit-test-username/"

# Set user
USER "unit-test-username"

# Set working directory
WORKDIR /home/unit-test-username
WORKDIR "/home/unit-test-username"

# Set entrypoint
ENTRYPOINT ["python", "/home/unit-test-username/test-func-input.py"]

# Copy the python script
COPY test-func-input.py /home/unit-test-username/
ENTRYPOINT ["/home/unit-test-username/test-func-input.py"]
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
import boto3
import cloudpickle
import os
Expand Down
19 changes: 9 additions & 10 deletions cloudknot/templates/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,17 @@ RUN pip install --no-cache-dir -r /tmp/requirements.txt${github_installs_string}
# Create a default user. Available via runtime flag `--user ${username}`.
# Add user to "staff" group.
# Give user a home directory.
RUN (id -u ${username} >/dev/null 2>&1 || useradd ${username}) \
&& addgroup ${username} staff \
&& mkdir -p /home/${username} \
&& chown -R ${username}:staff /home/${username}
RUN groupadd -f staff \
&& useradd --create-home --groups staff "${username}"

ENV HOME /home/${username}
# Copy the python script
COPY --chown="${username}" "${script_base_name}" "/home/${username}/"

# Set user
USER "${username}"

# Set working directory
WORKDIR /home/${username}
WORKDIR "/home/${username}"

# Set entrypoint
ENTRYPOINT ["python", "/home/${username}/${script_base_name}"]

# Copy the python script
COPY ${script_base_name} /home/${username}/
ENTRYPOINT ["/home/${username}/${script_base_name}"]
1 change: 1 addition & 0 deletions cloudknot/templates/script.template
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
import boto3
import cloudpickle
import os
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ exclude = '''
| build
| dist
)/
| foo.py # also separately exclude a file named foo.py in
# the root of the project
| _version.py
| cli.py
)
'''
17 changes: 8 additions & 9 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ setup_requires =
setuptools_scm
python_requires = >=3.6
install_requires =
awscli
boto3>=1.5.21
botocore>=1.8.36
boto3>=1.34.31
awscli>=1.32.31
botocore>=1.34.31
cloudpickle
docker>=3.0.0
pipreqs>=0.4.11
Expand All @@ -53,18 +53,17 @@ console_scripts =

[options.extras_require]
dev =
black==20.8b1
black==23.7.0
coverage==5.3
flake8==3.8.3
numpydoc==1.1.0
moto>=2.2.13.dev2
responses==0.12.0
pre-commit==2.9.2
moto[cloudformation]==4.1.5
pre-commit==3.3.3
pydocstyle==5.1.1
pytest-cov==2.10.1
pytest-xdist[psutil]==2.1.0
pytest==6.0.1
sphinx==3.2.1
pytest==7.4.0
sphinx==5.0.0
maint =
rapidfuzz==0.12.2

Expand Down

0 comments on commit 7c8b442

Please sign in to comment.