This is an automated email from the ASF dual-hosted git repository.

slawrence pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil-infrastructure.git


The following commit(s) were added to refs/heads/main by this push:
     new bb0d73c  Remove user input from the build release container
bb0d73c is described below

commit bb0d73ca634037aa36f5900f56d0d48b3e99a70c
Author: Steve Lawrence <[email protected]>
AuthorDate: Fri Dec 12 09:00:49 2025 -0500

    Remove user input from the build release container
    
    When building a release for checking reproducible builds, we currently
    require that users manually select the project name and enter the
    release candidate label. This can make it difficult to script and can
    lead to errors when entering the information. This user input is really
    just relic of when we required a lot more information. The current
    script only needs couple of pieces of information (project name and
    optional release label), so manual input isn't the best way to get that
    information anymore.
    
    This changes the script so the project name and optional release label
    must be provided as arguments to the script, removing all user input.
    Validation is added to ensure the project name is one of the expected
    projects and the pre-release label (if provided) is a valid release
    candidate label.
---
 .../build-release/src/daffodil-build-release       | 44 ++++++++++++----------
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/containers/build-release/src/daffodil-build-release 
b/containers/build-release/src/daffodil-build-release
index b547aa6..944e001 100755
--- a/containers/build-release/src/daffodil-build-release
+++ b/containers/build-release/src/daffodil-build-release
@@ -38,30 +38,36 @@ export CC=clang
 export AR=llvm-ar
 export SOURCE_DATE_EPOCH=$(git show --no-patch --format=%ct HEAD)
 
-echo "Select a project: "
-select PROJECT in daffodil daffodil-sbt daffodil-vscode; do
-  if [[ -n "$PROJECT" ]]
-  then
-    break;
-  fi
-  echo "invalid choice, select again"
-done
-
-echo
+if [[ "$#" -lt 1 || "$#" -gt 2 ]]
+then
+    echo "Error: Incorrect number of arguments provided." >&2
+    echo "Usage: $0 <project-name> [pre-release-label]" >&2
+    exit 1
+fi
 
-read -p "Pre-release label (e.g. rc1 to rc99) or empty for final release: " 
PRE_RELEASE_LABEL
-echo
+PROJECT="$1"
+if [[ ! $PROJECT =~ ^daffodil(-sbt|-vscode)?$ ]]
+then
+    echo "Error: Invalid project name. Must be daffodil, daffodil-sbt, or 
daffodil-vscode, but was $PROJECT" >&2
+    exit 1
+fi
 
-# determine the release version. If the pre-release label is not empty or all
-# whitespace, then append it to the project version. Otherwise we just build
-# without a pre-release label. This is potential useful for verifying
-# reproducible builds for final releases
+# determine the release version. If a pre-release label was provided, then 
append
+# it to the project version. Otherwise we just build without a pre-release
+# label. This is potentially useful for verifying reproducible builds for final
+# releases
 PROJECT_VERSION=$(cat VERSION)
-if [[ ! $PRE_RELEASE_LABEL =~ ^[\s]*$ ]]
+if [[ "$#" -eq 2 ]]
 then
-  RELEASE_VERSION=$PROJECT_VERSION-$PRE_RELEASE_LABEL
+    PRE_RELEASE_LABEL="$2"
+    if [[ ! $PRE_RELEASE_LABEL =~ ^rc[0-9]+$ ]]
+    then
+        echo "Error: Invalid pre-release label. Must be rcX, but was 
$PRE_RELEASE_LABEL" >&2
+        exit 1
+    fi
+    RELEASE_VERSION=$PROJECT_VERSION-$PRE_RELEASE_LABEL
 else
-  RELEASE_VERSION=$PROJECT_VERSION
+    RELEASE_VERSION=$PROJECT_VERSION
 fi
 
 echo "==== Building artifacts for $PROJECT $RELEASE_VERSION ===="

Reply via email to