blob: a81dbbca2c8b7db38b978a01a2a6a25a1921e403 [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
caviedesj316c2422026-01-15 13:25:26 +010076ENV VCLUSTER_VERSION="v0.30.4"
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
caviedesjc0591a52026-01-20 11:09:00 +010083# Add FluxCD CLI Client
84ENV FLUX_CLI_VERSION="2.4.0"
85RUN curl -s https://fluxcd.io/install.sh | FLUX_VERSION=${FLUX_CLI_VERSION} bash
86
mesaj75ec8902025-06-10 17:16:47 +020087ARG IM_GERRIT_REFSPEC=master
caviedesjaeebf1f2026-01-09 11:46:40 +010088RUN git clone --filter=blob:none --tags https://osm.etsi.org/gerrit/osm/IM.git /tmp/osm-im && \
mesaj75ec8902025-06-10 17:16:47 +020089 cd /tmp/osm-im && \
90 git fetch origin ${IM_GERRIT_REFSPEC} && \
91 git checkout FETCH_HEAD && \
92 cd - && \
93 pip install --no-cache-dir -r /tmp/osm-im/requirements.txt && \
94 pip install /tmp/osm-im
95
96
97ARG CLIENT_GERRIT_REFSPEC=master
caviedesjaeebf1f2026-01-09 11:46:40 +010098RUN git clone --filter=blob:none --tags https://osm.etsi.org/gerrit/osm/osmclient.git /tmp/osmclient && \
mesaj75ec8902025-06-10 17:16:47 +020099 cd /tmp/osmclient && \
100 git fetch origin ${CLIENT_GERRIT_REFSPEC} && \
101 git checkout FETCH_HEAD && \
102 cd - && \
103 pip install --no-cache-dir -r /tmp/osmclient/requirements.txt && \
104 pip install /tmp/osmclient
105
106COPY . /tmp/osm-tests/
107
108# Install test requirements leveraging BuildKit cache
caviedesja6be66d2026-01-15 14:12:38 +0100109RUN cd /tmp/osm-tests && \
mesaj75ec8902025-06-10 17:16:47 +0200110 pip install --no-cache-dir -r /tmp/osm-tests/requirements.txt && \
111 pip install /tmp/osm-tests && \
112 cd -
113
114RUN mv /tmp/osm-tests/robot-systest /robot-systest/ && \
115 mv /tmp/osm-tests/cloud-scripts /robot-systest/ && \
116 mv /tmp/osm-tests/conformance-tests/ /robot-systest/ && \
117 mv /tmp/osm-tests/charm.sh /usr/sbin/charm
118
caviedesja6be66d2026-01-15 14:12:38 +0100119# Download osm-packages repository for tests
120ARG CACHE_DATE=not_a_date
121RUN git clone \
122 https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages.git \
123 --recurse-submodules \
124 /robot-systest/osm-packages
125
mesaj75ec8902025-06-10 17:16:47 +0200126WORKDIR /robot-systest
127
128# Folder where Robot tests are stored
129ENV ROBOT_DEVOPS_FOLDER=/robot-systest
130
131# Folder to save alternative DUT environments (optional)
132ENV ENVIRONMENTS_FOLDER=environments
133
134# Folder where all required packages are stored
135ENV PACKAGES_FOLDER=/robot-systest/osm-packages
136
137# Folder where test results should be exported
138ENV ROBOT_REPORT_FOLDER=/robot-systest/results
139
140# Kubeconfig file
141ENV K8S_CREDENTIALS=/root/.kube/config
142
143# Kubeconfig file of the existing cluster for Gitops tests
144ENV CLUSTER_KUBECONFIG_CREDENTIALS=/robot-systest/cluster-kubeconfig.yaml
145
146# OSM RSA file
147ENV OSM_RSA_FILE=/root/osm_id_rsa
148
149ENV LC_ALL=C.UTF-8
150ENV LANG=C.UTF-8
151
garciadeblas25465502026-01-29 16:53:05 +0100152ENTRYPOINT ["/robot-systest/run_test.sh"]