| 10 Apr 2022 |
tilpner | I already have a few flakes, but (though I haven't tried it yet) I hope I can use flake-compat to use them even in legacy mode | 14:11:28 |
tomberek | back to the problem.... the trouble is that branch names and tags are not reproducible, so it's not something normally included into an evaluation | 14:11:30 |
tomberek | eg: should a specific git commit checkout behave differently based on what branches and tags exist due to the git server it happens to live on? | 14:12:18 |
tilpner | And yes, though building both variants works, there are actually two applications, and building just one variant for it takes a few minutes, so eliminating unused variants could decrease valuable push-to-deployed latencies | 14:12:35 |
tilpner | In reply to @tomberek:matrix.org eg: should a specific git commit checkout behave differently based on what branches and tags exist due to the git server it happens to live on? Perhaps not in an unchecked universal way, but it would certainly make this task easier | 14:14:11 |
tilpner | ... how hard would it be to make hydra expose the branch name to builds? | 14:14:55 |
tomberek | yeah.... i'm thinking.... you can have something in the production branch, a file like .version (nixpkgs has one) | 14:15:04 |
tilpner | (alternatively, this is solved-ish by https://github.com/NixOS/hydra/pull/1143) | 14:15:51 |
tomberek | the problem is that now the branch name leaks into builds... and changes behavior... the whole point of flakes is that it must be reproducible, and the branch name leaking in means even if I'm on the same commit as you, i may get different behavior. | 14:15:52 |
tilpner | which is of course also an impurity, so I don't know if it has a chance of being merged | 14:16:12 |
tilpner | hmm, maybe not actually an impurity, as the same -A foo will always lead to the same result, it's just that hydra will pass different -A values... | 14:17:08 |
tilpner | you make a good point, depending on actual branches names is annoyingly brittle. passing in a tag (or attribute name) would work regardless of git branch and also support evaluation if the input isn't being fetched from git | 14:18:43 |
tomberek | that's just because you only intend to turn some jobs on/off, but you COULD make that substantially change behavior and users would have no idea. And the behavior of the same commit will change over time. | 14:18:57 |
tomberek | i think the .version or .branch file is the easiest way to smuggle the branch name in | 14:19:35 |
tomberek | you can make your push-to-deployment only depend on the job that matters, not the entire jobset | 14:25:24 |
tilpner | okay, you've convinced me that source control information should never reach the build, so instead I'd need to communicate a tag/mode/variant to the jobset | 14:26:11 |
tilpner | adding that file to the repo would work, of course, but then you lose the ability of simply pushing the staging branch to the production branch whenever it's ready | 14:27:59 |
tilpner | who determines whether #1143 has a chance of being merged? | 14:28:28 |
tilpner | (I'm happy to run a patched hydra, but if the answer is a "this will never be accepted", I'll need to keep looking for a different way to make this work) | 14:29:11 |
tomberek | wait..... if you have a flow where you push from staging branch to production.... the builds should already be cached | 14:33:08 |
tomberek | if you built on staging..... .cache it.... then production builds are instant | 14:33:27 |
tilpner | true, and in a way it makes sense to test if production builds before allowing it for staging, but staging pushes are going to be much more frequent than production pushes, so that's still a lot of wasted builds | 14:37:42 |
tilpner | * true, and in a way it makes sense to test if production builds before allowing it for staging, but staging pushes are going to be much more frequent than production pushes, so that's still a lot of wasted time, waiting for production builds to finish, just to deploy staging | 14:39:30 |
tomberek | depend on the job to complete, not the jobset | 14:41:49 |
tilpner | does hydra allow job prioritisation? if I could make sure the staging variant always builds first, and then rely on the production build being cached from a previous evaluation, that might work | 14:43:44 |
tilpner | ahh, there's schedulingPriority | 14:45:17 |
tilpner |
Slightly prioritizes this job over other jobs within this jobset.
| 14:45:38 |
tomberek | what might be accepted upstream is to specify only particular jobs to be built. Something like "in flake.nix build hydraJobs.production" | 14:48:52 |
tomberek | (versus, "build every hydraJob in the flake") | 14:54:50 |
tilpner | that's a slightly restricted version of https://github.com/NixOS/hydra/pull/1143, so maybe that'll be accepted as well. and graham's reaction in #1154 didn't seem opposed to the feature | 14:56:13 |