diff --git a/api/build.sh b/api/build.sh index 10c0df47e..ecfbf7c5a 100644 --- a/api/build.sh +++ b/api/build.sh @@ -15,6 +15,8 @@ exit_err() { fi } +source ../scripts/lib/_docker.sh + environment=$1 git_sha=$(git rev-parse --short HEAD) image_tag=${IMAGE_TAG:-git_sha} diff --git a/api/build_alerts.sh b/api/build_alerts.sh index f8b1929c6..407d80189 100644 --- a/api/build_alerts.sh +++ b/api/build_alerts.sh @@ -10,6 +10,7 @@ git_sha=$(git rev-parse --short HEAD) image_tag=${IMAGE_TAG:-git_sha} envarg="default-foss" +source ../scripts/lib/_docker.sh check_prereq() { which docker || { echo "Docker not installed, please install docker." @@ -17,27 +18,26 @@ check_prereq() { } } - [[ $1 == ee ]] && ee=true [[ $PATCH -eq 1 ]] && { - image_tag="$(grep -ER ^.ppVersion ../scripts/helmcharts/openreplay/charts/$chart | xargs | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" - [[ $ee == "true" ]] && { - image_tag="${image_tag}-ee" - } + image_tag="$(grep -ER ^.ppVersion ../scripts/helmcharts/openreplay/charts/$chart | xargs | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" + [[ $ee == "true" ]] && { + image_tag="${image_tag}-ee" + } } update_helm_release() { - chart=$1 - HELM_TAG="$(grep -iER ^version ../scripts/helmcharts/openreplay/charts/$chart | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" - # Update the chart version - sed -i "s#^version.*#version: $HELM_TAG# g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml - # Update image tags - sed -i "s#ppVersion.*#ppVersion: \"$image_tag\"#g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml - # Commit the changes - git add ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml - git commit -m "chore(helm): Updating $chart image release" + chart=$1 + HELM_TAG="$(grep -iER ^version ../scripts/helmcharts/openreplay/charts/$chart | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" + # Update the chart version + sed -i "s#^version.*#version: $HELM_TAG# g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml + # Update image tags + sed -i "s#ppVersion.*#ppVersion: \"$image_tag\"#g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml + # Commit the changes + git add ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml + git commit -m "chore(helm): Updating $chart image release" } -function build_alerts(){ +function build_alerts() { destination="_alerts" [[ $1 == "ee" ]] && { destination="_alerts_ee" @@ -69,5 +69,5 @@ function build_alerts(){ check_prereq build_alerts $1 if [[ $PATCH -eq 1 ]]; then - update_helm_release alerts + update_helm_release alerts fi diff --git a/api/build_crons.sh b/api/build_crons.sh index 0ada02199..d01b81db5 100644 --- a/api/build_crons.sh +++ b/api/build_crons.sh @@ -9,6 +9,7 @@ git_sha1=${IMAGE_TAG:-$(git rev-parse HEAD)} envarg="default-foss" +source ../scripts/lib/_docker.sh check_prereq() { which docker || { echo "Docker not installed, please install docker." @@ -17,7 +18,7 @@ check_prereq() { [[ exit -eq 1 ]] && exit 1 } -function build_crons(){ +function build_crons() { destination="_crons_ee" cp -R ../api ../${destination} cd ../${destination} @@ -46,7 +47,6 @@ check_prereq [[ $1 == "ee" ]] && { build_crons $1 } || { -echo -e "Crons is only for ee. Rerun the script using \n bash $0 ee" -exit 100 + echo -e "Crons is only for ee. Rerun the script using \n bash $0 ee" + exit 100 } - diff --git a/assist-stats/build.sh b/assist-stats/build.sh index 2bc8c7c6c..9e1d0d263 100644 --- a/assist-stats/build.sh +++ b/assist-stats/build.sh @@ -9,19 +9,20 @@ # Helper function exit_err() { - err_code=$1 - if [[ $err_code != 0 ]]; then - exit "$err_code" - fi + err_code=$1 + if [[ $err_code != 0 ]]; then + exit "$err_code" + fi } +source ../scripts/lib/_docker.sh -app="assist-stats" # Set the app variable to "chalice" +app="assist-stats" # Set the app variable to "chalice" environment=$1 git_sha=$(git rev-parse --short HEAD) image_tag=${IMAGE_TAG:-git_sha} envarg="default-foss" -chart="$app" # Use the app variable here +chart="$app" # Use the app variable here check_prereq() { which docker || { echo "Docker not installed, please install docker." @@ -32,31 +33,31 @@ check_prereq() { [[ $1 == ee ]] && ee=true [[ $PATCH -eq 1 ]] && { - image_tag="$(grep -ER ^.ppVersion ../scripts/helmcharts/openreplay/charts/$chart | xargs | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" - [[ $ee == "true" ]] && { - image_tag="${image_tag}-ee" - } + image_tag="$(grep -ER ^.ppVersion ../scripts/helmcharts/openreplay/charts/$chart | xargs | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" + [[ $ee == "true" ]] && { + image_tag="${image_tag}-ee" + } } update_helm_release() { - [[ $ee == "true" ]] && return - HELM_TAG="$(grep -iER ^version ../scripts/helmcharts/openreplay/charts/$chart | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" - # Update the chart version - sed -i "s#^version.*#version: $HELM_TAG# g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml - # Update image tags - sed -i "s#ppVersion.*#ppVersion: \"$image_tag\"#g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml - # Commit the changes - git add ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml - git commit -m "chore(helm): Updating $chart image release" + [[ $ee == "true" ]] && return + HELM_TAG="$(grep -iER ^version ../scripts/helmcharts/openreplay/charts/$chart | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" + # Update the chart version + sed -i "s#^version.*#version: $HELM_TAG# g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml + # Update image tags + sed -i "s#ppVersion.*#ppVersion: \"$image_tag\"#g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml + # Commit the changes + git add ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml + git commit -m "chore(helm): Updating $chart image release" } -function build_api(){ +function build_api() { destination="_assist_stats" [[ $1 == "ee" ]] && { destination="_assist_stats_ee" } [[ -d ../${destination} ]] && { - echo "Removing previous build cache" - rm -rf ../${destination} + echo "Removing previous build cache" + rm -rf ../${destination} } cp -R ../assist-stats ../${destination} cd ../${destination} || exit_err 100 @@ -86,5 +87,5 @@ check_prereq build_api $environment echo buil_complete if [[ $PATCH -eq 1 ]]; then - update_helm_release + update_helm_release fi diff --git a/assist/build.sh b/assist/build.sh index 116f12d94..a3621dad3 100644 --- a/assist/build.sh +++ b/assist/build.sh @@ -14,34 +14,35 @@ check_prereq() { exit 1 } } +source ../scripts/lib/_docker.sh [[ $1 == ee ]] && ee=true [[ $PATCH -eq 1 ]] && { - image_tag="$(grep -ER ^.ppVersion ../scripts/helmcharts/openreplay/charts/$chart | xargs | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" - [[ $ee == "true" ]] && { - image_tag="${image_tag}-ee" - } + image_tag="$(grep -ER ^.ppVersion ../scripts/helmcharts/openreplay/charts/$chart | xargs | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" + [[ $ee == "true" ]] && { + image_tag="${image_tag}-ee" + } } update_helm_release() { - chart=$1 - HELM_TAG="$(grep -iER ^version ../scripts/helmcharts/openreplay/charts/$chart | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" - # Update the chart version - sed -i "s#^version.*#version: $HELM_TAG# g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml - # Update image tags - sed -i "s#ppVersion.*#ppVersion: \"$image_tag\"#g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml - # Commit the changes - git add ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml - git commit -m "chore(helm): Updating $chart image release" + chart=$1 + HELM_TAG="$(grep -iER ^version ../scripts/helmcharts/openreplay/charts/$chart | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" + # Update the chart version + sed -i "s#^version.*#version: $HELM_TAG# g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml + # Update image tags + sed -i "s#ppVersion.*#ppVersion: \"$image_tag\"#g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml + # Commit the changes + git add ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml + git commit -m "chore(helm): Updating $chart image release" } -function build_api(){ +function build_api() { destination="_assist" [[ $1 == "ee" ]] && { destination="_assist_ee" } [[ -d ../${destination} ]] && { - echo "Removing previous build cache" - rm -rf ../${destination} + echo "Removing previous build cache" + rm -rf ../${destination} } cp -R ../assist ../${destination} cd ../${destination} @@ -68,5 +69,5 @@ function build_api(){ check_prereq build_api $1 if [[ $PATCH -eq 1 ]]; then - update_helm_release assist + update_helm_release assist fi diff --git a/backend/build.sh b/backend/build.sh index 049d6b8a4..1169064c5 100755 --- a/backend/build.sh +++ b/backend/build.sh @@ -92,4 +92,4 @@ function build_api() { } check_prereq -build_api $1 $2 +build_api i1 i2 diff --git a/ee/assist-stats/build.sh b/ee/assist-stats/build.sh index 2bc8c7c6c..9e1d0d263 100644 --- a/ee/assist-stats/build.sh +++ b/ee/assist-stats/build.sh @@ -9,19 +9,20 @@ # Helper function exit_err() { - err_code=$1 - if [[ $err_code != 0 ]]; then - exit "$err_code" - fi + err_code=$1 + if [[ $err_code != 0 ]]; then + exit "$err_code" + fi } +source ../scripts/lib/_docker.sh -app="assist-stats" # Set the app variable to "chalice" +app="assist-stats" # Set the app variable to "chalice" environment=$1 git_sha=$(git rev-parse --short HEAD) image_tag=${IMAGE_TAG:-git_sha} envarg="default-foss" -chart="$app" # Use the app variable here +chart="$app" # Use the app variable here check_prereq() { which docker || { echo "Docker not installed, please install docker." @@ -32,31 +33,31 @@ check_prereq() { [[ $1 == ee ]] && ee=true [[ $PATCH -eq 1 ]] && { - image_tag="$(grep -ER ^.ppVersion ../scripts/helmcharts/openreplay/charts/$chart | xargs | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" - [[ $ee == "true" ]] && { - image_tag="${image_tag}-ee" - } + image_tag="$(grep -ER ^.ppVersion ../scripts/helmcharts/openreplay/charts/$chart | xargs | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" + [[ $ee == "true" ]] && { + image_tag="${image_tag}-ee" + } } update_helm_release() { - [[ $ee == "true" ]] && return - HELM_TAG="$(grep -iER ^version ../scripts/helmcharts/openreplay/charts/$chart | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" - # Update the chart version - sed -i "s#^version.*#version: $HELM_TAG# g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml - # Update image tags - sed -i "s#ppVersion.*#ppVersion: \"$image_tag\"#g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml - # Commit the changes - git add ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml - git commit -m "chore(helm): Updating $chart image release" + [[ $ee == "true" ]] && return + HELM_TAG="$(grep -iER ^version ../scripts/helmcharts/openreplay/charts/$chart | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" + # Update the chart version + sed -i "s#^version.*#version: $HELM_TAG# g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml + # Update image tags + sed -i "s#ppVersion.*#ppVersion: \"$image_tag\"#g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml + # Commit the changes + git add ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml + git commit -m "chore(helm): Updating $chart image release" } -function build_api(){ +function build_api() { destination="_assist_stats" [[ $1 == "ee" ]] && { destination="_assist_stats_ee" } [[ -d ../${destination} ]] && { - echo "Removing previous build cache" - rm -rf ../${destination} + echo "Removing previous build cache" + rm -rf ../${destination} } cp -R ../assist-stats ../${destination} cd ../${destination} || exit_err 100 @@ -86,5 +87,5 @@ check_prereq build_api $environment echo buil_complete if [[ $PATCH -eq 1 ]]; then - update_helm_release + update_helm_release fi diff --git a/peers/build.sh b/peers/build.sh index 5a72fc2e3..75b65a587 100644 --- a/peers/build.sh +++ b/peers/build.sh @@ -14,35 +14,36 @@ check_prereq() { exit 1 } } +source ../scripts/lib/_docker.sh [[ $1 == ee ]] && ee=true [[ $PATCH -eq 1 ]] && { - image_tag="$(grep -ER ^.ppVersion ../scripts/helmcharts/openreplay/charts/$chart | xargs | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" - [[ $ee == "true" ]] && { - image_tag="${image_tag}-ee" - } + image_tag="$(grep -ER ^.ppVersion ../scripts/helmcharts/openreplay/charts/$chart | xargs | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" + [[ $ee == "true" ]] && { + image_tag="${image_tag}-ee" + } } update_helm_release() { - chart=$1 - HELM_TAG="$(grep -iER ^version ../scripts/helmcharts/openreplay/charts/$chart | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" - # Update the chart version - sed -i "s#^version.*#version: $HELM_TAG# g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml - # Update image tags - sed -i "s#ppVersion.*#ppVersion: \"$image_tag\"#g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml - # Commit the changes - git add ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml - git commit -m "chore(helm): Updating $chart image release" + chart=$1 + HELM_TAG="$(grep -iER ^version ../scripts/helmcharts/openreplay/charts/$chart | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" + # Update the chart version + sed -i "s#^version.*#version: $HELM_TAG# g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml + # Update image tags + sed -i "s#ppVersion.*#ppVersion: \"$image_tag\"#g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml + # Commit the changes + git add ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml + git commit -m "chore(helm): Updating $chart image release" } -function build_api(){ +function build_api() { destination="_peers" [[ $1 == "ee" ]] && { destination="_peers_ee" } [[ -d ../${destination} ]] && { - echo "Removing previous build cache" - rm -rf ../${destination} + echo "Removing previous build cache" + rm -rf ../${destination} } cp -R ../peers ../${destination} cd ../${destination} @@ -68,5 +69,5 @@ function build_api(){ check_prereq build_api $1 if [[ $PATCH -eq 1 ]]; then - update_helm_release peers + update_helm_release peers fi diff --git a/sourcemapreader/build.sh b/sourcemapreader/build.sh index 48e08a061..41e809243 100644 --- a/sourcemapreader/build.sh +++ b/sourcemapreader/build.sh @@ -13,6 +13,7 @@ image_name="sourcemapreader" git_sha=$(git rev-parse --short HEAD) image_tag=${IMAGE_TAG:-git_sha} envarg="default-foss" +source ../scripts/lib/_docker.sh check_prereq() { which docker || { @@ -24,31 +25,31 @@ check_prereq() { [[ $1 == ee ]] && ee=true [[ $PATCH -eq 1 ]] && { - image_tag="$(grep -ER ^.ppVersion ../scripts/helmcharts/openreplay/charts/$chart | xargs | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" - [[ $ee == "true" ]] && { - image_tag="${image_tag}-ee" - } + image_tag="$(grep -ER ^.ppVersion ../scripts/helmcharts/openreplay/charts/$chart | xargs | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" + [[ $ee == "true" ]] && { + image_tag="${image_tag}-ee" + } } update_helm_release() { - chart=$1 - HELM_TAG="$(grep -iER ^version ../scripts/helmcharts/openreplay/charts/$chart | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" - # Update the chart version - sed -i "s#^version.*#version: $HELM_TAG# g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml - # Update image tags - sed -i "s#ppVersion.*#ppVersion: \"$image_tag\"#g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml - # Commit the changes - git add ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml - git commit -m "chore(helm): Updating $chart image release" + chart=$1 + HELM_TAG="$(grep -iER ^version ../scripts/helmcharts/openreplay/charts/$chart | awk '{print $2}' | awk -F. -v OFS=. '{$NF += 1 ; print}')" + # Update the chart version + sed -i "s#^version.*#version: $HELM_TAG# g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml + # Update image tags + sed -i "s#ppVersion.*#ppVersion: \"$image_tag\"#g" ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml + # Commit the changes + git add ../scripts/helmcharts/openreplay/charts/$chart/Chart.yaml + git commit -m "chore(helm): Updating $chart image release" } -function build_api(){ +function build_api() { destination="_smr" [[ $1 == "ee" ]] && { destination="_smr_ee" } [[ -d ../${destination} ]] && { - echo "Removing previous build cache" - rm -rf ../${destination} + echo "Removing previous build cache" + rm -rf ../${destination} } cp -R ../sourcemapreader ../${destination} cd ../${destination} @@ -78,5 +79,5 @@ check_prereq build_api $1 echo buil_complete if [[ $PATCH -eq 1 ]]; then - update_helm_release sourcemapreader + update_helm_release sourcemapreader fi