fix(build.sh): update image tag handling to prompt interactively if omitted

- Modified the build script to allow the image tag to be optional, prompting the user for input if not provided.
- Updated usage instructions to reflect the new behavior.
This commit is contained in:
AmirReza Jamali
2026-04-26 16:14:58 +03:30
parent 36cf088aa5
commit 1540679095
2 changed files with 20 additions and 6 deletions
+14 -4
View File
@@ -6,10 +6,10 @@ cd "$ROOT_DIR"
usage() { usage() {
cat <<EOF >&2 cat <<EOF >&2
Usage: $(basename "$0") <tag> [service] Usage: $(basename "$0") [tag] [service]
Arguments: Arguments:
tag Image tag (required), e.g. 200-develop tag Image tag (if omitted, asked interactively), e.g. 200-develop
service Service name (default: web) service Service name (default: web)
Environment variables: Environment variables:
@@ -20,6 +20,7 @@ Environment variables:
PUSH Set to 1 to docker push after build (default: 0) PUSH Set to 1 to docker push after build (default: 0)
Examples: Examples:
$(basename "$0")
$(basename "$0") 200-develop $(basename "$0") 200-develop
RUN_BUILD=1 $(basename "$0") 200-develop RUN_BUILD=1 $(basename "$0") 200-develop
$(basename "$0") 200-develop web $(basename "$0") 200-develop web
@@ -28,11 +29,11 @@ EOF
exit 1 exit 1
} }
if [[ $# -lt 1 || "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
usage usage
fi fi
TAG="$1" TAG="${1:-}"
SERVICE="${2:-web}" SERVICE="${2:-web}"
REGISTRY="${REGISTRY:-ovh-docker.aectest.ir}" REGISTRY="${REGISTRY:-ovh-docker.aectest.ir}"
PROJECT="${PROJECT:-tm}" PROJECT="${PROJECT:-tm}"
@@ -40,6 +41,15 @@ DOCKERFILE="${DOCKERFILE:-$ROOT_DIR/Dockerfile}"
RUN_BUILD="${RUN_BUILD:-0}" RUN_BUILD="${RUN_BUILD:-0}"
PUSH="${PUSH:-0}" PUSH="${PUSH:-0}"
if [[ -z "$TAG" ]]; then
read -r -p "Enter image tag (example: 200-develop): " TAG
fi
if [[ -z "$TAG" ]]; then
echo "Tag is required." >&2
exit 1
fi
if [[ "$DOCKERFILE" != /* ]]; then if [[ "$DOCKERFILE" != /* ]]; then
DOCKERFILE="$ROOT_DIR/$DOCKERFILE" DOCKERFILE="$ROOT_DIR/$DOCKERFILE"
fi fi
+6 -2
View File
@@ -64,14 +64,18 @@ Cypress.Commands.add("setAuthCookies", (userOverrides = {}) => {
); );
}); });
Cypress.Commands.add("mockAdminsList", (options = {}) => { Cypress.Commands.add("mockAdminsList", (options: Cypress.AdminListMockOptions = {}) => {
const users = options.users ?? [createAdminUser()]; const users = options.users ?? [createAdminUser()];
const offset = options.offset ?? 0; const offset = options.offset ?? 0;
const limit = options.limit ?? 10; const limit = options.limit ?? 10;
const total = options.total ?? users.length; const total = options.total ?? users.length;
const statusCode = options.statusCode ?? 200; const statusCode = options.statusCode ?? 200;
const delay = options.delay ?? 0; const delay = options.delay ?? 0;
const query = options.query; const query = options.query
? Object.fromEntries(
Object.entries(options.query).map(([key, value]) => [key, String(value)]),
)
: undefined;
cy.intercept( cy.intercept(
{ {