@@ -7,24 +7,17 @@ PUSH="${PUSH:-0}"
77TAG=" ${TAG:- v1.0.0} "
88REGISTRY_ORG=" ${REGISTRY_ORG:- openshift-observability-ui} "
99DOCKER_FILE_NAME=" ${DOCKER_FILE_NAME:- Dockerfile.dev} "
10+ REPO=" ${REPO:- monitoring-plugin} "
1011
11- # Terminal output colors
12- YELLOW=' \033[0;33m'
13- ENDCOLOR=' \033[0m' # No Color
12+ # Define ANSI color codes
1413RED=' \033[0;31m'
14+ GREEN=' \033[0;32m'
15+ ENDCOLOR=' \033[0m'
1516
16-
17- # due to apple silicon limitation with installing npm packages inside amd64 images, builds of the frontend must be done outside the dockerfile.
18- if [[ " $OSTYPE " == " darwin" * ]] && [[ " $DOCKER_FILE_NAME " == " Dockerfile.mcp" ]]; then
19- printf " ${YELLOW} Updateing plugin-name ${ENDCOLOR} \n"
20- make update-plugin-name
21- export I18N_NAMESPACE=' plugin__monitoring-console-plugin'
22-
23- printf " ${YELLOW} Installing Frontend${ENDCOLOR} \n"
24- make install-frontend
25-
26- printf " ${YELLOW} Building Frontend${ENDCOLOR} \n"
27- make build-frontend
17+ # Prompt user for TAG
18+ read -p " $( echo -e " ${RED} Enter a value for TAG [${TAG} ]: ${ENDCOLOR} " ) " USER_TAG
19+ if [ -n " $USER_TAG " ]; then
20+ TAG=" $USER_TAG "
2821fi
2922
3023if [[ -x " $( command -v podman) " && $PREFER_PODMAN == 1 ]]; then
3326 OCI_BIN=" docker"
3427fi
3528
36- BASE_IMAGE=" quay.io/${REGISTRY_ORG} /monitoring-plugin "
29+ BASE_IMAGE=" quay.io/${REGISTRY_ORG} /${REPO} "
3730IMAGE=${BASE_IMAGE} :${TAG}
3831
32+ echo_vars () {
33+ echo " Environmental Variables set to : "
34+ echo -e " ${GREEN} PREFER_PODMAN: ${ENDCOLOR} ${PREFER_PODMAN} "
35+ echo -e " ${GREEN} PUSH: ${ENDCOLOR} ${PUSH} "
36+ echo -e " ${GREEN} TAG: ${ENDCOLOR} ${TAG} "
37+ echo -e " ${GREEN} REGISTRY_ORG: ${ENDCOLOR} ${REGISTRY_ORG} "
38+ echo -e " ${GREEN} DOCKER_FILE_NAME: ${ENDCOLOR} ${DOCKER_FILE_NAME} "
39+ echo -e " ${GREEN} REPO: ${ENDCOLOR} : ${REPO} "
40+ echo -e " ${GREEN} IMAGE: ${ENDCOLOR} : ${IMAGE} "
41+ }
42+ echo_vars
43+
44+ # Prompt use it check env vars before proceeding to build
45+ read -r -p " Are the environmental variables correct [y/N] " response
46+ if [[ " ${response: 0: 1} " =~ ^([nN])$ ]]
47+ then
48+ exit 0
49+ fi
50+
51+ # Build
52+ echo -e " ${GREEN} Linting... ${ENDCOLOR} "
3953make lint-backend
4054
41- echo " Building image '${IMAGE} ' with ${OCI_BIN} "
55+ echo -e " ${GREEN} Building image '${IMAGE} ' with ${OCI_BIN} ${ENDCOLOR }"
4256$OCI_BIN build -t $IMAGE --platform=linux/amd64 -f $DOCKER_FILE_NAME .
4357
44- if [[ $PUSH == 1 ]]; then
58+ if [[ $PUSH == 1 ]]; then
4559 $OCI_BIN push $IMAGE
4660fi
47-
48-
49- # Rollback local changes made
50- if [[ " $OSTYPE " == " darwin" * ]] && [[ " $DOCKER_FILE_NAME " == " Dockerfile.mcp" ]]; then
51- printf " ${YELLOW} Replacing in package.json and values.yaml${ENDCOLOR} \n"
52- sed -i ' s/"name": "monitoring-console-plugin",/"name": "monitoring-plugin",/g' web/package.json
53- printf " ${YELLOW} Renaming translations to the original plugin name${ENDCOLOR} \n"
54- cd web/locales/ && for dir in * ; do if cd $dir ; then for filename in * ; do mv plugin__monitoring-console-plugin.json plugin__monitoring-plugin.json; done ; cd ..; fi ; done
55- fi
0 commit comments