kopia lustrzana https://github.com/jupyterhub/repo2docker
Porównaj commity
19 Commity
b7e368478c
...
e19e27d3a7
Autor | SHA1 | Data |
---|---|---|
Samuel Gaist | e19e27d3a7 | |
Erik Sundell | d2f467cef6 | |
pre-commit-ci[bot] | 0e7907f86b | |
Simon Li | 243669b928 | |
Simon Li | d4bb9c14da | |
Erik Sundell | f667caf49c | |
Erik Sundell | 755a32bc2a | |
Erik Sundell | 91d3f150e5 | |
Erik Sundell | f121a0d481 | |
Erik Sundell | 57e4b3f687 | |
Erik Sundell | 920ddd86ac | |
YuviPanda | 601fa25291 | |
YuviPanda | 756e7d1a98 | |
YuviPanda | dd9f6ad2de | |
Sylvain Corlay | 01d818b974 | |
Samuel Gaist | ecdcf9e53a | |
Samuel Gaist | 947b0737e9 | |
Samuel Gaist | 379248f325 | |
Samuel Gaist | 8591960f0c |
|
@ -11,7 +11,7 @@
|
|||
repos:
|
||||
# Autoformat: Python code, syntax patterns are modernized
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v3.15.0
|
||||
rev: v3.15.2
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args:
|
||||
|
@ -23,7 +23,7 @@ repos:
|
|||
|
||||
# Autoformat: Python code
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 24.1.1
|
||||
rev: 24.3.0
|
||||
hooks:
|
||||
- id: black
|
||||
args:
|
||||
|
|
24
Dockerfile
24
Dockerfile
|
@ -1,16 +1,21 @@
|
|||
# syntax = docker/dockerfile:1.3
|
||||
ARG ALPINE_VERSION=3.17
|
||||
ARG ALPINE_VERSION=3.19
|
||||
FROM alpine:${ALPINE_VERSION}
|
||||
|
||||
RUN apk add --no-cache git python3 python3-dev py3-pip py3-setuptools build-base
|
||||
|
||||
# build wheels in first image
|
||||
# build wheels in a build stage
|
||||
ARG VIRTUAL_ENV=/opt/venv
|
||||
ENV PATH=${VIRTUAL_ENV}/bin:${PATH}
|
||||
|
||||
RUN python3 -m venv ${VIRTUAL_ENV}
|
||||
|
||||
ADD . /tmp/src
|
||||
RUN cd /tmp/src && git clean -xfd && git status
|
||||
RUN mkdir /tmp/wheelhouse \
|
||||
&& cd /tmp/wheelhouse \
|
||||
&& pip3 install wheel \
|
||||
&& pip3 wheel --no-cache-dir /tmp/src \
|
||||
&& pip install wheel \
|
||||
&& pip wheel --no-cache-dir /tmp/src \
|
||||
&& ls -l /tmp/wheelhouse
|
||||
|
||||
FROM alpine:${ALPINE_VERSION}
|
||||
|
@ -18,13 +23,18 @@ FROM alpine:${ALPINE_VERSION}
|
|||
# install python, git, bash, mercurial
|
||||
RUN apk add --no-cache git git-lfs python3 py3-pip py3-setuptools bash docker mercurial
|
||||
|
||||
ARG VIRTUAL_ENV=/opt/venv
|
||||
ENV PATH=${VIRTUAL_ENV}/bin:${PATH}
|
||||
|
||||
RUN python3 -m venv ${VIRTUAL_ENV}
|
||||
|
||||
# install hg-evolve (Mercurial extensions)
|
||||
RUN pip3 install hg-evolve --user --no-cache-dir
|
||||
RUN pip install hg-evolve --no-cache-dir
|
||||
|
||||
# install repo2docker
|
||||
COPY --from=0 /tmp/wheelhouse /tmp/wheelhouse
|
||||
RUN pip3 install --no-cache-dir --ignore-installed --no-deps /tmp/wheelhouse/*.whl \
|
||||
&& pip3 list
|
||||
RUN pip install --no-cache-dir --ignore-installed --no-deps /tmp/wheelhouse/*.whl \
|
||||
&& pip list
|
||||
|
||||
# add git-credential helper
|
||||
COPY ./docker/git-credential-env /usr/local/bin/git-credential-env
|
||||
|
|
|
@ -1,5 +1,63 @@
|
|||
# Changelog
|
||||
|
||||
## Version 2024.03.0
|
||||
|
||||
([full changelog](https://github.com/jupyterhub/repo2docker/compare/2023.06.0...2024.01.03))
|
||||
|
||||
### New features added
|
||||
|
||||
- Implement support for dockerignore and containerignore [#1205](https://github.com/jupyterhub/repo2docker/pull/1205) ([@sgaist](https://github.com/sgaist))
|
||||
|
||||
### Enhancements made
|
||||
|
||||
- rstudio: log-level info to stderr [#1317](https://github.com/jupyterhub/repo2docker/pull/1317) ([@manics](https://github.com/manics))
|
||||
|
||||
### Bugs fixed
|
||||
|
||||
- Get Zenodo working again [#1315](https://github.com/jupyterhub/repo2docker/pull/1315) ([@manics](https://github.com/manics))
|
||||
|
||||
### Maintenance and upkeep improvements
|
||||
|
||||
- Update mamba to 1.5.7 from 1.5.1, and conda to 24.3.0 from 23.7.4 [#1337](https://github.com/jupyterhub/repo2docker/pull/1337) ([@SylvainCorlay](https://github.com/SylvainCorlay))
|
||||
- Dockerfile: bump alpine from 3.17 to 3.19 and Python 3.10 to 3.11 [#1332](https://github.com/jupyterhub/repo2docker/pull/1332) ([@yuvipanda](https://github.com/yuvipanda))
|
||||
- Upgrade base image from to Ubuntu 22.04 from 18.04 [#1287](https://github.com/jupyterhub/repo2docker/pull/1287) ([@yuvipanda](https://github.com/yuvipanda))
|
||||
|
||||
### Documentation improvements
|
||||
|
||||
- Add Ubuntu 22.04 upgrade guide [#1309](https://github.com/jupyterhub/repo2docker/pull/1309) ([@manics](https://github.com/manics))
|
||||
- Update version of R available [#1288](https://github.com/jupyterhub/repo2docker/pull/1288) ([@yuvipanda](https://github.com/yuvipanda))
|
||||
- Add changelog for 2023.06.0 [#1286](https://github.com/jupyterhub/repo2docker/pull/1286) ([@yuvipanda](https://github.com/yuvipanda))
|
||||
|
||||
### Other merged PRs
|
||||
|
||||
- [pre-commit.ci] pre-commit autoupdate [#1333](https://github.com/jupyterhub/repo2docker/pull/1333) ([@pre-commit-ci](https://github.com/pre-commit-ci))
|
||||
- build(deps): bump codecov/codecov-action from 3 to 4 [#1331](https://github.com/jupyterhub/repo2docker/pull/1331) ([@dependabot](https://github.com/dependabot))
|
||||
- Support pytest=8 [#1330](https://github.com/jupyterhub/repo2docker/pull/1330) ([@manics](https://github.com/manics))
|
||||
- Update versioneer [#1329](https://github.com/jupyterhub/repo2docker/pull/1329) ([@TimoRoth](https://github.com/TimoRoth))
|
||||
- build(deps): bump actions/setup-python from 4 to 5 [#1328](https://github.com/jupyterhub/repo2docker/pull/1328) ([@dependabot](https://github.com/dependabot))
|
||||
- build(deps): bump actions/upload-artifact from 3 to 4 [#1327](https://github.com/jupyterhub/repo2docker/pull/1327) ([@dependabot](https://github.com/dependabot))
|
||||
- Add NYCU Dataverse [#1326](https://github.com/jupyterhub/repo2docker/pull/1326) ([@twtw](https://github.com/twtw))
|
||||
- [pre-commit.ci] pre-commit autoupdate [#1322](https://github.com/jupyterhub/repo2docker/pull/1322) ([@pre-commit-ci](https://github.com/pre-commit-ci))
|
||||
- New domain for Edmond MPG repository [#1321](https://github.com/jupyterhub/repo2docker/pull/1321) ([@haarli](https://github.com/haarli))
|
||||
- [pre-commit.ci] pre-commit autoupdate [#1319](https://github.com/jupyterhub/repo2docker/pull/1319) ([@pre-commit-ci](https://github.com/pre-commit-ci))
|
||||
- [MRG] docs: Add base_image parameter example. [#1318](https://github.com/jupyterhub/repo2docker/pull/1318) ([@hiroyuki-sato](https://github.com/hiroyuki-sato))
|
||||
- Upgrade mamba and refreeze [#1313](https://github.com/jupyterhub/repo2docker/pull/1313) ([@manics](https://github.com/manics))
|
||||
- r: Bump version of rsession-proxy [#1310](https://github.com/jupyterhub/repo2docker/pull/1310) ([@yuvipanda](https://github.com/yuvipanda))
|
||||
- build(deps): bump actions/checkout from 3 to 4 [#1308](https://github.com/jupyterhub/repo2docker/pull/1308) ([@dependabot](https://github.com/dependabot))
|
||||
- build(deps): bump docker/build-push-action from 4 to 5 [#1307](https://github.com/jupyterhub/repo2docker/pull/1307) ([@dependabot](https://github.com/dependabot))
|
||||
- build(deps): bump docker/setup-qemu-action from 2 to 3 [#1306](https://github.com/jupyterhub/repo2docker/pull/1306) ([@dependabot](https://github.com/dependabot))
|
||||
- build(deps): bump docker/setup-buildx-action from 2 to 3 [#1305](https://github.com/jupyterhub/repo2docker/pull/1305) ([@dependabot](https://github.com/dependabot))
|
||||
- Update conda and mamba [#1299](https://github.com/jupyterhub/repo2docker/pull/1299) ([@SylvainCorlay](https://github.com/SylvainCorlay))
|
||||
- Point to official documentation for handling JupyterLab workspace [#1294](https://github.com/jupyterhub/repo2docker/pull/1294) ([@fcollonval](https://github.com/fcollonval))
|
||||
- Fix rstudio-build selection [#1293](https://github.com/jupyterhub/repo2docker/pull/1293) ([@yamaton](https://github.com/yamaton))
|
||||
- [pre-commit.ci] pre-commit autoupdate [#1291](https://github.com/jupyterhub/repo2docker/pull/1291) ([@pre-commit-ci](https://github.com/pre-commit-ci))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
([GitHub contributors page for this release](https://github.com/jupyterhub/repo2docker/graphs/contributors?from=2023-06-13&to=2024-03-28&type=c))
|
||||
|
||||
[@annakrystalli](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Aannakrystalli+updated%3A2023-06-13..2024-03-28&type=Issues) | [@betatim](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Abetatim+updated%3A2023-06-13..2024-03-28&type=Issues) | [@bollwyvl](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Abollwyvl+updated%3A2023-06-13..2024-03-28&type=Issues) | [@consideRatio](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3AconsideRatio+updated%3A2023-06-13..2024-03-28&type=Issues) | [@dependabot](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Adependabot+updated%3A2023-06-13..2024-03-28&type=Issues) | [@dolfinus](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Adolfinus+updated%3A2023-06-13..2024-03-28&type=Issues) | [@fcollonval](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Afcollonval+updated%3A2023-06-13..2024-03-28&type=Issues) | [@felder](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Afelder+updated%3A2023-06-13..2024-03-28&type=Issues) | [@haarli](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Ahaarli+updated%3A2023-06-13..2024-03-28&type=Issues) | [@hiroyuki-sato](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Ahiroyuki-sato+updated%3A2023-06-13..2024-03-28&type=Issues) | [@manics](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Amanics+updated%3A2023-06-13..2024-03-28&type=Issues) | [@mathieuboudreau](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Amathieuboudreau+updated%3A2023-06-13..2024-03-28&type=Issues) | [@minrk](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Aminrk+updated%3A2023-06-13..2024-03-28&type=Issues) | [@pre-commit-ci](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Apre-commit-ci+updated%3A2023-06-13..2024-03-28&type=Issues) | [@rgaiacs](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Argaiacs+updated%3A2023-06-13..2024-03-28&type=Issues) | [@ryanlovett](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Aryanlovett+updated%3A2023-06-13..2024-03-28&type=Issues) | [@sgaist](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Asgaist+updated%3A2023-06-13..2024-03-28&type=Issues) | [@SylvainCorlay](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3ASylvainCorlay+updated%3A2023-06-13..2024-03-28&type=Issues) | [@TimoRoth](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3ATimoRoth+updated%3A2023-06-13..2024-03-28&type=Issues) | [@twtw](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Atwtw+updated%3A2023-06-13..2024-03-28&type=Issues) | [@welcome](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Awelcome+updated%3A2023-06-13..2024-03-28&type=Issues) | [@yamaton](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Ayamaton+updated%3A2023-06-13..2024-03-28&type=Issues) | [@yuvipanda](https://github.com/search?q=repo%3Ajupyterhub%2Frepo2docker+involves%3Ayuvipanda+updated%3A2023-06-13..2024-03-28&type=Issues)
|
||||
|
||||
## Version 2023.06.0
|
||||
|
||||
([full changelog](https://github.com/jupyterhub/repo2docker/compare/2022.10.0...2023.06.0))
|
||||
|
|
|
@ -2,6 +2,7 @@ import argparse
|
|||
import logging
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from . import __version__
|
||||
from .app import Repo2Docker
|
||||
|
@ -282,6 +283,22 @@ def get_argparser():
|
|||
help=Repo2Docker.engine.help,
|
||||
)
|
||||
|
||||
argparser.add_argument(
|
||||
"--extra-ignore-file",
|
||||
dest="extra_ignore_file",
|
||||
type=Path,
|
||||
help=Repo2Docker.extra_ignore_file.help,
|
||||
)
|
||||
|
||||
argparser.add_argument(
|
||||
"--ignore-file-strategy",
|
||||
dest="ignore_file_strategy",
|
||||
type=str,
|
||||
choices=Repo2Docker.ignore_file_strategy.values,
|
||||
default=Repo2Docker.ignore_file_strategy.default_value,
|
||||
help=Repo2Docker.ignore_file_strategy.help,
|
||||
)
|
||||
|
||||
return argparser
|
||||
|
||||
|
||||
|
@ -464,6 +481,15 @@ def make_r2d(argv=None):
|
|||
if args.target_repo_dir:
|
||||
r2d.target_repo_dir = args.target_repo_dir
|
||||
|
||||
if args.extra_ignore_file is not None:
|
||||
if not args.extra_ignore_file.exists():
|
||||
print(f"The ignore file {args.extra_ignore_file} does not exist")
|
||||
sys.exit(1)
|
||||
r2d.extra_ignore_file = str(args.extra_ignore_file.resolve())
|
||||
|
||||
if args.ignore_file_strategy is not None:
|
||||
r2d.ignore_file_strategy = args.ignore_file_strategy
|
||||
|
||||
return r2d
|
||||
|
||||
|
||||
|
|
|
@ -22,13 +22,14 @@ from urllib.parse import urlparse
|
|||
import entrypoints
|
||||
import escapism
|
||||
from pythonjsonlogger import jsonlogger
|
||||
from traitlets import Any, Bool, Dict, Int, List, Unicode, default, observe
|
||||
from traitlets import Any, Bool, Dict, Enum, Int, List, Unicode, default, observe
|
||||
from traitlets.config import Application
|
||||
|
||||
from . import __version__, contentproviders
|
||||
from .buildpacks import (
|
||||
CondaBuildPack,
|
||||
DockerBuildPack,
|
||||
ExcludesStrategy,
|
||||
JuliaProjectTomlBuildPack,
|
||||
JuliaRequireBuildPack,
|
||||
LegacyBinderDockerBuildPack,
|
||||
|
@ -463,6 +464,32 @@ class Repo2Docker(Application):
|
|||
""",
|
||||
)
|
||||
|
||||
extra_ignore_file = Unicode(
|
||||
"",
|
||||
config=True,
|
||||
help="""
|
||||
Path to an additional .dockerignore or .containerignore file to be applied
|
||||
when building an image.
|
||||
|
||||
Depending on the strategy selected the content of the file will replace,
|
||||
be merged or be ignored.
|
||||
""",
|
||||
)
|
||||
|
||||
ignore_file_strategy = Enum(
|
||||
ExcludesStrategy.values(),
|
||||
config=True,
|
||||
default_value=ExcludesStrategy.THEIRS.value,
|
||||
help="""
|
||||
Strategy to use if an extra ignore file is passed:
|
||||
- merge means that the content of the extra ignore file will be merged
|
||||
with the ignore file contained in the repository (if any)
|
||||
- ours means that the extra ignore file content will be used in any case
|
||||
- theirs means that if there is an ignore file in the repository, the
|
||||
extra ignore file will not be used.
|
||||
""",
|
||||
)
|
||||
|
||||
def get_engine(self):
|
||||
"""Return an instance of the container engine.
|
||||
|
||||
|
@ -861,6 +888,10 @@ class Repo2Docker(Application):
|
|||
self.cache_from,
|
||||
self.extra_build_kwargs,
|
||||
platform=self.platform,
|
||||
extra_ignore_file=self.extra_ignore_file,
|
||||
ignore_file_strategy=ExcludesStrategy(
|
||||
self.ignore_file_strategy
|
||||
),
|
||||
):
|
||||
if docker_client.string_output:
|
||||
self.log.info(l, extra=dict(phase=R2dState.BUILDING))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from .base import BaseImage, BuildPack
|
||||
from .base import BaseImage, BuildPack, ExcludesStrategy
|
||||
from .conda import CondaBuildPack
|
||||
from .docker import DockerBuildPack
|
||||
from .julia import JuliaProjectTomlBuildPack, JuliaRequireBuildPack
|
||||
|
|
|
@ -7,6 +7,7 @@ import string
|
|||
import sys
|
||||
import tarfile
|
||||
import textwrap
|
||||
from enum import Enum
|
||||
from functools import lru_cache
|
||||
|
||||
import escapism
|
||||
|
@ -205,6 +206,16 @@ HERE = os.path.dirname(os.path.abspath(__file__))
|
|||
DEFAULT_NB_UID = 1000
|
||||
|
||||
|
||||
class ExcludesStrategy(Enum):
|
||||
THEIRS = "theirs"
|
||||
OURS = "ours"
|
||||
MERGE = "merge"
|
||||
|
||||
@classmethod
|
||||
def values(cls):
|
||||
return [item.value for item in cls]
|
||||
|
||||
|
||||
class BuildPack:
|
||||
"""
|
||||
A composable BuildPack.
|
||||
|
@ -582,6 +593,8 @@ class BuildPack:
|
|||
cache_from,
|
||||
extra_build_kwargs,
|
||||
platform=None,
|
||||
extra_ignore_file=None,
|
||||
ignore_file_strategy=ExcludesStrategy.THEIRS,
|
||||
):
|
||||
tarf = io.BytesIO()
|
||||
tar = tarfile.open(fileobj=tarf, mode="w")
|
||||
|
@ -609,24 +622,35 @@ class BuildPack:
|
|||
for fname in ("repo2docker-entrypoint", "python3-login"):
|
||||
tar.add(os.path.join(HERE, fname), fname, filter=_filter_tar)
|
||||
|
||||
exclude = []
|
||||
|
||||
for ignore_file_name in [".dockerignore", ".containerignore"]:
|
||||
ignore_file_name = self.binder_path(ignore_file_name)
|
||||
if os.path.exists(ignore_file_name):
|
||||
with open(ignore_file_name) as ignore_file:
|
||||
def _read_excludes(filepath):
|
||||
with open(filepath) as ignore_file:
|
||||
cleaned_lines = [
|
||||
line.strip() for line in ignore_file.read().splitlines()
|
||||
]
|
||||
exclude.extend(
|
||||
[
|
||||
line
|
||||
for line in cleaned_lines
|
||||
if line != "" and line[0] != "#"
|
||||
]
|
||||
)
|
||||
return [line for line in cleaned_lines if line != "" and line[0] != "#"]
|
||||
|
||||
files_to_add = exclude_paths(".", exclude)
|
||||
extra_excludes = []
|
||||
if extra_ignore_file:
|
||||
extra_excludes = _read_excludes(extra_ignore_file)
|
||||
|
||||
excludes = []
|
||||
for ignore_file_name in [".dockerignore", ".containerignore"]:
|
||||
ignore_file_name = self.binder_path(ignore_file_name)
|
||||
if os.path.exists(ignore_file_name):
|
||||
excludes.extend(_read_excludes(ignore_file_name))
|
||||
|
||||
if extra_ignore_file is not None:
|
||||
if ignore_file_strategy == ExcludesStrategy.OURS:
|
||||
excludes = extra_excludes
|
||||
elif ignore_file_strategy == ExcludesStrategy.MERGE:
|
||||
excludes.extend(extra_excludes)
|
||||
else:
|
||||
# ignore means that if an ignore file exist, its content is used
|
||||
# otherwise, the extra exclude
|
||||
if not excludes:
|
||||
excludes = extra_excludes
|
||||
|
||||
files_to_add = exclude_paths(".", excludes)
|
||||
|
||||
if files_to_add:
|
||||
for item in files_to_add:
|
||||
|
|
|
@ -5,8 +5,8 @@ set -ex
|
|||
|
||||
cd $(dirname $0)
|
||||
|
||||
export MAMBA_VERSION=1.5.1
|
||||
export CONDA_VERSION=23.7.4
|
||||
export MAMBA_VERSION=1.5.7
|
||||
export CONDA_VERSION=24.3.0
|
||||
|
||||
URL="https://anaconda.org/conda-forge/micromamba/${MAMBA_VERSION}/download/${CONDA_PLATFORM}/micromamba-${MAMBA_VERSION}-0.tar.bz2"
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import os
|
|||
|
||||
import docker
|
||||
|
||||
from .base import BuildPack
|
||||
from .base import BuildPack, ExcludesStrategy
|
||||
|
||||
|
||||
class DockerBuildPack(BuildPack):
|
||||
|
@ -32,6 +32,8 @@ class DockerBuildPack(BuildPack):
|
|||
cache_from,
|
||||
extra_build_kwargs,
|
||||
platform=None,
|
||||
extra_ignore_file=None,
|
||||
ignore_file_strategy=ExcludesStrategy.THEIRS,
|
||||
):
|
||||
"""Build a Docker image based on the Dockerfile in the source repo."""
|
||||
# If you work on this bit of code check the corresponding code in
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
# Docker compatible ignore file
|
||||
from-extra-ignore
|
|
@ -0,0 +1 @@
|
|||
from-dockerignore
|
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- python=3.11
|
|
@ -0,0 +1 @@
|
|||
Must be ignored from .dockerignore file
|
|
@ -0,0 +1 @@
|
|||
Must be ignored from extra ignore file
|
|
@ -0,0 +1,5 @@
|
|||
# This file is respected by repo2docker's test suite, but not repo2docker
|
||||
# itself. It is used solely to help us test repo2docker's command line flags.
|
||||
#
|
||||
- --extra-ignore-file=tests/conda/ignore-file
|
||||
- --ignore-file-strategy=merge
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import pathlib
|
||||
|
||||
assert not pathlib.Path("from-dockerignore").exists()
|
||||
assert not pathlib.Path("from-extra-ignore").exists()
|
|
@ -0,0 +1 @@
|
|||
from-dockerignore
|
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- python=3.11
|
|
@ -0,0 +1 @@
|
|||
Must not be ignored because of ours strategy and extra ignore file does not contain it.
|
|
@ -0,0 +1 @@
|
|||
Must be ignored
|
|
@ -0,0 +1,5 @@
|
|||
# This file is respected by repo2docker's test suite, but not repo2docker
|
||||
# itself. It is used solely to help us test repo2docker's command line flags.
|
||||
#
|
||||
- --extra-ignore-file=tests/conda/ignore-file
|
||||
- --ignore-file-strategy=ours
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import pathlib
|
||||
|
||||
assert pathlib.Path("from-dockerignore").exists()
|
||||
assert not pathlib.Path("from-extra-ignore").exists()
|
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- python=3.11
|
|
@ -0,0 +1 @@
|
|||
No docker ignore so should still appear
|
|
@ -0,0 +1 @@
|
|||
Must be ignored because of extra ignore file
|
|
@ -0,0 +1,5 @@
|
|||
# This file is respected by repo2docker's test suite, but not repo2docker
|
||||
# itself. It is used solely to help us test repo2docker's command line flags.
|
||||
#
|
||||
- --extra-ignore-file=tests/conda/ignore-file
|
||||
- --ignore-file-strategy=theirs
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import pathlib
|
||||
|
||||
assert pathlib.Path("from-dockerignore").exists()
|
||||
assert not pathlib.Path("from-extra-ignore").exists()
|
|
@ -0,0 +1 @@
|
|||
from-dockerignore
|
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- python=3.11
|
|
@ -0,0 +1 @@
|
|||
Must be ignored from .dockerignore file
|
|
@ -0,0 +1 @@
|
|||
Shall be present due to strategy being theirs and this file does not appear in .dockerignore
|
|
@ -0,0 +1,5 @@
|
|||
# This file is respected by repo2docker's test suite, but not repo2docker
|
||||
# itself. It is used solely to help us test repo2docker's command line flags.
|
||||
#
|
||||
- --extra-ignore-file=tests/conda/ignore-file
|
||||
- --ignore-file-strategy=theirs
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import pathlib
|
||||
|
||||
assert not pathlib.Path("from-dockerignore").exists()
|
||||
assert pathlib.Path("from-extra-ignore").exists()
|
|
@ -16,13 +16,13 @@ v = out.split()[1]
|
|||
assert v[:3] == "3.5", out
|
||||
|
||||
out = sh(["micromamba", "--version"])
|
||||
assert out == "1.5.1", out
|
||||
assert out == "1.5.7", out
|
||||
|
||||
out = sh(["mamba", "--version"])
|
||||
assert (
|
||||
out
|
||||
== """mamba 1.5.1
|
||||
conda 23.7.4"""
|
||||
== """mamba 1.5.7
|
||||
conda 24.3.0"""
|
||||
), out
|
||||
|
||||
sh([kernel_python, "-c", "import numpy"])
|
||||
|
|
|
@ -129,3 +129,8 @@ def test_config_priority(tmp_path, trait, arg, default):
|
|||
assert getattr(r2d, trait) == "config"
|
||||
r2d = make_r2d(["--config", config_file, arg, "cli", "."])
|
||||
assert getattr(r2d, trait) == "cli"
|
||||
|
||||
|
||||
def test_non_existing_exclude_file():
|
||||
with pytest.raises(SystemExit):
|
||||
make_r2d(["--extra-ignore-file", "does-not-exist"])
|
||||
|
|
|
@ -247,3 +247,28 @@ def test_docker_no_build_success(temp_cwd):
|
|||
args_list = ["--no-build", "--no-run"]
|
||||
|
||||
assert validate_arguments(builddir, args_list, disable_dockerd=True)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"strategy, is_valid",
|
||||
[
|
||||
("theirs", True),
|
||||
("ours", True),
|
||||
("merge", True),
|
||||
("invalid", False),
|
||||
],
|
||||
)
|
||||
def test_ignore_file_strategy(temp_cwd, strategy, is_valid):
|
||||
""" """
|
||||
|
||||
args_list = ["--no-build", "--no-run", "--ignore-file-strategy", strategy]
|
||||
|
||||
assert (
|
||||
validate_arguments(
|
||||
builddir,
|
||||
args_list,
|
||||
"--ignore-file-strategy: invalid choice: 'invalid' (choose from 'theirs', 'ours', 'merge')",
|
||||
disable_dockerd=True,
|
||||
)
|
||||
== is_valid
|
||||
)
|
||||
|
|
Ładowanie…
Reference in New Issue