2018-09-19 11:49:43 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-03-09 04:54:57 +01:00
|
|
|
set -x
|
2018-09-19 11:49:43 +02:00
|
|
|
set +e
|
|
|
|
sudo rm -fr /data/*
|
|
|
|
sudo mkdir -p /data
|
2021-01-06 08:30:54 +01:00
|
|
|
DIR="$(cd "$(dirname "$0")" && pwd)"
|
2018-09-19 11:49:43 +02:00
|
|
|
|
|
|
|
set -e
|
|
|
|
# prepare cert ...
|
|
|
|
sudo sed "s/127.0.0.1/$1/" -i tests/generateCerts.sh
|
|
|
|
sudo ./tests/generateCerts.sh
|
2021-03-09 04:54:57 +01:00
|
|
|
sudo mkdir -p /etc/docker/certs.d/$1 && sudo cp ./tests/harbor_ca.crt $DIR/../../tests/ca.crt && sudo cp ./tests/harbor_ca.crt /etc/docker/certs.d/$1/ && rm -rf ~/.docker/ && mkdir -p ~/.docker/tls/$1:4443/ && sudo cp ./tests/harbor_ca.crt ~/.docker/tls/$1:4443/
|
|
|
|
ls -l $DIR/../../tests
|
2018-09-19 11:49:43 +02:00
|
|
|
|
2019-04-02 14:08:26 +02:00
|
|
|
sudo ./tests/hostcfg.sh
|
|
|
|
|
2021-03-09 04:54:57 +01:00
|
|
|
#---------------Set DNS for docker v20--------------------------#
|
|
|
|
# In docker v20, it fixed an issue named "Wrong resolv.conf #
|
|
|
|
# used on Ubuntu 19", this fix caused DNS solve problem #
|
|
|
|
# in container. So the current work round is read DNS server #
|
|
|
|
# from system and set the value in /etc/docker/daemon.json. #
|
|
|
|
# #
|
|
|
|
# Note: In LDAP pipeline, this setting must be done before #
|
|
|
|
# LDAP prepare phase, since LDAP service is a docker service. #
|
|
|
|
|
|
|
|
ip addr
|
|
|
|
dns_ip=$(netplan ip leases eth0 | grep -i dns | awk -F = '{print $2}')
|
|
|
|
dns_ip_list=$(echo $dns_ip | tr " " "\n")
|
|
|
|
dns_cfg=""
|
|
|
|
for ip in $dns_ip_list
|
|
|
|
do
|
|
|
|
dns_cfg="$dns_cfg,\"$ip\""
|
|
|
|
done
|
|
|
|
|
|
|
|
cat /etc/docker/daemon.json
|
|
|
|
|
|
|
|
if [ $(cat /etc/docker/daemon.json |grep \"dns\" |wc -l) -eq 0 ];then
|
|
|
|
sudo sed "s/}/,\n \"dns\": [${dns_cfg:1}]\n}/" -i /etc/docker/daemon.json
|
2018-09-19 11:49:43 +02:00
|
|
|
fi
|
|
|
|
|
2021-03-09 04:54:57 +01:00
|
|
|
cat /etc/docker/daemon.json
|
|
|
|
sudo systemctl daemon-reload
|
|
|
|
sudo systemctl restart docker
|
|
|
|
sudo systemctl status docker
|
|
|
|
# #
|
|
|
|
#---------------------------------------------------------------#
|
|
|
|
|
2019-01-09 10:40:27 +01:00
|
|
|
|
2021-03-09 04:54:57 +01:00
|
|
|
if [ "$2" = 'LDAP' ]; then
|
|
|
|
cd tests && sudo ./ldapprepare.sh && cd ..
|
|
|
|
fi
|
2018-09-19 11:49:43 +02:00
|
|
|
|
2021-03-09 04:54:57 +01:00
|
|
|
python --version
|
|
|
|
pip -V
|
2018-12-03 10:05:06 +01:00
|
|
|
|
2021-03-09 04:54:57 +01:00
|
|
|
#sudo apt-get update && sudo apt-get install -y --no-install-recommends libssl-dev && sudo apt-get autoremove -y && sudo rm -rf /var/lib/apt/lists/*
|
|
|
|
sudo wget https://bootstrap.pypa.io/get-pip.py && sudo python ./get-pip.py && sudo pip install --ignore-installed urllib3 chardet requests --upgrade
|
2022-01-11 07:46:34 +01:00
|
|
|
sudo make build_base_images -e BASEIMAGETAG=dev
|
2022-04-27 04:01:42 +02:00
|
|
|
sudo make install GOBUILDIMAGE=golang:1.17.9 COMPILETAG=compile_golangimage CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:1.6.0 NOTARYFLAG=true CLAIRFLAG=true CHARTFLAG=true BUILDBIN=true PULL_BASE_FROM_DOCKERHUB=false
|
2018-11-26 06:27:57 +01:00
|
|
|
sleep 10
|