Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate release CI back to github #9437

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Migrate release CI back to github #9437

wants to merge 3 commits into from

Conversation

hasufell
Copy link
Member

No description provided.

@hasufell hasufell marked this pull request as draft November 13, 2023 09:43
@hasufell hasufell force-pushed the purge-gitlab branch 16 times, most recently from 001d0e1 to bb01a96 Compare November 13, 2023 14:57
@hasufell
Copy link
Member Author

Also includes:

  • script to download artifacts
  • script to create yaml snippet for ghcup

@hasufell hasufell force-pushed the purge-gitlab branch 2 times, most recently from 5c37718 to 34a7c9c Compare November 13, 2023 15:45
@hasufell hasufell marked this pull request as ready for review November 13, 2023 15:45
@hasufell hasufell force-pushed the purge-gitlab branch 2 times, most recently from 3187a1a to 8781d59 Compare November 13, 2023 15:53
@hasufell
Copy link
Member Author

Workflow:

  • push tag cabal-install-v4.0.0.0
  • wait for github and cirrus builds to finish
  • run scripts/release/download-gh-artifacts.sh cabal-install-v4.0.0.0 <your-gpg-email>
  • run scripts/release/create-yaml-snippet.sh cabal-install-v4.0.0.0
    • based on the output create a ghcup-metadata PR

Kleidukos
Kleidukos previously approved these changes Nov 13, 2023
Copy link
Member

@Kleidukos Kleidukos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my perspective this is quite appealing and I would like to give it a try for the next release.

@Kleidukos Kleidukos dismissed their stale review November 13, 2023 16:44

need more explaining

@Kleidukos
Copy link
Member

EDIT: I have been a bit quick to approve without giving much background, so here it is: This is appealing because:

  • There is a FreeBSD job configured. When I released cabal-3.10.2.0, I had to manually create the FreeBSD bindists on my own private box.

  • We offload macOS and Windows runners administration to GitHub. These runners being unstable was not the end of the world but certainly did not help.

As such I am inclined to give this pipeline a chance for these two cases. The linux jobs of the Gitlab pipeline have never been a problem when I took care of 3.10.2.0, so I don't think we need to get rid of them.

@hasufell
Copy link
Member Author

hasufell commented Nov 13, 2023

The linux jobs of the Gitlab pipeline have never been a problem when I took care of 3.10.2.0, so I don't think we need to get rid of them.

We get rid of gitlab CI so we don't have to maintain two entirely separate CIs and then figure out how to mangle everything together in a big mess. That's dead code and unnecessary redundancy. Adding new linux distro/distro-versions to the current github CI release pipeline is very easy.

@Mikolaj Mikolaj requested a review from gbaz November 13, 2023 18:24
@hasufell
Copy link
Member Author

Copy link
Collaborator

@andreabedini andreabedini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to give this a go!

Copy link
Collaborator

@chreekat chreekat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I am not a Cabal release manager, I don't think my comments about the new workflow should be binding, but I hope they are helpful.

I do think the GitLab stuff should be kept as a backup as part of good change management, however, so I will request that change.

I think it's a bit funny that the pipeline is still using multiple sources (GitHub and Cirrus). You could just as easily use GitLab as the backend. Or GitLab could use Cirrus to pick up FreeBSD. Maybe I'll try that.

The final thing I'd recommend is documentation. I assume the release workflow is documented in this repo?

Overall lgtm and I'll defer to the actual release managers for the actual approvals!

@@ -0,0 +1,66 @@
#!/bin/bash

set -eux
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer explicit tracing instead of increasing default verbosity everywhere because it adds a permanent tax on reading and storing logs. I feel like a lot of my career has been spent figuring out how to filter useless log messages. But maybe that's just me.

tags:
- 'cabal-install-*'
schedule:
- cron: '0 2 * * *'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who is alerted when scheduled jobs fail on GitHub Actions? Assuming it's more than one person, this will be an improvement over GitLab. But fwiw, the release pipeline runs on every push to master on GitLab, rather than on a schedule. I think either is fine, but I want to highlight the change to other reviewers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.github.com/en/github-ae@latest/actions/monitoring-and-troubleshooting-workflows/notifications-for-workflow-runs

Notifications for scheduled workflows are sent to the user who initially created the workflow. If a different user updates the cron syntax in the workflow file, subsequent notifications will be sent to that user instead.

DISTRO: ${{ matrix.platform.DISTRO }}
ADD_CABAL_ARGS: ${{ matrix.platform.ADD_CABAL_ARGS }}

- if: always()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why always()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible the build finished, but the script errored anyway. It's good to have the binary for investigation

.github/workflows/release.yaml Show resolved Hide resolved
.github/workflows/release.yaml Outdated Show resolved Hide resolved
Comment on lines +213 to +227
- if: matrix.ARCH == 'ARM'
uses: docker://hasufell/arm32v7-ubuntu-haskell:focal
name: Run build (armv7 linux)
with:
args: bash .github/scripts/build.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}

- if: matrix.ARCH == 'ARM64'
uses: docker://hasufell/arm64v8-ubuntu-haskell:focal
name: Run build (aarch64 linux)
with:
args: bash .github/scripts/build.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these two steps instead of one parameterized step? The name doesn't seem important; it could just be "Run build", and the docker image could be a matrix parameter. Right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Afair the uses doesn't allow variables.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I <3 json-as-code

.github/workflows/release.yaml Outdated Show resolved Hide resolved
.github/workflows/release.yaml Outdated Show resolved Hide resolved
.github/workflows/release.yaml Outdated Show resolved Hide resolved
shell: pwsh
run: |
C:\msys64\usr\bin\bash -lc "pacman --disable-download-timeout --noconfirm -Syuu"
C:\msys64\usr\bin\bash -lc "pacman --disable-download-timeout --noconfirm -Syuu"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this duplication intentional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use a comment then.

@chreekat
Copy link
Collaborator

I think I messed up by marking my review as "needs changes". The actual change I want is the restoration of GitLab files. I don't think my other suggestions should be binding.

@chreekat
Copy link
Collaborator

chreekat commented Nov 15, 2023

Time comparison:

Gitlab CI: 98m 15s
    https://gitlab.haskell.org/haskell/cabal/-/pipelines/86388
GitHub CI: 32m 35s
    https://github.com/haskell/cabal/actions/runs/6851573157

Ironically, the GitLab pipeline took forever because the Darwin job had to queue
for an hour for an open spot. The GitHub job runs on the same server and
therefore competes for the same resource. It just gets to jump the queue since
the two job runners don't know about each other.

@hasufell
Copy link
Member Author

I do think the GitLab stuff should be kept as a backup as part of good change management, however, so I will request that change.

That would mean we just increased complexity, which defeats the purpose of this PR.

If anything goes extremely wrong during the next release, you can restore the gitlab code from the git history.

Co-authored-by: Bryan Richter <bryan@haskell.foundation>
@chreekat
Copy link
Collaborator

That would mean we just increased complexity, which defeats the purpose of this PR.

If it wasn't clear, I meant to keep it around for the next release and then dropping it. I hope that doesn't defeat the purpose. This change is bigger than just reimplementing some code ,and keeping two systems running in parallel is good practice. And basically free in this case.

@Mikolaj
Copy link
Member

Mikolaj commented Nov 15, 2023

keep it around for the next release and then dropping it

Regarding this one point, I'd make it two releases and I'd keep the gitlab CI running all the time to ensure we spot problems in it ASAP, just as we do today.

While I'm talking, @hasufell, thank you for the PR. I remember the big appeal of your proposal long ago, now materialised, was that we'd test what we release. Does this PR bring us closer to the point where we test daily the same binaries that will be released? In particular, are our normal GHA tests run on these artifacts, and when not applicable, on the exact commits from which the artifacts are created? What's the roadmap to unify CI and release CI, to a reasonable extent?

@hasufell
Copy link
Member Author

That would mean we just increased complexity, which defeats the purpose of this PR.

If it wasn't clear, I meant to keep it around for the next release and then dropping it. I hope that doesn't defeat the purpose. This change is bigger than just reimplementing some code ,and keeping two systems running in parallel is good practice.

I don't agree with this at all. There's no indication this is necessary. In HLS we also didn't need it and it has a much more complex CI.

@chreekat
Copy link
Collaborator

That would mean we just increased complexity, which defeats the purpose of this PR.

If it wasn't clear, I meant to keep it around for the next release and then dropping it. I hope that doesn't defeat the purpose. This change is bigger than just reimplementing some code ,and keeping two systems running in parallel is good practice.

I don't agree with this at all. There's no indication this is necessary. In HLS we also didn't need it and it has a much more complex CI.

To avoid a deadlock I've created https://github.com/chreekat/cabal/tree/b/add-github-release-ci, which is an edited version of this branch that keeps GitLab CI. I hope it won't be necessary.

@hasufell
Copy link
Member Author

I can split the PR in two commits, so that Gitlab removal is easier to revert in case it's necessary.

But I won't subscribe to "let's keep code in master, just in case". That's bad engineering practice.

@Mikolaj
Copy link
Member

Mikolaj commented Nov 16, 2023

But I won't subscribe to "let's keep code in master, just in case". That's bad engineering practice.

I don't think anybody is proposing that. Gitlab CI would be running continuously so that we can spot any problems and fix them ASAP and during a release, if needed, the release manager would be able to compare the results of gitlab and github, test behaviour of the artifacts from both systems, etc.

@hasufell
Copy link
Member Author

I have decided to build bindists myself for the next cabal release, so cabal's CI isn't relevant for GHCup directly anymore.

You can use this PR and the contained patch as you please.

@hasufell hasufell closed this Nov 16, 2023
@andreabedini andreabedini reopened this Nov 17, 2023
@andreabedini
Copy link
Collaborator

I have reopened this to prevent us losing valuable work.

@andreabedini
Copy link
Collaborator

And thank you @hasufell for working on this!

Copy link
Collaborator

@andreabedini andreabedini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just leaving some comments as I had the time to read this properly. It looks quite comprehensive! good stuff.

PS: @hasufell you have been clear that you don't intend to continue working on this so my comments are not to be taken as request for more work from you :-) They more like notes to my future self.


# https://github.com/haskell/cabal/issues/7313#issuecomment-811851884
if [ "$(getconf LONG_BIT)" == "32" ] || [ "${DISTRO}" == "CentOS" ] ; then
echo 'constraints: lukko -ofd-locking' >> cabal.project.release.local
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should just be included in cabal.project.release under a if arch(I386) conditional. I am not sure if there is something specific to CentOS, it does not seem to be mentioned in the thread above

args=(
-w "ghc-$GHC_VERSION"
--disable-profiling
--enable-executable-stripping
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other things that should be in cabal.project.release

timeout_in: 120m
only_if: $CIRRUS_TAG != ''
env:
ADD_CABAL_ARGS: "--enable-split-sections"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be implemented in cabal.project.release under a conditional if os(FreeBSD)

uses: actions/checkout@v3

- if: matrix.ARCH == 'ARM'
uses: docker://hasufell/arm32v7-ubuntu-haskell:focal
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there officially maintaned images we can use?

ARTIFACT: ${{ matrix.ARTIFACT }}

- if: matrix.ARCH == 'ARM64'
uses: docker://hasufell/arm64v8-ubuntu-haskell:focal
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above


- name: git config
run: |
git config --global --get-all safe.directory | grep '^\*$' || git config --global --add safe.directory "*"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the current ci we just do

git config --global protocol.file.allow always

and we have a comment point to https://bugs.launchpad.net/ubuntu/+source/git/+bug/1993586 (cabal PR #8546)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants