| # syntax=docker/dockerfile:1 |
| ####################################################################################### |
| # Copyright ETSI Contributors and Others. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| # implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| ####################################################################################### |
| |
| |
| ####################### |
| # Stage 1: Base Stage # |
| ####################### |
| |
| FROM python:3.10-alpine AS base |
| |
| ENV PYTHONUNBUFFERED=1 \ |
| PYTHONDONTWRITEBYTECODE=1 \ |
| PIP_DISABLE_PIP_VERSION_CHECK=1 |
| |
| |
| ############################################################################################################################################################ |
| |
| ########################## |
| # Stage 2: Builder Stage # |
| ########################## |
| |
| FROM base AS builder |
| |
| RUN apk add --no-cache --virtual .build-deps \ |
| build-base gcc \ |
| musl-dev \ |
| libffi-dev \ |
| libmagic \ |
| openssl-dev \ |
| curl \ |
| git \ |
| jq \ |
| file \ |
| openssh-client \ |
| openssh-keygen \ |
| bash \ |
| ca-certificates |
| |
| WORKDIR /app/tests |
| |
| # Isolate dependencies in a venv |
| RUN python -m venv /app/tests/.venv |
| ENV PATH="/app/tests/.venv/bin:$PATH" |
| |
| # Instalar kubectl (versión 1.30) |
| RUN curl -LO "https://dl.k8s.io/release/v1.30.13/bin/linux/amd64/kubectl" && \ |
| install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \ |
| rm kubectl |
| |
| # Instalar Google Cloud SDK (versión simplificada para Alpine) |
| RUN curl -sSL https://sdk.cloud.google.com > /tmp/install.sh && \ |
| bash /tmp/install.sh --disable-prompts --install-dir=/local && \ |
| rm /tmp/install.sh |
| #ENV PATH $PATH:/local/google-cloud-sdk/bin |
| |
| # Instalar Azure CLI (versión simplificada para Alpine) |
| RUN apk add --no-cache py3-pip && \ |
| pip install --no-cache-dir azure-cli |
| |
| # Add vCluster CLI |
| ENV VCLUSTER_VERSION="v0.30.4" |
| RUN curl -L -o /tmp/vcluster "https://github.com/loft-sh/vcluster/releases/download/${VCLUSTER_VERSION}/vcluster-linux-amd64" \ |
| && install -c -m 0755 /tmp/vcluster /usr/local/bin \ |
| && rm -f /tmp/vcluster |
| # Copy vCluster configuration |
| COPY configs/vcluster.yaml /etc/vcluster.yaml |
| |
| # Add FluxCD CLI Client |
| ENV FLUX_CLI_VERSION="2.4.0" |
| RUN curl -s https://fluxcd.io/install.sh | FLUX_VERSION=${FLUX_CLI_VERSION} bash |
| |
| ARG IM_GERRIT_REFSPEC=master |
| RUN git clone --filter=blob:none --tags https://osm.etsi.org/gerrit/osm/IM.git /tmp/osm-im && \ |
| cd /tmp/osm-im && \ |
| git fetch origin ${IM_GERRIT_REFSPEC} && \ |
| git checkout FETCH_HEAD && \ |
| cd - && \ |
| pip install --no-cache-dir -r /tmp/osm-im/requirements.txt && \ |
| pip install /tmp/osm-im |
| |
| |
| ARG CLIENT_GERRIT_REFSPEC=master |
| RUN git clone --filter=blob:none --tags https://osm.etsi.org/gerrit/osm/osmclient.git /tmp/osmclient && \ |
| cd /tmp/osmclient && \ |
| git fetch origin ${CLIENT_GERRIT_REFSPEC} && \ |
| git checkout FETCH_HEAD && \ |
| cd - && \ |
| pip install --no-cache-dir -r /tmp/osmclient/requirements.txt && \ |
| pip install /tmp/osmclient |
| |
| COPY . /tmp/osm-tests/ |
| |
| # Install test requirements leveraging BuildKit cache |
| RUN cd /tmp/osm-tests && \ |
| pip install --no-cache-dir -r /tmp/osm-tests/requirements.txt && \ |
| pip install /tmp/osm-tests && \ |
| cd - |
| |
| RUN mv /tmp/osm-tests/robot-systest /robot-systest/ && \ |
| mv /tmp/osm-tests/cloud-scripts /robot-systest/ && \ |
| mv /tmp/osm-tests/conformance-tests/ /robot-systest/ && \ |
| mv /tmp/osm-tests/charm.sh /usr/sbin/charm |
| |
| # Download osm-packages repository for tests |
| ARG CACHE_DATE=not_a_date |
| RUN git clone \ |
| https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages.git \ |
| --recurse-submodules \ |
| /robot-systest/osm-packages |
| |
| WORKDIR /robot-systest |
| |
| # Folder where Robot tests are stored |
| ENV ROBOT_DEVOPS_FOLDER=/robot-systest |
| |
| # Folder to save alternative DUT environments (optional) |
| ENV ENVIRONMENTS_FOLDER=environments |
| |
| # Folder where all required packages are stored |
| ENV PACKAGES_FOLDER=/robot-systest/osm-packages |
| |
| # Folder where test results should be exported |
| ENV ROBOT_REPORT_FOLDER=/robot-systest/results |
| |
| # Kubeconfig file |
| ENV K8S_CREDENTIALS=/root/.kube/config |
| |
| # Kubeconfig file of the existing cluster for Gitops tests |
| ENV CLUSTER_KUBECONFIG_CREDENTIALS=/robot-systest/cluster-kubeconfig.yaml |
| |
| # OSM RSA file |
| ENV OSM_RSA_FILE=/root/osm_id_rsa |
| |
| ENV LC_ALL=C.UTF-8 |
| ENV LANG=C.UTF-8 |
| |
| RUN cat /dev/zero | ssh-keygen -t rsa -q -N "" > /dev/null |
| |
| ENTRYPOINT [ "/bin/sh" ] |