One thing we discovered in the https://bugzilla.mozilla.org/show_bug.cgi?id=1456244 is the obvious problem that since Buildhub isn't a web server, it's really hard to find out; "What version of Buildhub do we use?" to which the counter-question is "Do you mean the scraper or the Lambda?"
The information is useful when reconciling the state of deployments. At the moment, you either trust that...
- Making a release automatically upgraded the scraper.
- That OPs has upgraded Stage/Prod Lambda/cron (check the latest "Upgrade This That for Buildhub v1.2.3" bug's status)
Another option is to instead inject an extra piece of information with each HTTP POST/PUT to Kinto that we don't pass along to kinto-elasticsearch.
For example:
Instead of:
kinto_client.create_record(record)
We do:
with open('./version.json') as f:
record['_metadata'] = {
'environment': 'cron', # or 'lambda' or 'sqs'
'timestamp': time.time(),
'version': json.load(f.read()),
}
kinto_client.create_record(record)
Then you can look up what environment/tool/version wrote the latest record from https://buildhub.prod.mozaws.net/v1/buckets/build-hub/collections/releases/records?_limit=3
- It's more data to store. More bytes.
- Perhaps it should be called
_buildhub_metadata so it's never confused with any of the data coming in from that buildhub.json whence it's ready.
- How do you even get the
version.json stuff in the Lambda code? One way would be to generate the file into the buildhub python package as package data. E.g. from buildhub import version; print(version.get_data())
- It still doesn't reduce down to 1 URL you can read (e.g. Whatsdeployed.io) but it's important to appreciate that Buildhub is two distinct things.
Another option is to write this information to another collection in the same kinto. E.g. Instead of
kinto_client.create_record(record)
we do:
kinto_client.create_record(record)
with open('./version.json') as f:
metadata = {
'environment': 'cron', # or 'lambda' or 'sqs'
'timestamp': time.time(),
'version': json.load(f.read()),
}
kinto_client_metadata.create_record(metadata)
Ideas? Thoughts?
One thing we discovered in the https://bugzilla.mozilla.org/show_bug.cgi?id=1456244 is the obvious problem that since Buildhub isn't a web server, it's really hard to find out; "What version of Buildhub do we use?" to which the counter-question is "Do you mean the scraper or the Lambda?"
The information is useful when reconciling the state of deployments. At the moment, you either trust that...
Another option is to instead inject an extra piece of information with each HTTP POST/PUT to Kinto that we don't pass along to kinto-elasticsearch.
For example:
Instead of:
We do:
Then you can look up what environment/tool/version wrote the latest record from https://buildhub.prod.mozaws.net/v1/buckets/build-hub/collections/releases/records?_limit=3
_buildhub_metadataso it's never confused with any of the data coming in from thatbuildhub.jsonwhence it's ready.version.jsonstuff in the Lambda code? One way would be to generate the file into thebuildhubpython package as package data. E.g.from buildhub import version; print(version.get_data())Another option is to write this information to another collection in the same kinto. E.g. Instead of
we do:
Ideas? Thoughts?