From 6010ba62835ce81a4f4fad140d274a77c1bd3752 Mon Sep 17 00:00:00 2001
From: dd
Date: Sat, 6 Jul 2024 12:39:08 +0200
Subject: added automated script options remembering
---
auto/helper-logic | 26 +++++++++++++++++++++++---
readme.md | 4 ++--
2 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/auto/helper-logic b/auto/helper-logic
index 7c1360c..7087756 100644
--- a/auto/helper-logic
+++ b/auto/helper-logic
@@ -30,6 +30,10 @@ JENKINS_DOCKERDECLARATIVE_FILE=/var/lib/jenkins/org.jenkinsci.plugins.docker.wor
# Define the job template variables.
TEMPLATE_FILE="jobs/jobTemplate.xml"
WORKDIR="/tmp/seed-jobs"
+SETTINGS_DIR="/var/cache/vyos-installer"
+if [ ! -d "$SETTINGS_DIR" ]; then
+ mkdir "$SETTINGS_DIR"
+fi
# Skip the stage check
STAGE_CHECK_DISABLED=false
@@ -37,17 +41,33 @@ if [ "$1" == "--force" ]; then
STAGE_CHECK_DISABLED=true
fi
+# Remember branding removal (load if present and $NOT_VYOS is unset)
+NOT_VYOS_MEMORY="$SETTINGS_DIR/vyos_branding_removal"
+if [[ -z ${NOT_VYOS+x} ]] && [ -f "$NOT_VYOS_MEMORY" ]; then
+ NOT_VYOS=$(cat "$NOT_VYOS_MEMORY")
+else
+ echo "$NOT_VYOS" > "$NOT_VYOS_MEMORY"
+fi
+
+# Remember branch (load if present and $BRANCH is unset)
+SELECTED_BRANCH_MEMORY="$SETTINGS_DIR/vyos_selected_branch"
+if [[ -z ${BRANCH+x} ]] && [ -f "$SELECTED_BRANCH_MEMORY" ]; then
+ BRANCH=$(cat "$SELECTED_BRANCH_MEMORY")
+else
+ echo "$BRANCH" > "$SELECTED_BRANCH_MEMORY"
+fi
+
# Filters to limit jobs to specific branch
EXCLUDED_DESCRIPTION=""
SELECTED_BRANCH="$BRANCH"
-if [ "$BRANCH" == "sagitta" ]; then
+if [ "$SELECTED_BRANCH" == "sagitta" ]; then
EXCLUDED_DESCRIPTION="equuleus-only"
SELECTED_BRANCH_REGEX="(sagitta|current)"
-elif [ "$BRANCH" == "equuleus" ]; then
+elif [ "$SELECTED_BRANCH" == "equuleus" ]; then
EXCLUDED_DESCRIPTION="sagitta-only"
SELECTED_BRANCH_REGEX="equuleus"
else
- if [ "$BRANCH" != "" ]; then
+ if [ "$SELECTED_BRANCH" != "" ]; then
>&2 echo -e "${RED}Unknown branch: $SELECTED_BRANCH, please provide valid \$BRANCH (sagitta or equuleus)${NOCOLOR}"
exit 1
fi
diff --git a/readme.md b/readme.md
index bcbc959..36feb1a 100644
--- a/readme.md
+++ b/readme.md
@@ -83,7 +83,7 @@ cd /opt/vyos-jenkins
**If you want to build only specific branch**
Configure `BRANCH` environment variable to desired branch before you run any script.
-Not defined or empty value means all branches (the default).
+Default or empty value means all branches. This setting is remembered, you can override by defining empty value.
```bash
export BRANCH="sagitta"
@@ -93,7 +93,7 @@ export BRANCH="sagitta"
Then you should remove VyOS branding, you can do this by configuring `NOT_VYOS` environment variable to `yes`
before you run any script. Beware - by default, the ISO will include VyOS branding thus you shall not distribute
-the ISO.
+the ISO. This setting is remembered, you can override by defining empty value.
```bash
export NOT_VYOS="yes"
--
cgit v1.2.3