openzipkin-attic / apache-release-verification

Apache License 2.0
3 stars 1 forks source link

Add support for fetching remote configuration #35

Open abesto opened 5 years ago

abesto commented 5 years ago

(Note this is on top of #34 ) Fixes #23

This allows defining per-project options in some central location. For convenience PROJECT/MODULE expands to https://openzipkin-contrib.github.io/apache-release-verification/presets/PROJECT/MODULE.yaml; that is, the gh-pages branch of this repo can serve as a central repository of configurations, but anyone is free to distribute their own configs however they like, as long as it's accessible over HTTP or HTTPS.

As a proof of concept I've uploaded https://openzipkin-contrib.github.io/apache-release-verification/presets/zipkin/zipkin.yaml with the following contents:

project: zipkin
module: zipkin
zipname-template: 'apache-{module}{dash_incubating}-{version}-source-release'
github-reponame-template: '{incubator_dash}{module}.git'

That means one can now validate a Zipkin release as such:

python3 src/main.py \
  --version 2.13.0 --gpg-key DA805D02 \
  --git-hash 7c08091d3f8b0428d1d78839d3bef0f6887746f2 \
  --remote-config zipkin/zipkin

The --remote-config option accepts full URLs as well, so zipkin/zipkin is equivalent to https://openzipkin-contrib.github.io/apache-release-verification/presets/zipkin/zipkin.yaml.

Note that --config and --remote-config can appear together (and are resolved in the order they're provided on the command line, with the latter overriding values provided by the former). So this can also be written, given a local zipkin.yaml with the keys version, gpg-key, and git-hash:

python3 src/main.py --config zipkin-2.13.0.yaml --remote-config zipkin/zipkin

A remote-config field in a local config file gets evaluated (but can be overridden via a command-line argument, like everything else specified via a local or remote config file)

When --remote-config is not passed in, we try to infer it as project/module. Unlike explicitly defined --remote-config values, there is no error raised if this inferred remote config file doesn't exist.

abesto commented 5 years ago

Alright, I'm now pretty happy with this. It can correctly load config options from a local file, a remote file, and do a best-effort try to get remote config based on the project and module name.

abesto commented 5 years ago

Heads up, I'll be merging this end of next week unless someone stops me. There are many changes here, and we're getting into merge-conflict-nightmare territory.