Hashar has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/361843 )

Change subject: castor: get rid of intermediate env file
......................................................................

castor: get rid of intermediate env file

castor-set-namespace.env is used to factor out the logic that sets
$CASTOR_NAMESPACE.

Using JJB include-raw, we can compose various shell scripts snippets
that would end up being executed in the same shell. Hence variables sets
in one will be available to the following snippets:

 - shell:
    !include-raw:
        - castor-define-namespace.bash
        - castor-load-sync.bash

Add a set -u to fail early in case $CASTOR_NAMESPACE is not set.

Change-Id: I0ffd1aa9358e2a853d09c55c4b293b016542c4f0
---
M jjb/castor-define-namespace.bash
M jjb/castor-load-sync.bash
M jjb/castor-save-sync.bash
M jjb/castor.yaml
4 files changed, 8 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/integration/config 
refs/changes/43/361843/1

diff --git a/jjb/castor-define-namespace.bash b/jjb/castor-define-namespace.bash
index a2f5b6c..f03ced4 100644
--- a/jjb/castor-define-namespace.bash
+++ b/jjb/castor-define-namespace.bash
@@ -18,5 +18,5 @@
 CASTOR_NAMESPACE="${NS_PROJECT}/${NS_BRANCH}/${NS_JOB}"
 
 # Ex: mediawiki-core/REL1_26/tox-jessie
-echo "declare -x CASTOR_NAMESPACE=\"$CASTOR_NAMESPACE\"" > 
castor-set-namespace.env
+declare -x CASTOR_NAMESPACE="$CASTOR_NAMESPACE"
 echo "Defined: CASTOR_NAMESPACE=\"$CASTOR_NAMESPACE\""
diff --git a/jjb/castor-load-sync.bash b/jjb/castor-load-sync.bash
index ca589bf..20365cd 100644
--- a/jjb/castor-load-sync.bash
+++ b/jjb/castor-load-sync.bash
@@ -1,7 +1,6 @@
 # castor-load
 # Load cache from central repository
-
-. castor-set-namespace.env
+set -u
 
 echo "Syncing..."
 rsync \
diff --git a/jjb/castor-save-sync.bash b/jjb/castor-save-sync.bash
index dd95fab..1739e08 100644
--- a/jjb/castor-save-sync.bash
+++ b/jjb/castor-save-sync.bash
@@ -1,5 +1,4 @@
 set -eu +x
-. castor-set-namespace.env
 
 ssh_config=($TRIGGERED_SSH_CONNECTION)
 REMOTE_INSTANCE="${ssh_config[2]}"
diff --git a/jjb/castor.yaml b/jjb/castor.yaml
index 3dd82b7..bf0ba4d 100644
--- a/jjb/castor.yaml
+++ b/jjb/castor.yaml
@@ -31,12 +31,6 @@
                     failure-threshold: 'never'
 
 
-- builder:
-    name: castor-define-namespace
-    builders:
-        - shell:
-            !include-raw: castor-define-namespace.bash
-
 # Entry point to load cache from central cache
 #
 # Forge the namespace and rsync from central place.
@@ -47,9 +41,10 @@
 - builder:
     name: castor-load
     builders:
-        - castor-define-namespace
         - shell:
-            !include-raw: castor-load-sync.bash
+            !include-raw:
+                - castor-define-namespace.bash
+                - castor-load-sync.bash
 
 
 # Job triggered on the central repository instance
@@ -91,6 +86,6 @@
         - shell:
             !include-raw: castor-save-filter.bash
         - shell:
-            !include-raw: castor-define-namespace.bash
-        - shell:
-            !include-raw: castor-save-sync.bash
+            !include-raw:
+                - castor-define-namespace.bash
+                - castor-save-sync.bash

-- 
To view, visit https://gerrit.wikimedia.org/r/361843
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ffd1aa9358e2a853d09c55c4b293b016542c4f0
Gerrit-PatchSet: 1
Gerrit-Project: integration/config
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to