From 1540679095c06b73ab11efafcbfe0d385e3d197a Mon Sep 17 00:00:00 2001 From: AmirReza Jamali Date: Sun, 26 Apr 2026 16:14:58 +0330 Subject: [PATCH] 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. --- build.sh | 18 ++++++++++++++---- cypress/support/commands.ts | 8 ++++++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/build.sh b/build.sh index f2976f7..5d5a09b 100755 --- a/build.sh +++ b/build.sh @@ -6,10 +6,10 @@ cd "$ROOT_DIR" usage() { cat <&2 -Usage: $(basename "$0") [service] +Usage: $(basename "$0") [tag] [service] 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) Environment variables: @@ -20,6 +20,7 @@ Environment variables: PUSH Set to 1 to docker push after build (default: 0) Examples: + $(basename "$0") $(basename "$0") 200-develop RUN_BUILD=1 $(basename "$0") 200-develop $(basename "$0") 200-develop web @@ -28,11 +29,11 @@ EOF exit 1 } -if [[ $# -lt 1 || "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then +if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then usage fi -TAG="$1" +TAG="${1:-}" SERVICE="${2:-web}" REGISTRY="${REGISTRY:-ovh-docker.aectest.ir}" PROJECT="${PROJECT:-tm}" @@ -40,6 +41,15 @@ DOCKERFILE="${DOCKERFILE:-$ROOT_DIR/Dockerfile}" RUN_BUILD="${RUN_BUILD:-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 DOCKERFILE="$ROOT_DIR/$DOCKERFILE" fi diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 04c1701..dab03c0 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -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 offset = options.offset ?? 0; const limit = options.limit ?? 10; const total = options.total ?? users.length; const statusCode = options.statusCode ?? 200; 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( {