News for hackers. Stuff that matters.
Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by danpalmer on Monday November 06, 2023 @11:12AM (#38164466)
Having built CI/CD pipelines in CircleCI, Jenkins, GitLab CI, Concourse, Semaphore, and GitHub Actions, I'm not entirely sure what this offers, other than being FOSS. That's not to say that it being FOSS is not valuable – for some users it most certainly is – but that I can't see another way that this would be valuable.

The config language is nice, but honestly I've never been bothered by YAML for pipelines. I want my pipelines to be declarative anyway. I'm a little disappointed that Cicada didn't go with one of the existing options such as Jsonnet, Cue, Dhall, etc.

Lastly, there's a feature I've always found useful and in many cases necessary, that many CI systems don't have – enforced serial execution. When you're doing continuous delivery it's often critical to make sure that only one release is going out at a time and that the version being released strictly increases. I've seen outages because of release jobs racing and an unintended downgrade happening. This requires CI system support to achieve. Last time I checked, Jenkins, Concourse, and GitHub Actions all provided mechanisms for this, Semaphore may have as well. Circle and GitLab did not (the former after endless discussion with our account manager over it!) and I found it hard to trust the platforms as a result. Cicada does not appear to have this, which is a shame. It suggests to me a lack of hands-on production experience with continuous delivery. Arguably this is not a CD system, but there's no reason why a CI system shouldn't be CD as well, it's not until a much larger team/product size that a dedicated CD system becomes truly necessary and they take a lot of work to set up well.

Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by digi59404 on Monday November 06, 2023 @01:07PM (#38166230)
Maybe I’m misunderstanding? For GitLab this should be doable by two different ways.

The first is merge trains, which merges requests one by one to prevent this exact outcome. You just have to force all deployments to be done via a merge request. That’s the downside.

The second being forcing a GitLab Runner to run one job at a time. Tag it as “deployer” then ensure all deployment jobs are marked as “deployer”. That runner will pick up deployment jobs one by one in order of first creation.

Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by tsak on Monday November 06, 2023 @01:40PM (#38166803)
[delayed]
Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by imp0cat on Tuesday November 07, 2023 @02:18AM (#38174090)
Yeah, we use that instead of dedicated runners, too. But it is a relatively new Gitlab concept, isn't it?
Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by tsak on Tuesday November 07, 2023 @06:41AM (#38175709)
[delayed]
Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by ranguna on Tuesday November 07, 2023 @03:32AM (#38174523)
I was a bit confused when I first saw this in the context of deployment jobs.

If you go with oldest first and two or more prod jobs want to run, you are gonna have to wait for all the old deployments to finish unless you go to each one and cancel them, leaving only the latest one. This does prevent unorderd deployments from overwriting each other, but it's a pita.

If you go with newest first, old deployments will overwrite new ones unless you toggle the setting to prevent outdated jobs from running, by which case you'll be locked out of doing a rollback unless you regenerate a whole old pipeline.

It would make sense if they had a "newest only", where if you have one deployment running and 10 pending, by the time the current deployment finishes, gitlab would cancel all deployments except for the latest one. This way you don't have to wait for old deployments and you're free to do a rollback at any time. Bonus points if the cancelled jobs display a link to the latest job that was chosen from the queue.

Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by tsak on Tuesday November 07, 2023 @06:42AM (#38175723)
I've just checked our code, and we use `oldest_first`, not `newest_first`.
Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by sarki_247 on Tuesday November 07, 2023 @07:22AM (#38175978)
> "It would make sense if they had a "newest only", where if you have one deployment running and 10 pending, by the time the current deployment finishes, gitlab would cancel all deployments except for the latest one. This way you don't have to wait for old deployments, and you're free to do a rollback at any time."

Hi, GitLab Team member here. This is exactly how GitLab functions when you use "newest first" process mode [1] with Prevent outdated deployment jobs enabled [2]. By default, pipeline job retries for deployment rollback is enabled, you can rollback to any of the failed old deployments, except where its disabled. [3]

[1] https://docs.gitlab.com/ee/ci/resource_groups/#process-modes

[2] https://docs.gitlab.com/ee/ci/environments/deployment_safety...

[3] https://docs.gitlab.com/ee/ci/environments/deployment_safety...

Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by ranguna on Wednesday November 08, 2023 @03:47AM (#38188073)
Thanks for getting back to me!

That's amazing, I always had this problem in my head about how to solve people stepping on each other's toes with high volume CD workflows.

This should solve it nicely, thanks again!

Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by danpalmer on Tuesday November 07, 2023 @04:42AM (#38174961)
Ah this is good. This had come in when I used it but I think the GitLab instance I used was a few releases out of date so wasn't available at the time.
Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by danpalmer on Monday November 06, 2023 @01:29PM (#38166630)
I think merge trains weren't a feature when I worked with GitLab, it was a while ago. This does certainly solve it, but at the cost of quite a different process. If what you're optimising for is time to release, merge trains add an overhead. At some point that overhead is worth it, but it depends on the team/product/etc.

Having just one runner be the deployer is an option too. I think we used hosted runners so not sure if this is possible in that setup? This would also make pipelines harder to optimise. Often there are many parts in pipelines that are safe to do in parallel, and only a few "critical sections" around which you want locking. This would solve simultaneous releases, but not the general case of the problem (which at least Jenkins and GitHub Actions manage ok).

GitLab always felt to me like Travis++, whereas systems developed later felt like they were built on fundamentally better primitives. Jenkins is a weird one because it has all of the features, can do all of these things, really quite well in many cases, but has a pretty bad developer experience and required a lot of maintenance to run a performant and secure install.

Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by matrss on Monday November 06, 2023 @03:58PM (#38168903)
> I want my pipelines to be declarative anyway.

Is there any CI system that allows one to write declarative pipelines? What would that even mean? GitHub Actions, GitLab Pipelines, etc. are all effectively just shell scripts disguised as more or less verbose yaml, with some trigger conditions added.

I guess nix's hydra is the closest to a declarative CI system that exists, because nix does the hard work of abstracting the imperative build steps into a declarative interface. Even then, if you want to do anything outside of nix derivations you would be writing something imperative.

Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by pydry on Monday November 06, 2023 @04:14PM (#38169113)
it's github actions but you keep it short and put everything you can in a script that gets shelled out to.
Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by matrss on Monday November 06, 2023 @04:48PM (#38169503)
So, only use the CI system for it's dispatch/scheduling part and put the imperative steps into a dedicated script? Reasonable, and what I have done with some GitLab Pipelines as well, but I don't see how that would be considered more "declarative".
Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by summarity on Monday November 06, 2023 @05:24PM (#38169957)
Buildkite was once that.
Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by tonyhb on Monday November 06, 2023 @05:26PM (#38169986)
Check out https://dagger.io/. Write declarative pipelines in code, reproducibly run anywhere.
Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by danpalmer on Tuesday November 07, 2023 @04:44AM (#38174974)
I'm not looking for literally everything to be declarative, but ideally each snippet of shell script would be entirely independent and run effectively reproducibly. GitHub/GitLab do this well enough, although not perfectly. Concourse does this really well. Bazel is also great at this.
Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by matrss on Tuesday November 07, 2023 @06:12AM (#38175481)
> [...], but ideally each snippet of shell script would be entirely independent and run effectively reproducibly.

Sure, if you design your scripts carefully (e.g. make them idempotent, reproducible, make all inputs explicit, etc.) you can build an abstraction to what you want to achieve which can then be used declaratively in the yaml flavor of choice. I think that is a very good way to do it. The script is still imperative though.

I guess what I want to say is that a generic CI or even just job scheduling system cannot be declarative without limiting what it can do. You can build your own scripts which can then provide a declarative interface to the imperative world to your CI pipeline, but you will be limited to the scope of your script. You can call out to other such abstractions (nix for your packaging needs, terraform for infrastructure, etc.) as well, but again you will be limited to the scopes of those.

As long as the CI system retains the ability to run jobs in some order instead of just being able to declare what you want and let the CI system figure everything else out (e.g. build first, then test, then possibly release; even if I declared what I want in a different order) it is still an imperative interface.

To make this clear: I don't think declarative CI/CD pipelines are desirable. They should be an (ideally as short as possible) list of steps executed in order to achieve some goal, because that is what fits the problem domain best (interact with the imperative world in arbitrary ways). Parts of those steps can be pushed out to declarative abstractions though where that makes sense, e.g. building and testing in nix so you get caching, sandboxing and reproducibility of builds basically for free, or deploying infrastructure changes through terraform so you get idempotence on those changes mostly for free. A generic CI system can then be reduced to it's bare minimum: a way to run a short script when some event happens.

Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by dosisod on Monday November 06, 2023 @05:43PM (#38170195)
Creator of Cicada here. Thank you for the feedback! I've mentioned this in a few threads already, but the reason for making a new DSL for writing the workflows is that YAML makes it hard/cumbersome to express more complex workflows. Using a programming language though gives you more control over how your workflows execute. While there are already plenty of tools that use existing programming languages (ie, Python/TypeScript) to configure workflows, having a custom DSL allows you to make some of the more abstract terms like caching, conditional execution, permissions, etc. more explicit.

To your last point, I have experience with using CD in production, but not to the scale where I have builds stepping over each other and causing issues. I agree that serial builds are important in this case, and is something that I will need to look into (conceptually it sounds pretty simple).

Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by danpalmer on Tuesday November 07, 2023 @04:41AM (#38174944)
Awesome! I think serial builds should be fairly simple to implement if you can tie it back to a transaction in a data store.

I get the DSL desire, and I feel I've already lost the "YAML is fine" battle elsewhere so that's not a problem. I think a language like jsonnet or cue would have been a better choice simply because they don't involve users learning a new language or you from implementing a new language. Both would have allowed plugging in your own standard library of functions and abstractions.

Re:Cicada – A FOSS, Cross-Platform Version of GitHub Actions... by melezhik on Sunday November 12, 2023 @03:03PM (#38243603)
You might want to check out the SparrowCI - it has combination of yaml AND standard programming languages ( Python/Ruby/GoLang/Powershell/Bash/Raku) giving you the best of two worlds - declarative style and extremely flexible flows when required