actions: Build all image
Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
This commit is contained in:
parent
e6319c8672
commit
8d1825d981
1 changed files with 57 additions and 50 deletions
107
.github/workflows/pr-env.yaml
vendored
107
.github/workflows/pr-env.yaml
vendored
|
|
@ -217,67 +217,74 @@ jobs:
|
|||
declare -A folder_to_app
|
||||
folder_to_app["api"]="chalice"
|
||||
|
||||
case $app_name in
|
||||
all)
|
||||
# Building all apps
|
||||
cd scripts/helmcharts/
|
||||
# IMAGE_TAG=v1.15.0 PUSH_IMAGE=1 DOCKER_REPO=public.ecr.aws/p1t3u8a3 bash build_deploy.sh
|
||||
bash build_deploy.sh
|
||||
# get all built docker image tags
|
||||
docker images | grep ${IMAGE_TAG} | awk '{print $1}' > /tmp/images.txt
|
||||
components=(`cat /tmp/images.txt | cut -d '/' -f 3`)
|
||||
for component in "${components[@]}"; do
|
||||
kubectl set image -n app deployment/$component-openreplay $component=${DOCKER_REPO}/$component:${IMAGE_TAG}
|
||||
done
|
||||
;;
|
||||
backend*)
|
||||
echo "Building backend build"
|
||||
cd backend
|
||||
components=()
|
||||
if [ $app_name == "all" ]; then
|
||||
# Append all folder names from 'cmd/' directory to the array
|
||||
for folder in cmd/*/; do
|
||||
# Use basename to extract the folder name without path
|
||||
folder_name=$(basename "$folder")
|
||||
components+=("$folder_name")
|
||||
function build_and_deploy {
|
||||
case $1 in
|
||||
backend*)
|
||||
echo "Building backend build"
|
||||
cd backend
|
||||
components=()
|
||||
if [ $app_name == "all" ]; then
|
||||
# Append all folder names from 'cmd/' directory to the array
|
||||
for folder in cmd/*/; do
|
||||
# Use basename to extract the folder name without path
|
||||
folder_name=$(basename "$folder")
|
||||
components+=("$folder_name")
|
||||
done
|
||||
else
|
||||
# "${app_name#*:}" :: Strip backend: and output app1,app2,app3 to read -ra
|
||||
IFS=',' read -ra components <<< "${app_name#*:}"
|
||||
fi
|
||||
echo "Building components: " ${components[@]}
|
||||
for component in "${components[@]}"; do
|
||||
if [ $(docker manifest inspect ${DOCKER_REPO}/$component:${IMAGE_TAG} > /dev/null) ]; then
|
||||
echo Image present upstream. Skipping build: $component
|
||||
else
|
||||
echo "Building backend:$component"
|
||||
PUSH_IMAGE=1 bash -x ./build.sh $env $component
|
||||
fi
|
||||
kubectl set image -n app deployment/$component-openreplay $component=${DOCKER_REPO}/$component:${IMAGE_TAG}
|
||||
done
|
||||
else
|
||||
# "${app_name#*:}" :: Strip backend: and output app1,app2,app3 to read -ra
|
||||
IFS=',' read -ra components <<< "${app_name#*:}"
|
||||
fi
|
||||
for component in "${components[@]}"; do
|
||||
;;
|
||||
chalice)
|
||||
echo "Chalice build"
|
||||
component=$app_name
|
||||
cd api || (Nothing to build: $app_name; exit 100)
|
||||
if [ $(docker manifest inspect ${DOCKER_REPO}/$component:${IMAGE_TAG} > /dev/null) ]; then
|
||||
echo Image present upstream. Skipping build: $component
|
||||
else
|
||||
echo "Building backend:$component"
|
||||
PUSH_IMAGE=1 bash -x ./build.sh $env $component
|
||||
fi
|
||||
kubectl set image -n app deployment/$component-openreplay $component=${DOCKER_REPO}/$component:${IMAGE_TAG}
|
||||
done
|
||||
;;
|
||||
chalice)
|
||||
component=$app_name
|
||||
cd api || (Nothing to build: $app_name; exit 100)
|
||||
if [ $(docker manifest inspect ${DOCKER_REPO}/$component:${IMAGE_TAG} > /dev/null) ]; then
|
||||
echo Image present upstream. Skipping build: $component
|
||||
else
|
||||
echo "Building backend:$component"
|
||||
PUSH_IMAGE=1 bash -x ./build.sh $env $component
|
||||
fi
|
||||
kubectl set image -n app deployment/$app_name-openreplay $app_name=${DOCKER_REPO}/$app_name:${IMAGE_TAG}
|
||||
kubectl set image -n app deployment/$app_name-openreplay $app_name=${DOCKER_REPO}/$app_name:${IMAGE_TAG}
|
||||
;;
|
||||
*)
|
||||
echo "$app_name build"
|
||||
cd $app_name || (Nothing to build: $app_name; exit 100)
|
||||
component=$app_name
|
||||
if [ $(docker manifest inspect ${DOCKER_REPO}/$component:${IMAGE_TAG} > /dev/null) ]; then
|
||||
echo Image present upstream. Skipping build: $component
|
||||
else
|
||||
echo "Building backend:$component"
|
||||
PUSH_IMAGE=1 bash -x ./build.sh $env $component
|
||||
fi
|
||||
kubectl set image -n app deployment/$app_name-openreplay $app_name=${DOCKER_REPO}/$app_name:${IMAGE_TAG}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
case $app_name in
|
||||
all)
|
||||
build_and_deploy "backend:all"
|
||||
build_and_deploy "frontend"
|
||||
build_and_deploy "chalice"
|
||||
build_and_deploy "sourcemapreader"
|
||||
build_and_deploy "assist-stats"
|
||||
;;
|
||||
*)
|
||||
cd $app_name || (Nothing to build: $app_name; exit 100)
|
||||
component=$app_name
|
||||
if [ $(docker manifest inspect ${DOCKER_REPO}/$component:${IMAGE_TAG} > /dev/null) ]; then
|
||||
echo Image present upstream. Skipping build: $component
|
||||
else
|
||||
echo "Building backend:$component"
|
||||
PUSH_IMAGE=1 bash -x ./build.sh $env $component
|
||||
fi
|
||||
kubectl set image -n app deployment/$app_name-openreplay $app_name=${DOCKER_REPO}/$app_name:${IMAGE_TAG}
|
||||
build_and_deploy $app_name
|
||||
;;
|
||||
esac
|
||||
|
||||
- name: Sent results to slack
|
||||
if: steps.vcluster_exists.outputs.failed == 'true'
|
||||
env:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue