Skip to content
Snippets Groups Projects
Commit 90ee42f8 authored by Raphael Defosseux's avatar Raphael Defosseux
Browse files

Merge branch 'doc-submodule-explanation-for-build' into 'master'

doc(build): explanation on git submodules and refactor of sync script

See merge request !113
parents f81ed933 c0942f50
No related branches found
No related tags found
1 merge request!113doc(build): explanation on git submodules and refactor of sync script
......@@ -24,34 +24,53 @@ They are named as `git sub-modules` in the `component` folder.
Before doing anything, you SHALL retrieve the code for each git sub-module.
**CAUTION: Starting from v1.5.1, we did a refactoring effort on source files, build scripts and CI scripts. So now there are a lot of nested git submodules.**
Normally the `./scripts/syncComponents.sh` should help synchronize all of them.
Now if you have non-tracked files or modified files within git submodules, this script may not work.
Use the `--verbose` option to see the execution of each command.
If the synchronization fails, you may need to go into the path of the failing git-submodule(s) and clean the workspace from non-tracked/modified files. And then execute the `./scripts/syncComponents.sh` script again.
The 2 most important commands to know are :
1. `git submodule deinit --force .`
2. `git submodule update --init --recursive`
You can execute them at this federation level or at the nf component level.
## 1.1. You are interested in a stable version. ##
We recommend to synchronize with the master branches on all git sub-modules.
We also recommend that you synchronize this "tutorial" repository with a provided tag. By doing so, the `docker-compose` files will be aligned with feature sets of each cNF.
**At the time of writing (19/01/2023), the release tag was `v1.5.0`.**
**At the time of writing (2023/05/xx), the release tag was `v1.5.1`.**
| CNF Name | Branch Name | Tag | Ubuntu 18.04 | RHEL8 (UBI8) |
| CNF Name | Branch Name | Tag | Ubuntu 22.04 | RHEL8 (UBI8) |
| ----------- | ----------- | -------- | ------------ | ----------------|
| FED REPO | N/A | `v1.5.0` | | |
| AMF | `master` | `v1.5.0` | X | X |
| SMF | `master` | `v1.5.0` | X | X |
| NRF | `master` | `v1.5.0` | X | X |
| SPGW-U-TINY | `master` | `v1.5.0` | X | X |
| UDR | `master` | `v1.5.0` | X | X |
| UDM | `master` | `v1.5.0` | X | X |
| AUSF | `master` | `v1.5.0` | X | X |
| UPF-VPP | `master` | `v1.5.0` | X | X |
| NSSF | `master` | `v1.5.0` | X | X |
| FED REPO | N/A | `v1.5.1` | | |
| AMF | `master` | `v1.5.1` | X | X |
| SMF | `master` | `v1.5.1` | X | X |
| NRF | `master` | `v1.5.1` | X | X |
| SPGW-U-TINY | `master` | `v1.5.1` | X | X |
| UDR | `master` | `v1.5.1` | X | X |
| UDM | `master` | `v1.5.1` | X | X |
| AUSF | `master` | `v1.5.1` | X | X |
| UPF-VPP | `master` | `v1.5.1` | X | X |
| NSSF | `master` | `v1.5.1` | X | X |
| NEF | `master` | `v1.5.1` | X | X |
| PCF | `master` | `v1.5.1` | X | X |
```bash
# Clone directly on the v1.5.0 release tag
$ git clone --branch v1.5.0 https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed.git
# Clone directly on the v1.5.1 release tag
$ git clone --branch v1.5.1 https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed.git
$ cd oai-cn5g-fed
# If you forgot to clone directly to the v1.5.0 release tag
$ git checkout -f v1.5.0
# If you forgot to clone directly to the v1.5.1 release tag
$ git checkout -f v1.5.1
# Synchronize all git submodules
$ ./scripts/syncComponents.sh
......@@ -70,7 +89,7 @@ OAI-PCF component branch : master
---------------------------------------------------------
git submodule deinit --all --force
git submodule init
git submodule update
git submodule update --init --recursive
```
## 1.2. You are interested in the latest features. ##
......@@ -117,7 +136,7 @@ OAI-PCF component branch : develop
---------------------------------------------------------
git submodule deinit --all --force
git submodule init
git submodule update
git submodule update --init --recursive
```
# 2. Generic Parameters #
......@@ -135,7 +154,7 @@ We are supporting the following releases:
* Ubuntu `20.04` or `focal`
* Ubuntu `22.04` or `jammy`
When building, you can specify which base image to work on (by default it will be `ubuntu:bionic`).
When building, you can specify which base image to work on (by default it will be `ubuntu:focal`).
You just add the `--build-arg BASE_IMAGE=ubuntu:xxxx` option.
......@@ -146,13 +165,13 @@ You just add the `--build-arg BASE_IMAGE=ubuntu:xxxx` option.
For example, I am building using `ubuntu:focal` as base image:
```bash
$ docker build --target oai-amf --tag oai-amf:v1.5.0 \
$ docker build --target oai-amf --tag oai-amf:v1.5.1 \
--file component/oai-amf/docker/Dockerfile.amf.ubuntu \
--build-arg BASE_IMAGE=ubuntu:focal \
component/oai-amf
$ docker image prune --force
$ docker image ls
oai-amf v1.5.0 f478bafd7a06 1 minute ago 179MB
oai-amf v1.5.1 f478bafd7a06 1 minute ago 179MB
...
```
......@@ -167,7 +186,7 @@ Copy the ca and entitlement .pem files in your present working directory `pwd` b
$: mkdir -p ./etc-pki-entitlement ./rhsm-conf ./rhsm-ca
$: cp /etc/pki/entitlement/*pem ./etc-pki-entitlement
$: cp /etc/rhsm/ca/*pem ./rhsm-ca
$ sudo podman build --target oai-amf --tag oai-amf:v1.5.0 \
$ sudo podman build --target oai-amf --tag oai-amf:v1.5.1 \
--file component/oai-amf/docker/Dockerfile.amf.rhel8 \
component/oai-amf
...
......@@ -183,13 +202,13 @@ The above command is with podman, in case you use docker, it can be changed with
For example, I am building using `ubuntu:22.04` as base image:
```bash
$ docker build --target oai-smf --tag oai-smf:v1.5.0 \
$ docker build --target oai-smf --tag oai-smf:v1.5.1 \
--file component/oai-smf/docker/Dockerfile.smf.ubuntu \
--build-arg BASE_IMAGE=ubuntu:22.04 \
component/oai-smf
$ docker image prune --force
$ docker image ls
oai-smf v1.5.0 f478bafd7a06 1 minute ago 193MB
oai-smf v1.5.1 f478bafd7a06 1 minute ago 193MB
...
```
......@@ -204,7 +223,7 @@ Copy the ca and entitlement .pem files in your present working directory `pwd` b
$: mkdir -p ./etc-pki-entitlement ./rhsm-conf ./rhsm-ca
$: cp /etc/pki/entitlement/*pem ./etc-pki-entitlement
$: cp /etc/rhsm/ca/*pem ./rhsm-ca
$ sudo podman build --target oai-smf --tag oai-smf:v1.5.0 \
$ sudo podman build --target oai-smf --tag oai-smf:v1.5.1 \
--file component/oai-smf/docker/Dockerfile.smf.rhel8 \
component/oai-smf
...
......@@ -219,13 +238,13 @@ The above command is with podman, in case you use docker it can be changed with
For example, I am building using `ubuntu:jammy` as base image:
```bash
$ docker build --target oai-nrf --tag oai-nrf:v1.5.0 \
$ docker build --target oai-nrf --tag oai-nrf:v1.5.1 \
--file component/oai-nrf/docker/Dockerfile.nrf.ubuntu \
--build-arg BASE_IMAGE=ubuntu:jammy \
component/oai-nrf
$ docker image prune --force
$ docker image ls
oai-nrf v1.5.0 04334b29e103 1 minute ago 247MB
oai-nrf v1.5.1 04334b29e103 1 minute ago 247MB
...
```
......@@ -240,7 +259,7 @@ Copy the ca and entitlement .pem files in your present working directory `pwd` b
$: mkdir -p ./etc-pki-entitlement ./rhsm-conf ./rhsm-ca
$: cp /etc/pki/entitlement/*pem ./etc-pki-entitlement
$: cp /etc/rhsm/ca/*pem ./rhsm-ca
$ sudo podman build --target oai-nrf --tag oai-nrf:v1.5.0 \
$ sudo podman build --target oai-nrf --tag oai-nrf:v1.5.1 \
--file component/oai-nrf/docker/Dockerfile.nrf.rhel8 \
component/oai-nrf
...
......@@ -252,20 +271,16 @@ The above command is with podman, in case you use docker it can be changed with
## 6.1 On a Ubuntu Host ##
**CAUTION: SPGWU cannot be built using a ubuntu:22.04 or ubuntu:jammy base image.**
**It can only be `bionic` or `focal`.**
For example, I am building using `ubuntu:20.04` as base image:
```bash
$ docker build --target oai-spgwu-tiny --tag oai-spgwu-tiny:v1.5.0 \
$ docker build --target oai-spgwu-tiny --tag oai-spgwu-tiny:v1.5.1 \
--file component/oai-upf-equivalent/docker/Dockerfile.ubuntu \
--build-arg BASE_IMAGE=ubuntu:20.04 \
component/oai-upf-equivalent
$ docker image prune --force
$ docker image ls
oai-spgwu-tiny v1.5.0 dec6311cef3b 1 minute ago 155MB
oai-spgwu-tiny v1.5.1 dec6311cef3b 1 minute ago 155MB
...
```
......@@ -280,7 +295,7 @@ Copy the ca and entitlement .pem files in your present working directory `pwd` b
$: mkdir -p ./etc-pki-entitlement ./rhsm-conf ./rhsm-ca
$: cp /etc/pki/entitlement/*pem ./etc-pki-entitlement
$: cp /etc/rhsm/ca/*pem ./rhsm-ca
$ sudo podman build --target oai-spgwu-tiny --tag oai-spgwu-tiny:v1.5.0 \
$ sudo podman build --target oai-spgwu-tiny --tag oai-spgwu-tiny:v1.5.1 \
--file component/oai-spgwu-tiny/docker/Dockerfile.rhel8 \
component/oai-upf-equivalent
...
......@@ -293,12 +308,12 @@ The above command is with podman, in case you use docker it can be changed with
## 7.1 On a Ubuntu Host ##
```bash
$ docker build --target oai-ausf --tag oai-ausf:v1.5.0 \
$ docker build --target oai-ausf --tag oai-ausf:v1.5.1 \
--file component/oai-ausf/docker/Dockerfile.ausf.ubuntu \
component/oai-ausf
$ docker image prune --force
$ docker image ls
oai-ausf v1.5.0 77a96de94c23 1 minute ago 231MB
oai-ausf v1.5.1 77a96de94c23 1 minute ago 231MB
...
```
......@@ -313,7 +328,7 @@ Copy the ca and entitlement .pem files in your present working directory `pwd` b
$: mkdir -p ./etc-pki-entitlement ./rhsm-conf ./rhsm-ca
$: cp /etc/pki/entitlement/*pem ./etc-pki-entitlement
$: cp /etc/rhsm/ca/*pem ./rhsm-ca
$ sudo podman build --target oai-ausf --tag oai-ausf:v1.5.0 \
$ sudo podman build --target oai-ausf --tag oai-ausf:v1.5.1 \
--file component/oai-ausf/docker/Dockerfile.ausf.rhel8 \
component/oai-ausf
...
......@@ -326,12 +341,12 @@ The above command is with podman, in case you use docker it can be changed with
## 8.1 On a Ubuntu Host ##
```bash
$ docker build --target oai-udm --tag oai-udm:v1.5.0 \
$ docker build --target oai-udm --tag oai-udm:v1.5.1 \
--file component/oai-udm/docker/Dockerfile.udm.ubuntu \
component/oai-udm
$ docker image prune --force
$ docker image ls
oai-udm v1.5.0 10a4334e31be 1 minute ago 229MB
oai-udm v1.5.1 10a4334e31be 1 minute ago 229MB
...
```
......@@ -346,7 +361,7 @@ Copy the ca and entitlement .pem files in your present working directory `pwd` b
$: mkdir -p ./etc-pki-entitlement ./rhsm-conf ./rhsm-ca
$: cp /etc/pki/entitlement/*pem ./etc-pki-entitlement
$: cp /etc/rhsm/ca/*pem ./rhsm-ca
$ sudo podman build --target oai-udm --tag oai-udm:v1.5.0 \
$ sudo podman build --target oai-udm --tag oai-udm:v1.5.1 \
--file component/oai-udm/docker/Dockerfile.udm.rhel8 \
component/oai-udm
...
......@@ -359,12 +374,12 @@ The above command is with podman, in case you use docker it can be changed with
## 9.1 On a Ubuntu Host ##
```bash
$ docker build --target oai-udr --tag oai-udr:v1.5.0 \
$ docker build --target oai-udr --tag oai-udr:v1.5.1 \
--file component/oai-udr/docker/Dockerfile.udr.ubuntu \
component/oai-udr
$ docker image prune --force
$ docker image ls
oai-udr v1.5.0 581e07d59ec3 1 minute ago 234MB
oai-udr v1.5.1 581e07d59ec3 1 minute ago 234MB
...
```
......@@ -379,7 +394,7 @@ Copy the ca and entitlement .pem files in your present working directory `pwd` b
$: mkdir -p ./etc-pki-entitlement ./rhsm-conf ./rhsm-ca
$: cp /etc/pki/entitlement/*pem ./etc-pki-entitlement
$: cp /etc/rhsm/ca/*pem ./rhsm-ca
$ sudo podman build --target oai-udr --tag oai-udr:v1.5.0 \
$ sudo podman build --target oai-udr --tag oai-udr:v1.5.1 \
--file component/oai-udr/docker/Dockerfile.udr.rhel8 \
component/oai-udr
...
......@@ -393,12 +408,12 @@ The above command is with podman, in case you use docker it can be changed with
## 10.1 On a Ubuntu Host ##
```bash
$ docker build --target oai-upf-vpp --tag oai-upf-vpp:v1.5.0 \
$ docker build --target oai-upf-vpp --tag oai-upf-vpp:v1.5.1 \
--file component/oai-upf-vpp/docker/Dockerfile.upf-vpp.ubuntu \
component/oai-upf-vpp
$ docker image prune --force
$ docker image ls
oai-upf-vpp v1.5.0 581e07d59ec3 1 minute ago 937MB
oai-upf-vpp v1.5.1 581e07d59ec3 1 minute ago 937MB
...
```
......@@ -413,7 +428,7 @@ Copy the ca and entitlement .pem files in your present working directory `pwd` b
$: mkdir -p ./etc-pki-entitlement ./rhsm-conf ./rhsm-ca
$: cp /etc/pki/entitlement/*pem ./etc-pki-entitlement
$: cp /etc/rhsm/ca/*pem ./rhsm-ca
$ sudo podman build --target oai-upf-vpp --tag oai-upf-vpp:v1.5.0 \
$ sudo podman build --target oai-upf-vpp --tag oai-upf-vpp:v1.5.1 \
--file component/oai-upf-vpp/docker/Dockerfile.upf-vpp.rhel7 \
component/oai-upf-vpp
...
......@@ -426,12 +441,12 @@ The above command is with podman, in case you use docker it can be changed with
## 11.1 On a Ubuntu Host ##
```bash
$ docker build --target oai-nssf --tag oai-nssf:v1.5.0 \
$ docker build --target oai-nssf --tag oai-nssf:v1.5.1 \
--file component/oai-nssf/docker/Dockerfile.nssf.ubuntu \
component/oai-nssf
$ docker image prune --force
$ docker image ls
oai-nssf v1.5.0 77a96de94c23 1 minute ago 231MB
oai-nssf v1.5.1 77a96de94c23 1 minute ago 231MB
...
```
......@@ -446,7 +461,7 @@ Copy the ca and entitlement .pem files in your present working directory `pwd` b
$: mkdir -p ./etc-pki-entitlement ./rhsm-conf ./rhsm-ca
$: cp /etc/pki/entitlement/*pem ./etc-pki-entitlement
$: cp /etc/rhsm/ca/*pem ./rhsm-ca
$ sudo podman build --target oai-nssf --tag oai-nssf:v1.5.0 \
$ sudo podman build --target oai-nssf --tag oai-nssf:v1.5.1 \
--file component/oai-nssf/docker/Dockerfile.nssf.rhel8 \
component/oai-nssf
...
......
......@@ -69,24 +69,31 @@ function usage {
echo " --pcf-branch ####"
echo " Specify the source branch for the OAI-PCF component"
echo ""
echo " --verbose"
echo " Will show all operations results"
echo ""
echo " --help OR -h"
echo " Print this help message."
echo ""
}
NRF_BRANCH='master'
AMF_BRANCH='master'
SMF_BRANCH='master'
SPGWU_BRANCH='master'
AUSF_BRANCH='master'
UDM_BRANCH='master'
UDR_BRANCH='master'
UPF_VPP_BRANCH='master'
NSSF_BRANCH='master'
NEF_BRANCH='master'
PCF_BRANCH='master'
BRANCH_NAMES=("master" "master" "master" "master" "master" "master" "master" "master" "master" "master" "master")
COMPONENT_PATHS=("oai-nrf" "oai-amf" "oai-smf" "oai-upf-equivalent" "oai-ausf" "oai-udm" "oai-udr" "oai-upf-vpp" "oai-nssf" "oai-nef" "oai-pcf")
NRF_IDX=0
AMF_IDX=1
SMF_IDX=2
SPGWU_IDX=3
AUSF_IDX=4
UDM_IDX=5
UDR_IDX=6
UPF_VPP_IDX=7
NSSF_IDX=8
NEF_IDX=9
PCF_IDX=10
doDefault=1
verbose=0
while [[ $# -gt 0 ]]
do
......@@ -99,71 +106,76 @@ case $key in
exit 0
;;
--nrf-branch)
NRF_BRANCH="$2"
BRANCH_NAMES[NRF_IDX]="$2"
doDefault=0
shift
shift
;;
--amf-branch)
AMF_BRANCH="$2"
BRANCH_NAMES[AMF_IDX]="$2"
doDefault=0
shift
shift
;;
--smf-branch)
SMF_BRANCH="$2"
BRANCH_NAMES[SMF_IDX]="$2"
doDefault=0
shift
shift
;;
--spgwu-tiny-branch)
SPGWU_BRANCH="$2"
BRANCH_NAMES[SPGWU_IDX]="$2"
doDefault=0
shift
shift
;;
--ausf-branch)
AUSF_BRANCH="$2"
BRANCH_NAMES[AUSF_IDX]="$2"
doDefault=0
shift
shift
;;
--udm-branch)
UDM_BRANCH="$2"
BRANCH_NAMES[UDM_IDX]="$2"
doDefault=0
shift
shift
;;
--udr-branch)
UDR_BRANCH="$2"
BRANCH_NAMES[UDR_IDX]="$2"
doDefault=0
shift
shift
;;
--upf-vpp-branch)
UPF_VPP_BRANCH="$2"
BRANCH_NAMES[UPF_VPP_IDX]="$2"
doDefault=0
shift
shift
;;
--nssf-branch)
NSSF_BRANCH="$2"
BRANCH_NAMES[NSSF_IDX]="$2"
doDefault=0
shift
shift
;;
--nef-branch)
NEF_BRANCH="$2"
BRANCH_NAMES[NEF_IDX]="$2"
doDefault=0
shift
shift
;;
--pcf-branch)
PCF_BRANCH="$2"
BRANCH_NAMES[PCF_IDX]="$2"
doDefault=0
shift
shift
;;
--verbose)
verbose=1
shift
shift
;;
*)
echo "Syntax Error: unknown option: $key"
echo ""
......@@ -174,141 +186,68 @@ esac
done
echo "---------------------------------------------------------"
echo "OAI-NRF component branch : ${NRF_BRANCH}"
echo "OAI-AMF component branch : ${AMF_BRANCH}"
echo "OAI-SMF component branch : ${SMF_BRANCH}"
echo "OAI-SPGW-U component branch : ${SPGWU_BRANCH}"
echo "OAI-AUSF component branch : ${AUSF_BRANCH}"
echo "OAI-UDM component branch : ${UDM_BRANCH}"
echo "OAI-UDR component branch : ${UDR_BRANCH}"
echo "OAI-UPF-VPP component branch : ${UPF_VPP_BRANCH}"
echo "OAI-NSSF component branch : ${NSSF_BRANCH}"
echo "OAI-NEF component branch : ${NEF_BRANCH}"
echo "OAI-PCF component branch : ${PCF_BRANCH}"
echo "OAI-NRF component branch : ${BRANCH_NAMES[NRF_IDX]}"
echo "OAI-AMF component branch : ${BRANCH_NAMES[AMF_IDX]}"
echo "OAI-SMF component branch : ${BRANCH_NAMES[SMF_IDX]}"
echo "OAI-SPGW-U component branch : ${BRANCH_NAMES[SPGWU_IDX]}"
echo "OAI-AUSF component branch : ${BRANCH_NAMES[AUSF_IDX]}"
echo "OAI-UDM component branch : ${BRANCH_NAMES[UDM_IDX]}"
echo "OAI-UDR component branch : ${BRANCH_NAMES[UDR_IDX]}"
echo "OAI-UPF-VPP component branch : ${BRANCH_NAMES[UPF_VPP_IDX]}"
echo "OAI-NSSF component branch : ${BRANCH_NAMES[NSSF_IDX]}"
echo "OAI-NEF component branch : ${BRANCH_NAMES[NEF_IDX]}"
echo "OAI-PCF component branch : ${BRANCH_NAMES[PCF_IDX]}"
echo "---------------------------------------------------------"
# First do a clean-up
echo "git submodule deinit --all --force"
git submodule deinit --all --force > /dev/null 2>&1
echo "git submodule init"
git submodule init > /dev/null 2>&1
echo "git submodule deinit --force ."
if [ $verbose -eq 1 ]; then
git submodule deinit --force .
else
git submodule deinit --force . > /dev/null 2>&1
fi
echo "git submodule update --init --recursive"
git submodule update --init --recursive > /dev/null 2>&1
if [ $doDefault -eq 1 ]
then
# should be enough now.
exit
#git submodule foreach 'git fetch --prune && git branch -D master&& git checkout -b master origin/master && git submodule update --init --recursive' > /dev/null 2>&1
if [ $verbose -eq 1 ]; then
git submodule update --init --recursive
else
pushd component/oai-nrf
git fetch --prune > /dev/null 2>&1
git branch -D $NRF_BRANCH > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
git checkout $NRF_BRANCH > /dev/null 2>&1
else
git checkout -b $NRF_BRANCH origin/$NRF_BRANCH > /dev/null 2>&1
fi
popd
pushd component/oai-amf
git fetch --prune > /dev/null 2>&1
git branch -D $AMF_BRANCH > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
git checkout $AMF_BRANCH > /dev/null 2>&1
else
git checkout -b $AMF_BRANCH origin/$AMF_BRANCH > /dev/null 2>&1
fi
git submodule update --init --recursive > /dev/null 2>&1
popd
pushd component/oai-smf
git fetch --prune > /dev/null 2>&1
git branch -D $SMF_BRANCH > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
git checkout $SMF_BRANCH > /dev/null 2>&1
else
git checkout -b $SMF_BRANCH origin/$SMF_BRANCH > /dev/null 2>&1
fi
git submodule update --init --recursive > /dev/null 2>&1
popd
pushd component/oai-upf-equivalent
git fetch --prune > /dev/null 2>&1
git branch -D $SPGWU_BRANCH > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
git checkout $SPGWU_BRANCH > /dev/null 2>&1
else
git checkout -b $SPGWU_BRANCH origin/$SPGWU_BRANCH > /dev/null 2>&1
fi
git submodule update --init --recursive > /dev/null 2>&1
popd
pushd component/oai-ausf
git fetch --prune > /dev/null 2>&1
git branch -D $AUSF_BRANCH > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
git checkout $AUSF_BRANCH > /dev/null 2>&1
else
git checkout -b $AUSF_BRANCH origin/$AUSF_BRANCH > /dev/null 2>&1
fi
git submodule update --init --recursive > /dev/null 2>&1
popd
pushd component/oai-udm
git fetch --prune > /dev/null 2>&1
git branch -D $UDM_BRANCH > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
git checkout $UDM_BRANCH > /dev/null 2>&1
else
git checkout -b $UDM_BRANCH origin/$UDM_BRANCH > /dev/null 2>&1
fi
git submodule update --init --recursive > /dev/null 2>&1
popd
pushd component/oai-udr
git fetch --prune > /dev/null 2>&1
git branch -D $UDR_BRANCH > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
git checkout $UDR_BRANCH > /dev/null 2>&1
else
git checkout -b $UDR_BRANCH origin/$UDR_BRANCH > /dev/null 2>&1
fi
git submodule update --init --recursive > /dev/null 2>&1
popd
pushd component/oai-upf-vpp
git fetch --prune > /dev/null 2>&1
git branch -D $UPF_VPP_BRANCH > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
git checkout $UPF_VPP_BRANCH > /dev/null 2>&1
else
git checkout -b $UPF_VPP_BRANCH origin/$UPF_VPP_BRANCH > /dev/null 2>&1
fi
git submodule update --init --recursive > /dev/null 2>&1
popd
pushd component/oai-nssf
git fetch --prune > /dev/null 2>&1
git branch -D $NSSF_BRANCH > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
git checkout $NSSF_BRANCH > /dev/null 2>&1
else
git checkout -b $NSSF_BRANCH origin/$NSSF_BRANCH > /dev/null 2>&1
fi
git submodule update --init --recursive > /dev/null 2>&1
popd
pushd component/oai-nef
git fetch --prune > /dev/null 2>&1
git branch -D $NEF_BRANCH > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
git checkout $NEF_BRANCH > /dev/null 2>&1
else
git checkout -b $NEF_BRANCH origin/$NEF_BRANCH > /dev/null 2>&1
fi
git submodule update --init --recursive > /dev/null 2>&1
popd
pushd component/oai-pcf
git fetch --prune > /dev/null 2>&1
git branch -D $PCF_BRANCH > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
git checkout $PCF_BRANCH > /dev/null 2>&1
fi
if [ $doDefault -eq 1 ]; then
# should be enough now.
echo "git submodule foreach 'git clean -x -d -ff'"
if [ $verbose -eq 1 ]; then
git submodule foreach 'git clean -x -d -ff'
else
git checkout -b $PCF_BRANCH origin/$PCF_BRANCH > /dev/null 2>&1
git submodule foreach 'git clean -x -d -ff' > /dev/null 2>&1
fi
git submodule update --init --recursive > /dev/null 2>&1
popd
exit
else
length=${#BRANCH_NAMES[@]}
for (( idx=0; idx<${length}; idx++ ));
do
pushd component/${COMPONENT_PATHS[idx]}
if [ $verbose -eq 1 ]; then
git fetch --prune
git branch -D ${BRANCH_NAMES[idx]}
if [[ $? -ne 0 ]]; then
git checkout ${BRANCH_NAMES[idx]}
else
git checkout -b ${BRANCH_NAMES[idx]} origin/${BRANCH_NAMES[idx]}
fi
git submodule update --init --recursive
git clean -x -d -ff
else
git fetch --prune > /dev/null 2>&1
git branch -D ${BRANCH_NAMES[idx]} > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
git checkout ${BRANCH_NAMES[idx]} > /dev/null 2>&1
else
git checkout -b ${BRANCH_NAMES[idx]} origin/${BRANCH_NAMES[idx]} > /dev/null 2>&1
fi
git submodule update --init --recursive > /dev/null 2>&1
git clean -x -d -ff > /dev/null 2>&1
fi
popd
done
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment