mkjobs implies what it does, not when it does it. There are other things
a user might want to do after refreshing a repo - e.g. installing new
dependencies. Make the naming more reflective of that.
This simply sets an environment variable for tests to determine whether
they are in a production environment or not. What that means is really
up to an individual deployment. Our need, for example, is that we have
a "test" that just frees up nodes in the lab. We only want the production
environment doing that.
Call refreshjobs action script when doing initial jenkins job import
Eliminates duplicate code, and also allows the mkjobs hook to be called
during initial import. It will cause a git pull to happen right after
the initial clone - likely a no-op, but adds a bit of overhead.
Now that we've a suitable (and working!) replacement in place, get rid
of the @when_file_changed trigger.
Existing Scalebot config repos with jobs that make use of this trigger
will need to be updated. Though, AFAICT, those jobs don't work today
anyway. I tried watching juju debug-log while making changes to the
/var/lib/jenkins/updatejobs file, but I didn't see anything happen.
Make 'refreshjobs' action just a small wrapper around pull-and-reload-jobs
Instead of relying on the @when_file_changed('/var/lib/jenkins/updatejobs')
hack, lets make the action synchronous by having it run pull-and-reload-jobs
directly.
Now that
- The git config contains everything we need to do a pull
- The necessary commands are in a predictable place
- The jobset is available outside of charm context
We can create a simple shell script to refresh git and update jobs.
Make jobsync.py available to jenkins user in predictable path
We want a jenkins jobs to be able to update jobs directly, so we need
the jenkins user to be able to find the jobsync.py script. In charm
context, we know it lives under $JUJU_CHARM_DIR, but $JUJU_CHARM_DIR
isn't set outside of charm context. So, let's put move jobsync.py
into a "bin" directory in the charm and symlink that into
$SCALEBOT_HOME, which is now exported system-wide.