Skip to content

Commit

Permalink
Merge pull request #1171 from newrelic/update-ci-image
Browse files Browse the repository at this point in the history
Update CI Image
  • Loading branch information
TimPansino authored Oct 2, 2024
2 parents 7ae5f59 + 68aa7ae commit 1807857
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 35 deletions.
7 changes: 4 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ FROM ghcr.io/newrelic/newrelic-python-agent-ci:${IMAGE_TAG}

# Setup non-root user
USER root
ARG UID=1000
ARG UID=1001
ARG GID=${UID}
ENV HOME /home/vscode
ENV HOME=/home/vscode
RUN mkdir -p ${HOME} && \
groupadd --gid ${GID} vscode && \
useradd --uid ${UID} --gid ${GID} --home ${HOME} vscode && \
chown -R ${UID}:${GID} /home/vscode

# Fix pyenv installation
RUN echo 'eval "$(pyenv init -)"' >>${HOME}/.bashrc && \
chown -R vscode:vscode ${PYENV_ROOT}
chown -R vscode:vscode "${PYENV_ROOT}" && \
chown -R vscode:vscode "${PIPX_HOME}"

# Set user
USER ${UID}:${GID}
20 changes: 15 additions & 5 deletions .github/containers/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
make \
odbc-postgresql \
openssl \
python2-dev \
python3-dev \
python3-pip \
sudo \
Expand Down Expand Up @@ -85,7 +84,7 @@ RUN ln -fs "/usr/share/zoneinfo/${TZ}" /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata

# Use root user
ENV HOME /root
ENV HOME=/root
WORKDIR "${HOME}"

# Install pyenv
Expand All @@ -96,12 +95,23 @@ RUN echo 'eval "$(pyenv init -)"' >>${HOME}/.bashrc && \
pyenv update

# Install Python
ARG PYTHON_VERSIONS="3.11 3.10 3.9 3.8 3.7 3.12 pypy3.10-7.3.15"
COPY --chown=1000:1000 --chmod=+x ./install-python.sh /tmp/install-python.sh
ARG PYTHON_VERSIONS="3.12 3.11 3.10 3.9 3.8 3.7 3.13 pypy3.10-7.3.17"
COPY --chown=0:0 --chmod=755 ./install-python.sh /tmp/install-python.sh
RUN /tmp/install-python.sh && \
rm /tmp/install-python.sh

# Install dependencies for main python installation
COPY ./requirements.txt /tmp/requirements.txt
RUN pyenv exec pip install --upgrade -r /tmp/requirements.txt && \
rm /tmp/requirements.txt
rm /tmp/requirements.txt

# Install tools with pipx in isolated environments
COPY ./requirements-tools.txt /tmp/requirements-tools.txt
ENV PIPX_HOME="/opt/pipx"
ENV PIPX_BIN_DIR="${PIPX_HOME}/bin"
ENV PATH="${PIPX_BIN_DIR}:${PATH}"
RUN mkdir -p "${PIPX_BIN_DIR}" && \
while IFS="" read -r line || [ -n "$line" ]; do \
pyenv exec pipx install --global "${line}"; \
done </tmp/requirements-tools.txt && \
rm /tmp/requirements-tools.txt
6 changes: 6 additions & 0 deletions .github/containers/requirements-tools.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
bandit
black
flake8
flynt
isort
tox
6 changes: 1 addition & 5 deletions .github/containers/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
bandit
black
flake8
isort
pip
pipx
setuptools
tox
virtualenv
wheel
36 changes: 18 additions & 18 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ concurrency:
jobs:
# Aggregate job that provides a single check for all tests passing
tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs:
- python
- elasticsearchserver07
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
# Combine and upload coverage data
coverage:
if: success() || failure() # Does not run on cancelled workflows
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs:
- tests

Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
20,
]

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: ghcr.io/newrelic/newrelic-python-agent-ci:latest
options: >-
Expand Down Expand Up @@ -209,7 +209,7 @@ jobs:
matrix:
group-number: [1]

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: ghcr.io/newrelic/newrelic-python-agent-ci:latest
options: >-
Expand Down Expand Up @@ -258,7 +258,7 @@ jobs:
matrix:
group-number: [1, 2]

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: ghcr.io/newrelic/newrelic-python-agent-ci:latest
options: >-
Expand Down Expand Up @@ -322,7 +322,7 @@ jobs:
matrix:
group-number: [1]

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: ghcr.io/newrelic/newrelic-python-agent-ci:latest
options: >-
Expand Down Expand Up @@ -386,7 +386,7 @@ jobs:
matrix:
group-number: [1]

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: ghcr.io/newrelic/newrelic-python-agent-ci:latest
options: >-
Expand Down Expand Up @@ -453,7 +453,7 @@ jobs:
matrix:
group-number: [1, 2]

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: ghcr.io/newrelic/newrelic-python-agent-ci:latest
options: >-
Expand Down Expand Up @@ -520,7 +520,7 @@ jobs:
matrix:
group-number: [1]

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: ghcr.io/newrelic/newrelic-python-agent-ci:latest
options: >-
Expand Down Expand Up @@ -623,7 +623,7 @@ jobs:
matrix:
group-number: [1, 2]

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: ghcr.io/newrelic/newrelic-python-agent-ci:latest
options: >-
Expand Down Expand Up @@ -685,7 +685,7 @@ jobs:
matrix:
group-number: [1]

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: ghcr.io/newrelic/newrelic-python-agent-ci:latest
options: >-
Expand Down Expand Up @@ -749,7 +749,7 @@ jobs:
matrix:
group-number: [1, 2]

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: ghcr.io/newrelic/newrelic-python-agent-ci:latest
options: >-
Expand Down Expand Up @@ -811,7 +811,7 @@ jobs:
matrix:
group-number: [1]

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: ghcr.io/newrelic/newrelic-python-agent-ci:latest
options: >-
Expand Down Expand Up @@ -874,7 +874,7 @@ jobs:
matrix:
group-number: [1, 2, 3, 4]

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: ghcr.io/newrelic/newrelic-python-agent-ci:latest
options: >-
Expand Down Expand Up @@ -948,7 +948,7 @@ jobs:
matrix:
group-number: [1]

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: ghcr.io/newrelic/newrelic-python-agent-ci:latest
options: >-
Expand Down Expand Up @@ -1010,7 +1010,7 @@ jobs:
matrix:
group-number: [1]

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: ghcr.io/newrelic/newrelic-python-agent-ci:latest
options: >-
Expand Down Expand Up @@ -1074,7 +1074,7 @@ jobs:
matrix:
group-number: [1]

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: ghcr.io/newrelic/newrelic-python-agent-ci:latest
options: >-
Expand Down Expand Up @@ -1139,7 +1139,7 @@ jobs:
matrix:
group-number: [1]

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: ghcr.io/newrelic/newrelic-python-agent-ci:latest
options: >-
Expand Down
9 changes: 5 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ envlist =
python-agent_unittests-{py37,py38,py39,py310,py311,py312}-{with,without}_extensions,
python-agent_unittests-pypy310-without_extensions,
python-application_celery-{py37,py38,py39,py310,py311,py312,pypy310}-celerylatest,
python-application_celery-py311-celery{0503,0502,0501},
python-application_celery-py311-celery{0504,0503,0502},
python-component_djangorestframework-{py37,py38,py39,py310,py311,py312}-djangorestframeworklatest,
python-component_flask_rest-{py38,py39,py310,py311,py312,pypy310}-flaskrestxlatest,
python-component_flask_rest-py37-flaskrestx110,
Expand Down Expand Up @@ -156,8 +156,9 @@ envlist =
python-template_jinja2-py37-jinja2030103,
python-template_mako-{py37,py38,py39,py310,py311,py312},
rabbitmq-messagebroker_pika-{py37,py38,py39,py310,py311,py312,pypy310}-pikalatest,
redis-datastore_redis-{py37,py38,py39,py310,py311,py312,pypy310}-redis{04,latest},
rediscluster-datastore_rediscluster-{py37,py311,py312,pypy310}-redislatest,
redis-datastore_redis-{py37,py311,pypy310}-redis04,
redis-datastore_redis-{py37,py38,py39,py310,py311,py312,pypy310}-redislatest,
rediscluster-datastore_rediscluster-{py37,py312,pypy310}-redislatest,
solr-datastore_pysolr-{py37,py38,py39,py310,py311,py312,pypy310},

[testenv]
Expand Down Expand Up @@ -199,9 +200,9 @@ deps =
agent_features: beautifulsoup4
agent_features: protobuf
application_celery-celerylatest: celery[pytest]
application_celery-celery0504: celery[pytest]<5.5
application_celery-celery0503: celery[pytest]<5.4
application_celery-celery0502: celery[pytest]<5.3
application_celery-celery0501: celery[pytest]<5.2
application_celery-{py37,pypy310}: importlib-metadata<5.0
mlmodel_sklearn: pandas
mlmodel_sklearn: protobuf
Expand Down

0 comments on commit 1807857

Please sign in to comment.