Fix installation of Kubernetes metrics server by updating the URL
[osm/devops.git] / README.md
1 <!--
2 Copyright 2020 ETSI
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8    http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 implied.
14 See the License for the specific language governing permissions and
15 limitations under the License
16 -->
17 # osm-devops
18
19 Scripts and artifacts for OSM installation and CI/CD pipelines.
20
21 ## Folder structure
22
23 - `jenkins`: scripts run by jenkins. All OSM modules rely on these scripts.
24 - `installers`: scripts to be executed to install OSM. It also includes the OSM helm chart.
25
26 ## Instructions to test new code in the same way is done in OSM CI/CD pipeline
27
28 ### Create folder
29
30 ´´´bash
31 mkdir osm
32 cd osm
33 ```
34
35 ### Clone projects
36
37 Clone the projects that you would like to test
38
39 ```bash
40 git clone "https://osm.etsi.org/gerrit/osm/devops"
41 git clone "https://osm.etsi.org/gerrit/osm/common"
42 git clone "https://osm.etsi.org/gerrit/osm/N2VC"
43 git clone "https://osm.etsi.org/gerrit/osm/LCM"
44 ...
45 ```
46
47 ### Update repos to use a specific branch or a Gerrit patch
48
49 If needed, update code in the repos. An example for N2VC is shown below
50
51 ```
52 cd N2VC
53 git pull "https://osm.etsi.org/gerrit/osm/N2VC" refs/changes/22/14222/2
54 cd ..
55 cd LCM
56 git pull "https://osm.etsi.org/gerrit/osm/LCM" refs/changes/24/14224/3
57 cd ..
58 ```
59
60 ### Start an HTTP server to host the intermediate artifacts (deb packages)
61
62 ```bash
63 ./devops/tools/local-build.sh --run-httpserver
64 ps -ef |grep python3
65 ```
66
67 ### Run stage2 to build artifacts
68
69 ```bash
70 # Clean previous artifacts
71 rm $HOME/.osm/httpd/*.deb
72 # Build new artifacts
73 ./devops/tools/local-build.sh --module common,N2VC,LCM stage-2
74 # Check that artifacts were created
75 ls $HOME/.osm/httpd
76 ```
77
78 __Note: Artifacts need to be cleaned every time we want to try new patches__
79
80 ### Run stage3 to build docker images
81
82 ```bash
83 ./devops/tools/local-build.sh --module LCM stage-3
84 docker image ls
85 # Copy the image to your image resistry, e.g.: "your-registry/osm/osm-testing/opensourcemano/lcm:myfeature"
86 ```
87
88 ### Update OSM Helm release to use the new image
89
90 ```bash
91 helm3 -n osm list
92 helm3 -n osm get values osm
93 ```
94
95 Upgrade with kubectl:
96
97 ```bash
98 kubectl -n osm patch deployment lcm --patch '{"spec": {"template": {"spec": {"containers": [{"name": "lcm", "image": "your-registry/osm/osm-testing/opensourcemano/lcm:myfeature}]}}}}'
99 kubectl -n osm get all
100 ```
101
102 Upgrade with Helm:
103
104 ```bash
105 helm3 -n osm list
106 helm3 -n osm history osm
107 helm3 -n osm upgrade --reuse-values --set lcm.image.repository="your-registry/osm/osm-testing/opensourcemano/lcm" --set lcm.image.tag="myfeature" osm ./helm-chart-dir
108 helm3 -n osm status osm
109 kubectl -n osm get all
110
111 ### Test OSM Helm Chart independently
112
113 ```bash
114 git clone "https://osm.etsi.org/gerrit/osm/devops"
115 cd devops/
116 # Get a patch from Gerrit
117 # git pull "https://osm.etsi.org/gerrit/osm/devops" refs/changes/25/14325/17
118 ./installers/install_helm_client.sh -D . --debug
119 ./devops-stages/stage-test.sh
120 ./installers/full_install_osm.sh -D . --debug -R testing-daily -t testing-daily -r testing -y  2>&1 | tee osm_install_log.txt
121 kubectl -n osm get all
122 kubectl -n osm get ingress
123 ```