Add jenkins charts
[it/dep.git] / smo-install / tests_oom / oran-tests / templates / job.yaml
1 # Copyright © 2021-2022 AT&T Intellectual Property
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 apiVersion: batch/v1
16 kind: Job
17 metadata:
18   name: {{ .Values.oranTests.name }}
19   labels:
20     tests-name: {{ .Values.oranTests.name }}
21     release: {{ .Release.Name }}
22     chart: {{ .Chart.Name }}
23 spec:
24   manualSelector: true
25   selector:
26     matchLabels:
27       tests-name: {{ .Values.oranTests.name }}
28   template:
29     metadata:
30       labels:
31         tests-name: {{ .Values.oranTests.name }}
32         release: {{ .Release.Name }}
33         chart: {{ .Chart.Name }}
34       annotations:
35         checksum/config: {{ print .Values | sha256sum }}
36     spec:    
37       hostname: "{{ .Values.oranTests.name }}"
38       restartPolicy: Never
39       containers:
40         - name: {{ .Chart.Name }}
41           image: "{{ .Values.image.repository }}/{{ .Values.image.name}}:{{ .Values.image.tag }}"
42           imagePullPolicy: {{ .Values.image.pullPolicy }}
43           tty: true
44           stdin: true
45           envFrom:
46             - configMapRef:
47                 name: {{ .Values.oranTests.name }}-configmapenv
48           securityContext:
49             capabilities:
50               add:
51                 - SYS_ADMIN
52                 - SYS_PTRACE
53           command: ["/bin/sh", "-c"]
54           args:
55             - apt-get update -y;
56               DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata;
57               apt-get install git wget sudo -y;
58               wget https://dl.k8s.io/release/v1.22.0/bin/linux/amd64/kubectl;
59               mv kubectl /usr/bin;
60               chmod a+x /usr/bin/kubectl;
61               kubectl version;
62
63               cd /opt;
64               git clone --recursive "https://github.com/sebdet/oran-deployment.git";
65               cd /opt/oran-deployment;
66               git reset --hard {{ .Values.oranTests.commitId }};
67               /opt/oran-deployment/scripts/layer-0/0-setup-tests-env.sh;
68               /opt/oran-deployment/scripts/layer-0/0-setup-charts-museum.sh;
69               /opt/oran-deployment/scripts/layer-0/0-setup-helm3.sh;
70               /opt/oran-deployment/scripts/sub-scripts/build-tests.sh;
71               cd test/pythonsdk;
72               tox;