blob: 3b17deef02ed30813c537cb90efcc9979e59bfe1 [file] [log] [blame]
mesaj75ec8902025-06-10 17:16:47 +02001# syntax=docker/dockerfile:1
2#######################################################################################
3# Copyright ETSI Contributors and Others.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14# implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#######################################################################################
18
19
20#######################
21# Stage 1: Base Stage #
22#######################
23
24FROM python:3.10-alpine AS base
25
26ENV PYTHONUNBUFFERED=1 \
27 PYTHONDONTWRITEBYTECODE=1 \
28 PIP_DISABLE_PIP_VERSION_CHECK=1
29
30
31############################################################################################################################################################
32
33##########################
34# Stage 2: Builder Stage #
35##########################
36
37FROM base AS builder
38
caviedesjaeebf1f2026-01-09 11:46:40 +010039RUN apk add --no-cache --virtual .build-deps \
mesaj75ec8902025-06-10 17:16:47 +020040 build-base gcc \
41 musl-dev \
42 libffi-dev \
43 libmagic \
44 openssl-dev \
45 curl \
46 git \
47 jq \
48 file \
49 openssh-client \
50 openssh-keygen \
51 bash \
52 ca-certificates
53
54WORKDIR /app/tests
55
56# Isolate dependencies in a venv
57RUN python -m venv /app/tests/.venv
58ENV PATH="/app/tests/.venv/bin:$PATH"
59
60# Instalar kubectl (versión 1.30)
61RUN curl -LO "https://dl.k8s.io/release/v1.30.13/bin/linux/amd64/kubectl" && \
62 install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \
63 rm kubectl
64
65# Instalar Google Cloud SDK (versión simplificada para Alpine)
66RUN curl -sSL https://sdk.cloud.google.com > /tmp/install.sh && \
67 bash /tmp/install.sh --disable-prompts --install-dir=/local && \
68 rm /tmp/install.sh
69#ENV PATH $PATH:/local/google-cloud-sdk/bin
70
71# Instalar Azure CLI (versión simplificada para Alpine)
72RUN apk add --no-cache py3-pip && \
73 pip install --no-cache-dir azure-cli
74
75# Add vCluster CLI
garciadeblasa2c60b12025-12-16 17:56:14 +010076ENV VCLUSTER_VERSION "v0.30.1"
mesaj75ec8902025-06-10 17:16:47 +020077RUN curl -L -o /tmp/vcluster "https://github.com/loft-sh/vcluster/releases/download/${VCLUSTER_VERSION}/vcluster-linux-amd64" \
78 && install -c -m 0755 /tmp/vcluster /usr/local/bin \
79 && rm -f /tmp/vcluster
80# Copy vCluster configuration
81COPY configs/vcluster.yaml /etc/vcluster.yaml
82
83ARG IM_GERRIT_REFSPEC=master
caviedesjaeebf1f2026-01-09 11:46:40 +010084RUN git clone --filter=blob:none --tags https://osm.etsi.org/gerrit/osm/IM.git /tmp/osm-im && \
mesaj75ec8902025-06-10 17:16:47 +020085 cd /tmp/osm-im && \
86 git fetch origin ${IM_GERRIT_REFSPEC} && \
87 git checkout FETCH_HEAD && \
88 cd - && \
89 pip install --no-cache-dir -r /tmp/osm-im/requirements.txt && \
90 pip install /tmp/osm-im
91
92
93ARG CLIENT_GERRIT_REFSPEC=master
caviedesjaeebf1f2026-01-09 11:46:40 +010094RUN git clone --filter=blob:none --tags https://osm.etsi.org/gerrit/osm/osmclient.git /tmp/osmclient && \
mesaj75ec8902025-06-10 17:16:47 +020095 cd /tmp/osmclient && \
96 git fetch origin ${CLIENT_GERRIT_REFSPEC} && \
97 git checkout FETCH_HEAD && \
98 cd - && \
99 pip install --no-cache-dir -r /tmp/osmclient/requirements.txt && \
100 pip install /tmp/osmclient
101
102COPY . /tmp/osm-tests/
103
104# Install test requirements leveraging BuildKit cache
105RUN --mount=type=cache,target=/root/.cache/pip \
106 cd /tmp/osm-tests && \
107 pip install --no-cache-dir -r /tmp/osm-tests/requirements.txt && \
108 pip install /tmp/osm-tests && \
109 cd -
110
111RUN mv /tmp/osm-tests/robot-systest /robot-systest/ && \
112 mv /tmp/osm-tests/cloud-scripts /robot-systest/ && \
113 mv /tmp/osm-tests/conformance-tests/ /robot-systest/ && \
114 mv /tmp/osm-tests/charm.sh /usr/sbin/charm
115
116WORKDIR /robot-systest
117
118# Folder where Robot tests are stored
119ENV ROBOT_DEVOPS_FOLDER=/robot-systest
120
121# Folder to save alternative DUT environments (optional)
122ENV ENVIRONMENTS_FOLDER=environments
123
124# Folder where all required packages are stored
125ENV PACKAGES_FOLDER=/robot-systest/osm-packages
126
127# Folder where test results should be exported
128ENV ROBOT_REPORT_FOLDER=/robot-systest/results
129
130# Kubeconfig file
131ENV K8S_CREDENTIALS=/root/.kube/config
132
133# Kubeconfig file of the existing cluster for Gitops tests
134ENV CLUSTER_KUBECONFIG_CREDENTIALS=/robot-systest/cluster-kubeconfig.yaml
135
136# OSM RSA file
137ENV OSM_RSA_FILE=/root/osm_id_rsa
138
139ENV LC_ALL=C.UTF-8
140ENV LANG=C.UTF-8
141
142ENTRYPOINT [ "/robot-systest/run_test.sh"]