# definitions.
#
-# Install Jenkins-jobs
+# Create the virtualenv
virtualenv venv
. venv/bin/activate
+# Define and ensure the PIP cache
PIP_SDIST_INDEX="$HOME/.cache/pip"
-
mkdir -p $PIP_SDIST_INDEX
+# Install the package by trying with the cache first, otherwise doing a download only, and then
+# trying to install from the cache again.
if ! venv/bin/pip install --find-links="file://$PIP_SDIST_INDEX" --no-index jenkins-job-builder; then
venv/bin/pip install --download-directory="$PIP_SDIST_INDEX" jenkins-job-builder
venv/bin/pip install --find-links="file://$PIP_SDIST_INDEX" --no-index jenkins-job-builder
fi
+# XXX This needs to be done for *every* project defined in the current repo, not only
+# the JJB one.
# Create the definitions testing them first
-venv/bin/jenkins-jobs test jjb/config/definitions -o output
+venv/bin/jenkins-jobs test jjb/config/definitions -o /tmp/output
# Update Jenkins with the output
# Note that this needs proper permissions with the right credentials to the
-# correct Jenkins instance
+# correct Jenkins instance.
venv/bin/jenkins-jobs update jjb/config/definitions