Page MenuHomePhabricator

Add a generic key-value mapping table to Harbormaster
AbandonedPublic

Authored by epriestley on Oct 15 2015, 1:54 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Mar 13, 6:35 AM
Unknown Object (File)
Sat, Mar 9, 11:51 PM
Unknown Object (File)
Tue, Mar 5, 1:13 AM
Unknown Object (File)
Mon, Mar 4, 4:41 PM
Unknown Object (File)
Mon, Mar 4, 4:41 PM
Unknown Object (File)
Fri, Mar 1, 9:06 AM
Unknown Object (File)
Feb 7 2024, 11:00 PM
Unknown Object (File)
Feb 3 2024, 6:50 AM
Subscribers
None

Details

Summary

Ref T9456. When we tell CircleCI to build something, it's going to give us back a build ID, like "123".

Later, it will make a call to us saying "I finished the build for build 123, here it is: ...".

We need to be able to go figure out what "build 123" is. There's no real way to do this right now. We can store it on a target, but we can't efficiently figure out which target it is on without loading every target and then looking at all of them, which would be really slow.

Add a basic indexed key-value table so we can write something like <circleci.build#123, PHID-HMBT-abcdeffe23f2> and figure out which target the build is talking about.

Test Plan

Clean bin/storage upgrade? This will get used properly in the next diff or two and I'll fix it if anything doesn't work.

Diff Detail

Repository
rP Phabricator
Branch
circle2
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 8295
Build 9504: Run Core Tests
Build 9503: arc lint + arc unit

Event Timeline

epriestley retitled this revision from to Add a generic key-value mapping table to Harbormaster.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.

There's a fairly good chance that this will be "circle CI build number storage table" forever, but it's only like 80 lines even if that's true.

chad edited edge metadata.
This revision is now accepted and ready to land.Oct 15 2015, 2:43 AM

This appears to be working OK in the next diff, although I'm not reading it yet:

mysql> select * from harbormaster_keyvaluepair;
+----+--------------------------------+--------------+-------------------+------------------------------------------------------+-------------+--------------+
| id | objectPHID                     | pairIndex    | pairKey           | pairValue                                            | dateCreated | dateModified |
+----+--------------------------------+--------------+-------------------+------------------------------------------------------+-------------+--------------+
|  1 | PHID-HMBT-kud3bm7apbays2lmw7so | qyy6SlT5RxYW | circleci.build(2) | {"buildTargetPHID":"PHID-HMBT-kud3bm7apbays2lmw7so"} |  1444879444 |   1444879444 |
|  2 | PHID-HMBT-v6eychoop5ofpxh5tpt5 | lo6ftFSlkC6G | circleci.build(3) | {"buildTargetPHID":"PHID-HMBT-v6eychoop5ofpxh5tpt5"} |  1444879496 |   1444879496 |
|  3 | PHID-HMBT-k4suf5k76icw7kdzght3 | yPBSScDO5s1t | circleci.build(4) | {"buildTargetPHID":"PHID-HMBT-k4suf5k76icw7kdzght3"} |  1444879790 |   1444879790 |
+----+--------------------------------+--------------+-------------------+------------------------------------------------------+-------------+--------------+
3 rows in set (0.00 sec)

We can actually figure out which target it is from the callback, since we get all the parameters we passed back. This is good: simpler, and no race window.