Coverage / crates/hub/src/variables.rs 100.0%
80 of 80 lines run, 26 of 41 functions · run #520 on main · run missed
| 1 | //! Variables for OxygenFlow jobs (hub spec §13.2, oxygenhub#102): plain | |
| 2 | //! `NAME=value` pairs kept per site, organisation and repository. A job | |
| 3 | //! gets its repository's effective set, inner levels overriding outer, as | |
| 4 | //! the claim's `env`; Flow sets them under `FLOW_*` and the pipeline's | |
| 5 | //! own `env`. They are not secrets and are shown in full on the settings | |
| 6 | //! pages; secrets are mounted by Flow (OxygenFlow spec §9). | |
| 7 | | |
| 8 | use crate; | |
| 9 | use crate; | |
| 10 | use FromRow; | |
| 11 | use BTreeMap; | |
| 12 | ||
| 13 | /// How many a level may hold. | |
| 14 | pub const MAX_PER_LEVEL: usize = 100; | |
| 15 | /// The longest value. | |
| 16 | pub const MAX_VALUE: usize = 4096; | |
| 17 | ||
| 18 | | |
| 19 | | |
| 20 | | |
| 21 | | |
| 22 | | |
| 23 | | |
| 24 | | |
| 25 | | |
| 26 | ||
| 27 | /// A variable's name: a letter or `_`, then letters, digits and `_`, up | |
| 28 | /// to 64; never `FLOW_*`, which Flow sets itself. | |
| 29 | 12× | |
| 30 | 12× | |
| 31 | 12× | |
| 32 | 43× | |
| 33 | 12× | |
| 34 | ||
| 35 | /// A value: up to 4096 characters, no control characters but newline and tab. | |
| 36 | 7× | |
| 37 | 35× | |
| 38 | 7× | |
| 39 | ||
| 40 | 759× | pub async |
| 41 | 759× | |
| 42 | 759× | |
| 43 | 759× | |
| 44 | 759× | |
| 45 | 759× | |
| 46 | 759× | |
| 47 | ||
| 48 | /// Set a variable at a level, new or changed. | |
| 49 | 5× | pub async |
| 50 | 5× | |
| 51 | 5× | |
| 52 | 5× | |
| 53 | 5× | |
| 54 | 5× | |
| 55 | 5× | |
| 56 | 5× | |
| 57 | 5× | |
| 58 | 5× | |
| 59 | 5× | |
| 60 | 5× | |
| 61 | 5× | |
| 62 | 5× | |
| 63 | ||
| 64 | /// Remove a variable from a level; false when it was not there. | |
| 65 | 1× | pub async |
| 66 | 1× | |
| 67 | 1× | |
| 68 | 1× | |
| 69 | 1× | |
| 70 | 1× | |
| 71 | 1× | |
| 72 | 1× | |
| 73 | 1× | |
| 74 | ||
| 75 | /// Forget a level's variables, when the organisation or repository goes. | |
| 76 | 1× | pub async |
| 77 | 1× | |
| 78 | 1× | |
| 79 | 1× | |
| 80 | ||
| 81 | /// A variable as a level sees it: where it comes from, and whether the | |
| 82 | /// level's own value hides it. | |
| 83 | | |
| 84 | | |
| 85 | | |
| 86 | | |
| 87 | | |
| 88 | | |
| 89 | | |
| 90 | | |
| 91 | ||
| 92 | /// Every variable a level sees, outermost first, inherited ones marked | |
| 93 | /// overridden where an inner level sets the same name. | |
| 94 | 420× | pub async |
| 95 | 420× | |
| 96 | 420× | |
| 97 | 420× | |
| 98 | 757× | |
| 99 | 757× | |
| 100 | 32× | |
| 101 | 6× | |
| 102 | 6× | |
| 103 | 32× | |
| 104 | | |
| 105 | | |
| 106 | 420× | |
| 107 | 420× | |
| 108 | ||
| 109 | /// The variables a repository's jobs get. | |
| 110 | 160× | pub async |
| 111 | 160× | |
| 112 | 160× | |
| 113 | 160× | |
| 114 | 160× | |
| 115 | 160× | |
| 116 | 160× | |
| 117 | 160× | |
| 118 | ||
| 119 | | |
| 120 | | |
| 121 | | |
| 122 | | |
| 123 | | |
| 124 | 1× | |
| 125 | 1× | |
| 126 | 1× | |
| 127 | 1× | |
| 128 | 1× | |
| 129 | 1× | |
| 130 | |