Live data from Hacker News

I'll think twice before using GitHub Actions again

ninkovic.dev

61–70 of 284 posts

Re: I'll think twice before using GitHub Actions again

#61
So the way I've solved the multiple folders with independent checks is like this:

    all-done:
      name: All done
      # this is the job that should be marked as required on GitHub. It's the only one that'll reliably trigger
      # when any upstream fails: success
      # when all upstream skips: pass
      # when all upstream success: success
      # combination of upstream skip and success: success
      runs-on: ubuntu-latest
      needs:
        - calculate-version
        - cargo-build
        - cargo-fmt
        - cargo-clippy-and-report
        - cargo-test-and-report
        - docker-build
        - docker-publish
      if: |
        always()
      steps:
        - name: Fail!
          shell: bash
          if: |
            contains(needs.*.result, 'failure') ||
            contains(needs.*.result, 'cancelled')
          run: |
            echo "One / more upstream failed or was cancelled. Failing job..."
  
            exit 1
  
        - name: Success!
          shell: bash
          run: |
            echo "Great success!"

That way it is resilient against checks not running because they're not needed, but it still fails when any upstream actually fails.

Now, I did end up running the tests of the front-end and back-end because they upload coverage, and if my coverage tool doesn't get both, it'll consider it as a drop in coverage and fail its check.

But in general, I agree with the writer of the post that it all feels like it's not getting enough love.

For example, there is no support for yaml anchors, which really hampers reusability on things that cannot be extracted to separate flows (not to mention separate flows can only be nested 4 deep).

There is also the issue that any commit made by GitHub actions doesn't trigger another build. This is understandable, as you want to avoid endless builds, but sometimes it's needed, and then you need to do the ugly workaround with a PAT (and I believe it can't even be a fine-grained one). Combine that with policies that set a maximum time limit on tokens, your build becomes brittle, as now you need to chase down the person with admin access.

Then there is the issue of Docker actions. They tell you to pin the action to an sha to prevent replacements. Except the action itself points to a replaceable tag.

Lastly, there is a bug where when you create a report for your action, you cannot specify the parent it belongs to. So your ESLint report could be made a child of your coverage report.

Re: I'll think twice before using GitHub Actions again

#62
Why is this so difficult?

1. We apparently don’t even have a name for it. We just call it “CI” because that’s the adjacent practice. “Oh no the CI failed”

2. It’s conceptually a program that reports failure if whatever it is running fails and... that’s it

3. The long-standing principle of running “the CI” after merging is so backwards that that-other Hoare disparagingly called the correct way (guard “main” with a bot) for The Not Rocket Science Principle or something. And that smug blog title is still used to this day (or “what bors does”)

4. It’s supposed to be configured declaratively but in the most gross way that “declarative” has ever seen

5. In the true spirit of centralization “value add”: the local option of (2) (report failure if failed) has to be hard or at the very least inconvenient to set up

I’m not outraged when someone doesn’t “run CI”.

Re: I'll think twice before using GitHub Actions again

#63
post #9
post #5

> no way of running actions locally My policy is to never let pipeline DSLs contain any actual logic outside orchestration for the task, relying solely on one-liner build or test commands. If the task is more complicated than a one-liner, make a script for it in the repo to make it a one-liner. Doesn't matter if it's GitHub Actions, Jenkins, Azure DevOps (which has super cursed yaml), etc. This in turn means that you…

The reason why many CI configs devolve into such a mess isn't typically that they don't extract complicated logic into scripts, it's about all the interactions with the CI system itself. This includes caching, sharing of artifacts, generating reports, configuring permissions, ordering of jobs, deciding when which jobs will run, deciding what to do when jobs fail, etc. All of this can get quite messy in a large enough…

It never becomes unbearably messy this way though.

The reason it gets unbearably messy is because most people google "how to do x in github actions" (e.g. send a slack message) and there is a way and it's almost always worse than scripting it yourself.

Re: I'll think twice before using GitHub Actions again

#64
post #38

You can't run AWS lambda or DyanmoDB locally too (well you can but it's a hassle). So by that logic, we shouldn't use them at all. I don't like working with CI too but I'll take GitHub Actions over Jenkins/CircleCI/TravisCI any day.

The problem with the analogy is that GHA's interface is quite thick.

Re: I'll think twice before using GitHub Actions again

#65
post #5

> no way of running actions locally My policy is to never let pipeline DSLs contain any actual logic outside orchestration for the task, relying solely on one-liner build or test commands. If the task is more complicated than a one-liner, make a script for it in the repo to make it a one-liner. Doesn't matter if it's GitHub Actions, Jenkins, Azure DevOps (which has super cursed yaml), etc. This in turn means that you…

I’ll go so far as to say the massive add on/plugin list and featuritis of CI/CD tools is actively harmful to the sanity of your team.

The only functionality a CI tool should be providing is:

- starting and running an environment to build shit in

- accurately tracking success or failure

- accurate association of builds with artifacts

- telemetry (either their own or integration) and audit trails

- correlation with project planning software

- scheduled builds

- build chaining

That’s a lot, but it’s a lot less than any CI tool made in the last 15 years does, and that’s enough.

There’s a big difference for instance between having a tool that understands Maven information enough to present a build summary, and one with a Maven fetch/push task. The latter is a black box you can’t test locally, and your lead devs can’t either, so when it breaks, it triggers helplessness.

If the only answer to a build failure is to stare at config and wait for enlightenment, you fucked up.

Re: I'll think twice before using GitHub Actions again

#66
post #55

Posts like this make me miss Travis. Travis CI was incredible, especially for testing CI locally. (I agree with the author that act is a well done hack. I've stopped using it because of how often I'd have something pass in act and fail in GHA.) > GitHub doesn't care My take: GitHub only built Actions to compete against GitLab CI, as built-in CI was taking large chunks of market share from them in the enterprise.

To be fair, GitHub also charges for Actions minutes and storage, so it's one of the few pieces that do generate revenue.

Re: I'll think twice before using GitHub Actions again

#67
post #3

I call writing GitHub Actions "Search and Deploy", constantly pushing to a branch to get an action to run is a terrible pattern... You'd think, especially with the deep VS Code integration, they'd have at least a basic sanity-check locally, even if not running the full pipeline.

Ah yes, I have a git alias created specifically for the "we don't know what it does until we push it" world of CI:

> yolo = "!git commit --all --amend --no-edit && git push --force #"

Re: I'll think twice before using GitHub Actions again

#68
post #5

> no way of running actions locally My policy is to never let pipeline DSLs contain any actual logic outside orchestration for the task, relying solely on one-liner build or test commands. If the task is more complicated than a one-liner, make a script for it in the repo to make it a one-liner. Doesn't matter if it's GitHub Actions, Jenkins, Azure DevOps (which has super cursed yaml), etc. This in turn means that you…

Folks pick the wrong tool for the job at hand.

I suspect the author of the article could greatly simplify matters if they used a task running tool to orchestrate running tasks, for example. Pick whatever manner of decoupling you want really, most of the time this is the path to simplified CI actions. CI is best when its thought of as a way to stand up fresh copies of an environment to run things inside of.

I have never had the struggles that so many have had with CI as a result. Frankly, I'm consistently surprised at how overly complex people make their CI configurations. There's better tools for orchestration and dependency dependent builds, which is not its purpose to begin with.

Re: I'll think twice before using GitHub Actions again

#70
post #27
post #5

> no way of running actions locally My policy is to never let pipeline DSLs contain any actual logic outside orchestration for the task, relying solely on one-liner build or test commands. If the task is more complicated than a one-liner, make a script for it in the repo to make it a one-liner. Doesn't matter if it's GitHub Actions, Jenkins, Azure DevOps (which has super cursed yaml), etc. This in turn means that you…

I don't understand why this is not the evident approach for everyone writing GitHub Actions/GitLab CI/CD yaml etc.... I've struggled in some teams to explained why it's better to extract your command in scripts (ShellCheck on it, scripts are simple to run locally etc...) instead of writing a Frankenstein of YAML and shell commands. I hope someday to find an authoritative guidelines on writing pipeline that promote th…

it can be quite hard to write proper scripts that work consistently... different shells have different behaviours, availability of local tools, paths, etc

and it feels like fighting against the flow when you're trying to make it reusable across many repos

Post reply on HN