From: Marek SzwaƂkiewicz Date: Fri, 6 Jun 2025 10:37:00 +0000 (+0200) Subject: [INT] Add docker image for testkube custom executor X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=7191df8920bdeb2de9e315af71dcff04c04237fc;p=integration%2Fxtesting.git [INT] Add docker image for testkube custom executor Adding a new docker image that will be used as a base for a custom executor in testkube. Dockerfile was simplified a bit to match capabilities of docker v20. Issue-ID: INT-2320 Change-Id: I61b236aa6d22e7340ea4ce0dadc5e9cff2346bf2 Signed-off-by: Marek SzwaƂkiewicz --- diff --git a/testkube-executor/.dockerignore b/testkube-executor/.dockerignore new file mode 100644 index 0000000..644f698 --- /dev/null +++ b/testkube-executor/.dockerignore @@ -0,0 +1,33 @@ +.git +.gitignore +README.md +Dockerfile +.dockerignore +.pytest_cache +.coverage +.nyc_output +node_modules +npm-debug.log +*.log +.DS_Store +__pycache__ +*.pyc +*.pyo +*.pyd +.Python +env/ +venv/ +.venv/ +pip-log.txt +pip-delete-this-directory.txt +.tox +.cache +.pytest_cache +nosetests.xml +coverage.xml +*.cover +*.log +.git +.mypy_cache +.pytest_cache +.hypothesis diff --git a/testkube-executor/README.md b/testkube-executor/README.md new file mode 100644 index 0000000..70190f6 --- /dev/null +++ b/testkube-executor/README.md @@ -0,0 +1,71 @@ +# Local Development Setup with Docker + +This README provides instructions for building and running the Docker image locally for development purposes. + +## Building the Docker Image + +### Quick Start + +Build the image with the default configuration: + +```bash +docker build -t onap-testsuite:dev . +``` + +### Custom Build Options + +**Build with a specific ONAP tag:** + +```bash +docker build --build-arg ONAP_TAG="jakarta" -t onap-testsuite:jakarta . +``` + +**Build with BuildKit for improved performance:** + +```bash +DOCKER_BUILDKIT=1 docker build -t onap-testsuite:dev . +``` + +## Running the Development Container + +### Interactive Development Mode + +Start an interactive shell for development work: + +```bash +docker run -it --rm \ + --name onap-dev \ + --volume $(pwd):/workspace \ + onap-testsuite:dev \ + /bin/bash +``` + +**For Windows users (PowerShell):** + +```powershell +docker run -it --rm --name onap-dev --volume ${PWD}:/workspace onap-testsuite:dev /bin/bash +``` + +### Running Tests + +Execute the test suite directly: + +```bash +docker run --rm onap-testsuite:dev run_tests --help +``` + +### Development with Volume Mounts + +Mount your local code for real-time development: + +```bash +docker run -it --rm \ + --name onap-dev \ + --volume $(pwd):/workspace \ + --volume $(pwd)/local-tests:/app/tests \ + --workdir /workspace \ + onap-testsuite:dev \ + /bin/bash +``` + +For more information about ONAP testing, visit the [ONAP Testing Documentation](https://docs.onap.org/projects/onap-integration/en/latest/). diff --git a/testkube-executor/constraints.txt b/testkube-executor/constraints.txt new file mode 100644 index 0000000..9c0369f --- /dev/null +++ b/testkube-executor/constraints.txt @@ -0,0 +1,128 @@ +ansible-runner===2.3.6 +astroid===3.2.4 +attrs===25.3.0 +bashate===2.1.1 +bcrypt===4.3.0 +beautifulsoup4===4.13.4 +behave===1.2.6 +behave-html-formatter===0.9.10 +boto3===1.7.84 +botocore===1.10.84 +cachetools===5.5.2 +certifi===2025.4.26 +cffi===1.17.1 +charset-normalizer===3.4.2 +click===8.1.8 +colorama===0.4.6 +coverage===7.6.1 +cryptography===45.0.3 +decorator===5.2.1 +deepdiff===8.4.2 +dill===0.4.0 +dnspython===2.6.1 +docutils===0.20.1 +dogpile.cache===1.3.4 +durationpy===0.10 +exceptiongroup===1.3.0 +google-auth===2.40.2 +h11===0.16.0 +idna===3.10 +importlib-metadata===6.2.1 +importlib_resources===6.4.5 +iniconfig===2.1.0 +iso8601===2.1.0 +isort===5.13.2 +Jinja2===3.1.6 +jmespath===0.10.0 +json5===0.12.0 +jsonpatch===1.33 +jsonpath-ng===1.7.0 +jsonpointer===3.0.0 +jsonschema===4.23.0 +jsonschema-specifications===2023.12.1 +junitxml===0.7 +keystoneauth1===5.8.1 +kubernetes===32.0.1 +lockfile===0.12.2 +lxml===5.4.0 +MarkupSafe===2.1.5 +mccabe===0.7.0 +mock===5.2.0 +netifaces===0.11.0 +nose===1.3.7 +oauthlib===3.2.2 +openstacksdk===4.0.1 +orderly-set===5.4.1 +os-service-types===1.7.0 +os-testr===3.0.0 +outcome===1.3.0.post0 +oyaml===1.0 +packaging===25.0 +paramiko===3.5.1 +parse===1.20.2 +parse_type===0.6.4 +pathspec===0.12.1 +pbr===6.1.1 +pexpect===4.9.0 +pkgutil_resolve_name===1.3.10 +platformdirs===4.3.6 +pluggy===1.5.0 +ply===3.11 +prettytable===3.11.0 +ptyprocess===0.7.0 +pyasn1===0.6.1 +pyasn1_modules===0.4.2 +pycparser===2.22 +pylint===3.2.7 +PyNaCl===1.5.0 +PySocks===1.7.1 +pytest===8.3.5 +pytest-html===4.1.1 +pytest-metadata===3.1.1 +python-daemon===3.1.2 +python-dateutil===2.9.0.post0 +python-subunit===1.4.4 +pytz===2025.2 +PyYAML===6.0.2 +referencing===0.35.1 +requests===2.32.3 +requests-oauthlib===2.0.0 +requestsexceptions===1.4.0 +robotframework===7.3 +robotframework-archivelibrary===0.4.3 +robotframework-assertion-engine===3.0.3 +robotframework-databaselibrary===2.1.3 +robotframework-ftplibrary===1.9 +robotframework-httplibrary===0.4.2 +robotframework-jsonlibrary===0.5 +robotframework-pythonlibcore===4.4.1 +robotframework-requests===0.9.3 +robotframework-seleniumlibrary===6.7.1 +robotframework-sshlibrary===3.8.0 +rpds-py===0.20.1 +rsa===4.9.1 +s3transfer===0.1.13 +scp===0.15.0 +selenium===4.27.1 +simplejson===3.20.1 +six===1.17.0 +sniffio===1.3.1 +sortedcontainers===2.4.0 +soupsieve===2.7 +stevedore===5.3.0 +testtools===2.7.2 +tomli===2.2.1 +tomlkit===0.13.2 +trio===0.27.0 +trio-websocket===0.12.2 +typing_extensions===4.13.2 +urllib3===2.2.3 +waitress===3.0.0 +wcwidth===0.2.13 +WebOb===1.8.9 +websocket-client===1.8.0 +WebTest===3.0.1 +wsproto===1.2.0 +xtesting===0.98.0 +yamllint===1.35.1 +zipp===3.20.2 \ No newline at end of file diff --git a/testkube-executor/docker/Dockerfile b/testkube-executor/docker/Dockerfile new file mode 100644 index 0000000..647ebd9 --- /dev/null +++ b/testkube-executor/docker/Dockerfile @@ -0,0 +1,61 @@ +# syntax=docker/dockerfile:1 +# Build stage -------------------------------------- +FROM python:3.9-slim as builder + +ARG ONAP_TAG="master" + +RUN apt-get update && apt-get install -y --no-install-recommends \ + git \ + gcc \ + g++ \ + make \ + libffi-dev \ + python3-dev \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /build + +COPY requirements.txt constraints.txt ./ + +RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \ + pip install --no-cache-dir -c constraints.txt -r requirements.txt + +RUN git clone --depth 1 --single-branch -b ${ONAP_TAG} https://git.onap.org/testsuite /var/opt/ONAP && \ + git clone --depth 1 --single-branch -b ${ONAP_TAG} https://git.onap.org/testsuite/python-testing-utils /src/testing-utils && \ + git clone --depth 1 --single-branch -b ${ONAP_TAG} https://git.onap.org/demo /src/demo + +RUN pip install --no-cache-dir -c constraints.txt -e /src/testing-utils/robotframework-onap + +# Run stage -------------------------------------- +FROM python:3.9-slim as runner + +RUN groupadd --gid 1000 appuser && \ + useradd --uid 1000 --gid 1000 --create-home --shell /bin/bash appuser + +WORKDIR /app + +# Copy files from builder stage +COPY --from=builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages +COPY --from=builder /usr/local/bin /usr/local/bin +COPY --from=builder /var/opt/ONAP /var/opt/ONAP +COPY --from=builder /src /src + +RUN apt-get update && apt-get install -y --no-install-recommends \ + git \ + && rm -rf /var/lib/apt/lists/* \ + && apt-get clean + +RUN chown -R appuser:appuser /app /var/opt/ONAP /src +USER appuser + +# Fake healthcheck - fix later +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ + CMD python -c "import sys; sys.exit(0)" || exit 1 + +# I'm not sure how this python buffer/bytecode helps but +# it's supposed to be a "best practice" and it works +ENV PYTHONPATH="/src/testing-utils:/src/demo:${PYTHONPATH}" \ + PYTHONUNBUFFERED=1 \ + PYTHONDONTWRITEBYTECODE=1 + +CMD ["run_tests", "--help"] diff --git a/testkube-executor/requirements.txt b/testkube-executor/requirements.txt new file mode 100644 index 0000000..23103f4 --- /dev/null +++ b/testkube-executor/requirements.txt @@ -0,0 +1,32 @@ +bashate +colorama +coverage +deepdiff +dnspython +json5 +kubernetes +mock +nose +openstacksdk +oyaml +pylint +pytz +pyyaml +requests +requests[socks] +robotframework +robotframework-archivelibrary +robotframework-databaselibrary +# robotframework-extendedselenium2library # Deprecated, seleniumlibrary should cover all the functionality +robotframework-ftplibrary +robotframework-httplibrary +robotframework-jsonlibrary +robotframework-requests +# robotframework-selenium2library # Deprecated, seleniumlibrary should cover all the functionality +robotframework-seleniumlibrary +robotframework-sshlibrary +selenium +simplejson +urllib3 +xtesting +yamllint