zuul/zuul/lib
James E. Blair be50a6ca42 Freeze job variables at start of build
Freze Zuul job variables when starting a build so that jinja
templates can not be used to expose secrets.  The values will be
frozen by running a playbook with set_fact, and that playbook
will run without access to secrets.  After the playbook
completes, the frozen variables are read from and then removed
from the fact cache.  They are then supplied as normal inventory
variables for any trusted playbooks or playbooks with secrets.

The regular un-frozen variables are used for all other untrusted
playbooks.

Extra-vars are now only used to establish precedence among all
Zuul job variables.  They are no longer passed to Ansible with
the "-e" command line option, as that level of precedence could
also be used to obtain secrets.

Much of this work is accomplished by "squashing" all of the Zuul
job, host, group, and extra variables into a flat structure for
each host in the inventory.  This means that much of the variable
precedence is now handled by Zuul, which then gives Ansible
variables as host vars.  The actual inventory files will be much
more verbose now, since each host will have a copy of every "all"
value.  But this allows the freezing process to be much simpler.

When writing the inventory for the setup playbook, we now use the
!unsafe YAML tag which is understood by Ansible to indicate that
it should not perform jinja templating on variables.  This may
help to avoid any mischief with templated variables since they
have not yet been frozen.

Also, be more strict about what characters are allowed in ansible
variable names.  We already checked job variables, but we didn't
verify that secret names/aliases met the ansible variable
requirements.  A check is added for that (and a unit test that
relied on the erroneous behavior is updated).

Story: 2008664
Story: 2008682
Change-Id: I04d8b822fda6628e87a4a57dc368f20d84ae5ea9
2021-06-24 06:24:23 -07:00
..
__init__.py Initial commit. 2012-05-29 14:49:32 -07:00
ansible-config.conf Add boto3 to default executor venv packages 2021-04-23 16:10:58 +02:00
ansible.py Cleanup Zuul's stdout/stderr output 2021-06-04 11:42:02 -07:00
auth.py Bump pyjwt to 2.0.0 2021-01-14 12:35:18 +00:00
capabilities.py OIDCAuthenticator: add capabilities, scope option 2020-03-27 16:47:21 +00:00
collections.py Implementation of Zookeeper backed event queues 2021-03-18 09:24:07 +01:00
commandsocket.py Improve test output by using named queues 2021-03-24 07:39:15 +01:00
config.py Support boolean values in get_default 2019-02-15 10:42:36 +01:00
connections.py Interface to get a driver's trigger event class 2021-03-18 09:23:49 +01:00
dependson.py Support cross-source dependencies 2018-01-16 09:37:40 -08:00
encryption.py Store secrets keys and SSH keys in Zookeeper 2021-04-14 08:22:07 +02:00
filecomments.py Make github file annotation levels configurable via zuul return 2020-03-06 08:27:48 +01:00
fingergw.py Improve component registry 2021-05-17 16:47:13 -07:00
gear_utils.py Add support for zones in executors 2018-11-29 13:05:20 -05:00
gearworker.py Catch exception when double unregistering merge jobs 2021-02-25 23:18:00 +01:00
jsonutil.py jsonutil: do not encode SourceContext or ZuulMark 2019-06-05 10:47:05 +00:00
keystorage.py Cache secret/SSH keys from Zookeeper 2021-04-22 13:26:10 +02:00
log_streamer.py Replace deprecated Thread.isAlive() with Thread.is_alive() 2020-06-01 12:49:07 +02:00
logutil.py Format multi-line log entries 2021-01-29 11:11:23 -08:00
queue.py Improve test output by using named queues 2021-03-24 07:39:15 +01:00
re2util.py Remove ununecessary shebangs 2020-05-18 19:10:33 +02:00
repl.py Add repl server for debug purposes 2019-06-21 16:12:03 +00:00
result_data.py Support emitting warnings via zuul_return 2020-08-31 11:54:46 +02:00
statsd.py dict_object.keys() is not required for *in* operator 2018-12-03 12:04:55 +05:30
streamer_utils.py Remove unecessary shebang and exec bit 2018-07-26 07:12:24 +00:00
strings.py Freeze job variables at start of build 2021-06-24 06:24:23 -07:00
tarjan.py Add optional support for circular dependencies 2021-03-01 19:42:56 +01:00
yamlutil.py Freeze job variables at start of build 2021-06-24 06:24:23 -07:00