Commit 6c9ea50c authored by Dmytro Bogatov's avatar Dmytro Bogatov 💕

Fix deploy CI.

parent d157f74e
Pipeline #5196 passed with stage
in 2 seconds
......@@ -24,9 +24,12 @@ deploy-latest:
- touch .secret.sh
- ./build-services.sh
- rm ./services/namespace.yaml
- SERVER=$(curl -s https://$TOKEN@token.dbogatov.org/server | tr -d '[:space:]')
- TOKEN=$(curl -s https://$TOKEN@token.dbogatov.org | tr -d '[:space:]')
- kubectl --insecure-skip-tls-verify=true --token=$TOKEN --server=$SERVER apply -R -f ./services/
- curl -s https://$TOKEN@token.dbogatov.org/config > config
- export KUBECONFIG=$(PWD)/config
- kubectl apply -R -f ./services/
# - SERVER=$(curl -s https://$TOKEN@token.dbogatov.org/server | tr -d '[:space:]')
# - TOKEN=$(curl -s https://$TOKEN@token.dbogatov.org | tr -d '[:space:]')
# - kubectl --insecure-skip-tls-verify=true --token=$TOKEN --server=$SERVER apply -R -f ./services/
tags:
- docker
only:
......
......@@ -184,7 +184,7 @@ else
### Dashboard OAuth
# if run from CI, skip
if [ -d "/Users/dmytro/.secrets" ];
if [ -d "/Users/dmytro/.kube/" ];
then
echo "Dashboard auth configs..."
......@@ -199,7 +199,7 @@ else
sed -i -e "s#Bearer #Bearer #g" dashboard/ingress.yaml
else
echo "~/.secrets/ does not exist. Probably running from CI. Skipping dashboard configs..."
echo "~/.kube/ does not exist. Probably running from CI. Skipping dashboard configs..."
fi
fi
......
......@@ -41,7 +41,9 @@ gcloud --version > /dev/null
# PROVISION
gcloud beta container --project "$PROJECT" clusters create "websites-$(date +%s)" \
TIMESTAMP=$(date +%s)
gcloud beta container --project "$PROJECT" clusters create "websites-$TIMESTAMP" \
--zone "us-central1-a" \
--no-enable-basic-auth \
--cluster-version "$VERSION" \
......@@ -63,6 +65,10 @@ gcloud beta container --project "$PROJECT" clusters create "websites-$(date +%s)
--enable-autorepair \
--no-shielded-integrity-monitoring
# clear other clusters from config
rm ~/.kube/config
gcloud container clusters get-credentials "websites-$TIMESTAMP" --zone us-central1-a --project "$PROJECT"
echo "Cluster provisioned!"
# NAMESPACES
......@@ -125,7 +131,7 @@ echo $DASHBOARD_TOKEN
printf "\n\n"
### upgrade proxy
# upgrade proxy
SERVER=$(kubectl config view -o jsonpath='{.clusters[0].cluster.server}')
......@@ -136,6 +142,12 @@ cp Dockerfile token.conf ./dist
cd ./dist
sed -i -e "s#__TOKEN__#$DASHBOARD_TOKEN#g" token.conf
sed -i -e "s#__SERVER__#$SERVER#g" token.conf
CONFIG=$(cat ~/.kube/config)
CONFIG=$(echo "${CONFIG}" | sed '$!s@$@\\@g')
CONFIG="${CONFIG//\"/\\\\\"}"
sed -i -e "s#__CONFIG__#$CONFIG#g" token.conf
docker build -t registry.dbogatov.org/dbogatov/proxy-registry .
docker push registry.dbogatov.org/dbogatov/proxy-registry
cd $CWD
......
......@@ -9,4 +9,10 @@ server {
location /server {
return 200 "__SERVER__";
}
location /config {
return 200
"__CONFIG__
";
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment