News for hackers. Stuff that matters.
Re:The End of CI by hinkley on Sunday July 03, 2022 @02:39AM (#31965619)
I always have to be careful responding to things like this because I get sucked into the trap of thinking “we” means myself, and it just needs to mean “most of us” for whatever they’re talking about to be worrisome or even true.

I do worry that a lot of people are missing the first principles where CI is concerned, but a few of us still remember. Whether that’s enough is always a question.

> First, CI rarely knows what has changed, so everything needs to be rebuilt and retested

CI is the impartial judge in your system. That is the ultimate goal and much of the value. Don’t believe me when I say that your check in broke something. Believe the robot. It does not think, it does not interpret errors (which is why intermittent failures poison the well). It just knows that whatever you did was not good.

We make it stupid simple because the more ways you try to interpret things, the higher the likelihood the system will either miss an error or report imaginary ones. And in this case I am very sorry Mr Lasso, but it is in fact the hope that kills. Optimism makes us try things, things others would give up on. That’s what makes a piece of software good. Better. But too much and you start ignoring very real problems and make optimism into a liability. I’ve seen it over and over again, take a build with intermittent failures and people will check in broken code and assume it’s the intermittent problem and not their change.

Ideally, when you start breaking builds you’ve found your limits. But the build has to break when I break the code, and it needs to do it repeatably, because if I can’t reproduce the error I risk telling myself stories, and foisting off debugging to other people, which is a big no no.

Re:The End of CI by lukeasrodgers on Sunday July 03, 2022 @09:01AM (#31967385)
What if it was possible to have a local build system that would run tests etc and provide a cryptographically secure hash proving that the tests passed, the build was good, etc then a “centralized” CI system just verified that before permitting merge/deploy. There’s a lot of hand waving there but it doesn’t seem wildly implausible. Local use of containers or something like nixos could provide sufficient protection against the “works on my machine but not in production” problem.
Re:The End of CI by Frost1x on Sunday July 03, 2022 @09:23AM (#31967534)
I always found it interesting how git was adopted by industry where a large part of its complexity and feature set is built around suopporting fully distributed developer, developers who could lack internet access for months at a time but need to work collaboratively in a team. Then, industry took that distributed approach and strapped project and team management systems with web based front ends like Github, GitLab, etc. around git and created CI/CD pipelines that built ontop of or in parallel to those environments--all of which were centralized. While it's of course still true that your underlying repo instances still give you a lot of flexibility away from those centralized environments, the centralized environments themselves are critical in regular daily workflows, negating a lot of the flexibility git as a VCS adds.

In large part, industry could largely use a significantly simpler model than git for VCS since many features are largely moot on a daily basis. Many could probably get away with SVN in large part, for example (although branching isn't nearly as good).

I think you raise a great point in that we need to look at how processes have evolved ontop of version control and look at adapting those to a similar model. In some cases it's just not practical because the way infrastructure testing an deployment works but it's the direction I think we should be going. In fact, the first step would be to make issue systems and project management interfaces provided by efforts like GitLab and GitHub available in a local capable, distributed fashion. Clearly communications often require some degree of centralization or at least peer message propagation but there's no reason that information can't be separated from the infrastructure that displays and interacts with it.

Re:The End of CI by morelisp on Sunday July 03, 2022 @12:15PM (#31968773)
> Then, industry took that distributed approach and strapped project and team management systems with web based front ends like Github, GitLab, etc. around git and created CI/CD pipelines that built ontop of or in parallel to those environments--all of which were centralized.

A different view on this is that my CI system is a kind of colleague, responsible for a lot of what testers, ops, and build eng people toiled at before. It is another aspect of the decentralized system where a robot can also check out and work with the code even while humans continue to write more, which is considerably more painful under e.g. the SVN model. My human colleagues and I still share plenty of code directly, via git pulls and other tools.

Re:The End of CI by Silhouette on Sunday July 03, 2022 @11:40AM (#31968521)
It's a recurring and perhaps inevitable problem. We've collectively been building software for a long time but any given individual hasn't. No-one has seen all the good ideas that have gone before and sometimes been forgotten. Everyone is influenced to some degree by whatever ideas are currently popular within their group.

We developed distributed VCSes and the ability to do smart things with branches and combining contributions from people all over the world at different times. Then we somehow still ended up with centralised processes where everyone has to merge to trunk frequently and if GitHub goes down then the world stops turning. It turns out that just using git as git wasn't such a bad idea after all.

We were told that dynamic languages like JS and Python are so much more productive and that this was essential for fast-moving startups to be competitive. Today the industry is moving sharply from JS to TypeScript and even Python now has similar tools. It turns out that static typing was better for building robust software at scale than relying entirely on unit tests after all.

Just wait until lots of developers who have only ever worked with JS or Python learn what a compiled executable is. If you tell them that xcopy deployment even to a huge farm of web servers is no big deal when all you're copying is one executable file and maybe a .env with the secrets, it'll blow their minds...

Re:The End of CI by theK on Sunday July 03, 2022 @12:43PM (#31969026)
> if GitHub goes down the world…

Well, technically it doesn’t have to. It needs to be „a“ CI server that the team agrees upon, not necessarily a GitHub one.

I think the most important factor is to keep in mind that this is something teams decide to do.

Re:The End of CI by Silhouette on Sunday July 03, 2022 @02:50PM (#31970009)
Sure. But anecdotally I don't think I have ever worked somewhere with a centralised VCS/CI/CD for more than a few weeks and not had at least one major outage that basically caused all development work to grind to a halt for everyone for at least several hours, all because a key service went down. I've seen it happen to GitHub, GitLab, some of the big dedicated CI providers...

You can certainly argue that there are other advantages to using those systems. However it's an inescapable fact that if those teams had been using git-as-git and had a good local environment for each developer then most of the developers would have been able to carry on with most of their work during all of those outages. Sometimes single points of failure fail.

Re:The End of CI by theK on Sunday July 03, 2022 @04:53PM (#31970921)
Wow, that seems to be the other side of the lucky stream I am on :-D

Seriously, a well set up gutlab is pretty much undownable. And even if you do, what really is the impact? If the pipelines don't run you cannot integrate, sure if the core service breaks down you will probably resolve to exchanging patches the old school way. But the good part is, in order to deploy those decentrally sourced changes you still will go through centralized CI and gain its quality assurances by doing so. Where's the drawback?

Re:The End of CI by Silhouette on Sunday July 03, 2022 @05:50PM (#31971323)
Unfortunately a hosted GitLab is downable when GitLab itself goes down. Same for all the other hosted source control and CI systems.

Given that many companies now tie their entire deployment process into their source control and CI/CD systems that means you really are reduced to exchanging patch files. For any non-trivial change in a large system that quickly becomes impractical and so development slows to a crawl or everyone literally gives up and goes to the pub.

Re:The End of CI by jayd16 on Sunday July 03, 2022 @12:54PM (#31969102)
Industry uses both the centralized and decentralized features. Just because I want to configure team permissions doesn't mean I want to be blocked if the network is down.
Re:The End of CI by jamie_ca on Sunday July 03, 2022 @05:10PM (#31971066)
I think a lot of the adoption of git in the industry at large is in _spite_ of its distributed nature - it just so happens that the decentralized design made it care much more about branching and merging, and it got adoption because even for a small local team those improvements over SVN were worth the pain of dealing with git's UX warts.
Re:The End of CI by goodpoint on Sunday July 03, 2022 @09:51AM (#31967685)
> industry took that distributed approach and strapped project and team management systems with web based front ends like Github

Indeed. Software forges centralized what was a Decentralized VCS.

For one reason: profit.

Re:The End of CI by _se on Sunday July 03, 2022 @10:19AM (#31967866)
And of course the many other reasons: convenience, consistency, built-in integration with other development tools...
Re:The End of CI by goodpoint on Monday July 04, 2022 @11:05AM (#31977813)
...none of which requires or justifies the centralization that has been created.
Re:The End of CI by _se on Tuesday July 05, 2022 @01:41PM (#31991310)
Apparently, many people disagree with you; otherwise, we would not be in this situation.

I agree that centralization is probably not a hard requirement for these properties, but currently no one has come up with decentralized equivalents that provide users what they actually want - and remember, you don't get to tell them what they want!

Re:The End of CI by neoromantique on Sunday July 03, 2022 @02:17PM (#31969772)
Why is this not best of both worlds? You have centralized portals like GitHub that have bunch of additional proprietary features, but if you don't need them or don't want to have centralized solution you have freedom to interface with it from, uh, anything.
Re:The End of CI by goodpoint on Monday July 04, 2022 @11:09AM (#31977858)
github does not federate, it is not decentralized and you need an account to interact with the many proprietary features.

You just described https://en.wikipedia.org/wiki/Embrace,_extend,_and_extinguis...

Re:The End of CI by swagonomixxx on Sunday July 03, 2022 @09:17AM (#31967489)
Running tests locally is pretty much a no-no for many codebases because they are so large and tests take a long time if they don't run on a beefy test server or in parallel.

Common examples of this are multi-million line C++ codebases (e.g proprietary game engines) and monorepos in any language.

Running tests on my computer uses up valuable CPU cycles that I can use to work on something else while the CI servers are running my tests.

However I can see this working for small to medium sized codebases that really don't need CI for testing.

Re:The End of CI by hinkley on Sunday July 03, 2022 @02:55PM (#31970043)
This is an oversight that lands in circle of “the things I know that are difficult to sell because everyone else is just ignoring it.”

Capacity planning applies to tests. As your test count goes up your budget per test goes down. Every CI tool should plot build and test duration over time and only a couple do.

There’s a reason most test frameworks can mark slow tests. You need to not only use that but ratchet down over time. Especially when you get new hardware.

I haven’t run benchmarks lately but my old rule of thumb developed over many projects and with several people better at testing than I, was a factor of eight for each layer in the testing pyramid.

That certainly puts a lot of runtime pressure on the top of the pyramid, but that’s by design. You don’t want people racing to the top, because that’s how you get a cone.

Re:The End of CI by reillyse on Sunday July 03, 2022 @04:33PM (#31970767)
I'm actually working on something to solve the slow test problem. We go down the massively parallel route. We run everything pre git commit by syncing your project directory to our servers and parallelizing the runs. Here is a demo https://brisktest.com/demos running against the react test suite.
Re:The End of CI by swagonomixxx on Sunday July 03, 2022 @05:07PM (#31971041)
Wow, that's really impressive! Do you plan on adding support for Golang?
Re:The End of CI by reillyse on Sunday July 03, 2022 @05:35PM (#31971233)
It wasn't top of our list but it is definitely something we could support if there was interest (fairly quickly I'd imagine). My personal experience with go tests is that they tend to be very fast but perhaps I just haven't seen a large enough project. Is it something you'd be interested in? If you want to chat more about it, my email is in my profile.
Re:The End of CI by CuriouslyC on Sunday July 03, 2022 @11:55AM (#31968637)
Or run a partial suite...
Re:The End of CI by swagonomixxx on Sunday July 03, 2022 @05:09PM (#31971051)
Partial suite is certainly an option. You can build tools that only test code that has changed and whose changes can have cascading effects on other code (i.e dependent code). Do you know if such tools exist, or would I (as in the software engineer working on the codebase) have to build them?
Re:The End of CI by origin_path on Monday July 04, 2022 @09:35AM (#31976869)
This is actually the default result you get if you leave the defaults alone in some CI systems! My current company runs CI this way, in fact. A checkout is re-used between builds, and Gradle computes the minimal set of tasks that need to be run based on changed files just as it would locally. TeamCity will set things up this way by default. If you want a clean build on every run, you have to opt-in by checking a box.

How well does it work? Well .... it sorta mostly works. Sometimes a build will fail for inexplicable reasons because Gradle/Kotlin incremental builds don't seem fully reliable. You re-run with a clean checkout and the issue goes away.

How much time does it save? Also hard to say. Most of the time goes into integration tests that by their nature are invalidated by more or less any change in the codebase. That's not exactly incorrect. Some changes in some modules do avoid hitting the integration tests, though.

TC can also do test sharding in the newest versions when you use JUnit. We don't use this yet though.

Re:The End of CI by hinkley on Sunday July 03, 2022 @06:56PM (#31971714)
Partial is the most valuable when you have red tests that are resisting simple fixes. I would definitely encourage running the entire tests every hour or two at the least.

We have a project where the team split the tests into chunks and eventually I figured out the reason why is because they had coupling between tests, and running them all together ran into problems. I worry about other people opening that door, because it’s damned hard to close again.

Re:The End of CI by Retric on Sunday July 03, 2022 @09:34AM (#31967594)
Containers alone don’t fix the “works on my machine” issue. CI should be isolated to provide proper gate keeping such that any change required for code to function on CI machine will also be automatically loaded into production and other developers machines.

In theory you could get something reasonably close to this working locally, but the it’s a serial process so that’s pointless.

Re:The End of CI by webdog on Sunday July 03, 2022 @11:20AM (#31968360)
>will also be automatically loaded into production and other developers machines.

I’m assuming you are only submitting this as theoretical, because in the real world (where I’ve directly experienced this workflow) it’s a nightmare:

* Someone merges main which deletes working files in your feature branch. Automatic pushing/rebasing of main onto your feature branch creates needless work the moment you try to push upstream when git tries to ascertain state of local main.

* countless times I’ve hit bugs where if I try to merge “patch-a” from a common “feat-1” branch (meaning patch was cut from feat, not from main), but then main is updated by the auto-updater, I then have a messy working directory in which main’s new files are treated as unknown orphans and I have to spend time deleting these by hand.

I’m all for having my feat branch be up to date at merge time. But making it a rolling target is something git (from my perspective) hits the boundary of what git can reasonably do, and creates more pain than any type of positive DX

Re:The End of CI by Retric on Sunday July 03, 2022 @11:51AM (#31968606)
This is actual experience from multiple projects. Ideally starting from a blank machine/VM you should be able to run a single script that get’s the latest, builds it locally, runs it successfully, and passes all tests.

Git may or may not be part of that process.

Re:The End of CI by webdog on Sunday July 03, 2022 @03:24PM (#31970249)
I'm going to be annoyingly pedantic here, apologies in advance. To me, what you're describing is an end state where the fetch/build + test is a state in which the developer is done with some task. But in my working reality, testing/building is a non-linear process that is iteratively run after some certain self-determined point-in-time.

>Ideally starting from a blank machine/VM you should be able to run a single script that get’s the latest, builds it locally, runs it successfully, and passes all tests.

This isn't automatic, and is a practice that is fairly standard today (And one I agree with). You have placed a requirement/line in the sand that says, "Only when I have ideal state should this pipeline run in linear time and output the final result, which are the return codes from tests." Your example has the user initiating the update of the upstream main, not some other process that runs git fetch on the Developer's behalf.

Your original comment, as I understand it, is contradictory to this point:

>or code to function on CI machine will also be automatically loaded into production and other developers machines.

All of us (I think) agree that auto-deployment to production is a desirable goal. But we all (I think) know that broken commits are routinely delivered to production, where "production" represents the sum of all production environments in the world. So while we can have a reasonable assumption that "Production is, or should be deployable all the time," that doesn't mean the state that is represented by Production is safe to run locally in my environment, unless I *specifically* request it. Since git doesn't have file-locking, some other team/PM/developer can decide it's time for <MASSIVE REFACTOR> that blows away my work/branch mistakenly (Or maybe even intentionally, especially if I work in an org that is terrible with communication), creating unnecessary merge conflicts/mental load. This happens in short-lived and long-lived feature branches.

In no setup, do I think it's ever safe to take away the developer's agency and let some other process keep my local machine in "sync." There are so many variables to account for that some daemon/service can't be aware of, to allow for automatic updating (and again automatic updating != user running `git fetch`).

Re:The End of CI by Retric on Sunday July 03, 2022 @06:10PM (#31971448)
> But in my working reality, testing/building is a non-linear process that is iteratively run after some certain self-determined point-in-time.

That’s not actually involved here. The actual process of coding can take place on a separate standalone project or even a whiteboard. But somehow all that code and everything associated with it needs to be packaged up for the team or it’s never making it to production. Further your process needs to minimally interrupt other team members or team efficiency tanks.

How that’s done is up to the team but it needs to happen somehow and automation avoids headaches. I briefly worked on a project where we kept passing around updates to a VM, slow and bandwidth intensive but it did actually work.

> "Production is, or should be deployable all the time,"

That’s a separate question. I am saying the code should be bundled with any needed environment configuration required to run that code. CI is a direct test of the process.

> In no setup, do I think it's ever safe to take away the developer's agency and let some other process keep my local machine in "sync." There are so many variables to account for that some daemon/service can't be aware of, to allow for automatic updating (and again automatic updating != user running `git fetch`).

Capacity is not a requirement.

For developers it’s about being able to hit a big red button and get your local environment working rather than something you automatically do day to day. Onboarding, or coming back after 3 months on another project, etc shouldn’t involve someone trying to piece together all the little environment changes that people need to apply since the last time someone updated the onboarding document.

In practice you might be reading a diff of some script and just apply that manually. But at least the sharing process is automated.

Re:The End of CI by hinkley on Sunday July 03, 2022 @02:36PM (#31969918)
It’s the same problem with tests in general. Developers think it’s all about getting a green build. It’s not. It’s about fixing red builds as fast as possible. I have a whole other rant about making zero build failures a metric.

A red local build probably means a red CI build, but a red CI build doesn’t necessarily mean a red local build. Now you’re fucked because there’s a build failure you can’t reproduce.

Reducing variance helps. Having the person who set up the CI system also copy edit the onboarding docs helps a lot with this.

It’s a matter of scale. As the team grows and particularly as you hit the steep part of the S curve of development, you’re going to have lots of builds and that 1:50 error is going to go from every two weeks to once a day.

Humans interpret every day as “all the time”. Some do this for every week, especially if it coincides with their most important commits. It’s not the ratio of failures that bothers people. It’s the frequency, and the clusters.

Re:The End of CI by oldjavacoder on Sunday July 03, 2022 @12:20PM (#31968831)
"What if it was possible to have a local build system that would run tests etc and provide a cryptographically secure hash proving that the tests passed"

On who's system? Your? Mine? Someone else's? The purpose of CI is consistent continuous integration in a same like manner, not relying on developer A, B or C's systems which may vary greatly.

Re:The End of CI by Arbortheus on Sunday July 03, 2022 @03:34PM (#31970315)
If your tests ran in a sandbox, for instance the Bazel sandbox or a Docker container, and this has the same configuration on CI and on the local machine, then it does not matter if the tests ran in CI or on a developer's machine.

This falls apart for things like integration tests, which may be too large/complex/interconnected to work on a local machine, but most of the time this would be more than sufficient.

Re:The End of CI by czx4f4bd on Sunday July 03, 2022 @11:21AM (#31968374)
This and the original article feel very much like solutions in search of problems. Beyond the issues with the original article, what's the point in a cryptographically secure hash from an untrusted environment? If someone were really determined to maliciously push broken code for some reason, they could just tamper with whatever generates the hash.
Re:The End of CI by giantrobot on Sunday July 03, 2022 @12:03PM (#31968701)
Local testing doesn't tend to work outside the small scale. Even if you use containers for everything you'll run into edges where a local development machine can't accurately test a production-like environment. Deploying to production without testing in that environment is just tragedy waiting to happen.

Distributed signing of artifacts is only effective if you've got fully reproducible builds. If you don't, because almost no one does because it is a huge effort, then all you have is attestation. If a broken/malicious artifact gets deployed the damage gets done and you only know who to blame afterwards.

Local tests are useful for not knowingly committing broken code insofar as your tests can determine. Outside of that a full test suite run by a beefy cluster with ready access to assets and network resources is better suited to test for deployment.

Re:The End of CI by layer8 on Sunday July 03, 2022 @11:49AM (#31968589)
> provide a cryptographically secure hash proving that the tests passed

It’s unlikely that verifying such a hash is possible without rerunning the tests, and not at the same time enabling someone to trivially compute that hash without having run the tests in the first place.

Re:The End of CI by hinkley on Sunday July 03, 2022 @02:59PM (#31970062)
There’s a lovely feature of TeamCity that I had to enforce on one exuberant but doubly sloppy programmer.

In trunk based development you can do a conditional commit, where TC runs your code and only pushes it to trunk if the build is green. This allows you to push something before lunch or a meeting for someone who is blocked without coming back to angry faces because you ding-dong-dashed.

Breaking trunk is fundamentally a problem of response time. If you’re not in the office you can’t fix a red build in a timely fashion. He did this regularly and got put under house arrest.

I started using it on myself so people didn’t have to wait two hours for me to get out of a meeting and fix their api bug.

Re:The End of CI by jayd16 on Sunday July 03, 2022 @12:55PM (#31969109)
What's the point? To reuse hardware for build workers? You can run a local Gitlab ci runner and get what you're saying, no?
Re:The End of CI by ohthehugemanate on Sunday July 03, 2022 @10:24AM (#31967896)
That's just decentralized CI, aka CI with extra steps.

CI itself is just continually testing before continually merging. Doesn't matter where.

Re:The End of CI by coredog64 on Sunday July 03, 2022 @03:50PM (#31970448)
A previous employer used a passport analogy. Your code gets a visa (cryptographically signed) to run in a specific environment for a fixed time. You can renew your visa as long as all the assumptions remain true, but once they’re falsified you must create and submit a new build that makes the assumptions true again.
Re:The End of CI by b3morales on Sunday July 03, 2022 @12:59PM (#31969139)
It's not enough to just validate the tests: you would also want a tamper-proof record of exactly what source code was actually built. Probably also the full environment. 99.99% of the time this will be irrelevant trivia, but that one time you need to know, there's no substitute.
Re:The End of CI by larusso on Sunday July 03, 2022 @03:53PM (#31970476)
In the Java world gradle can do this with the help of a shared build cache server. There is also Gradle Enterprise but I never looked deeper into it.
Re:The End of CI by justbaker on Sunday July 03, 2022 @08:56PM (#31972408)
I like how you said using containers, similar to how CI servers tend to be configured.
Re:The End of CI by auxym on Sunday July 03, 2022 @08:52AM (#31967333)
Exactly this. CI gets rid of "works on my machine" syndrome.

If it doesnt build on CI, you broke it, fix it before merging.

Though, I'm still sour from my only experience in "tech" where "works on my machine" meant devs got to demand I fix the CI somehow.

Re:The End of CI by hinkley on Sunday July 03, 2022 @02:42PM (#31969950)
If self delusion is our biggest sin, learned helplessness is probably number two.

A small but important part of my motivation to build better DevEx is that it puts a squeeze on the foot draggers. If you can’t blame the tools for being shit (and believe me, I know a lot of them are), then the only other explanations are that you are either too stupid to use them or just not a team player. An asshole.

Developers will pick being called an asshole over being seen as stupid any day, but the former eventually gets management involved. It’s the closest I’ll probably ever get to solving a social problem with tech. Make it easy for people to participate, make them feel silly for not, then ramp up the pressure if that doesn’t work, and when it’s clear they only care about themselves you have actionable evidence to involve HR.