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

Move from Buildkite to GitHub Actions #1115

Closed
wants to merge 60 commits into from
Closed

Move from Buildkite to GitHub Actions #1115

wants to merge 60 commits into from

Conversation

DMRobertson
Copy link
Contributor

@DMRobertson DMRobertson commented Aug 11, 2021

Ended up with a fairly direct translation from Buildkite to GHA. I tried to make more use of actions and so on, but generally found this to be more trouble that it's worth.

@DMRobertson DMRobertson requested a review from a team August 12, 2021 14:13
was just to force actions to trigger in my fork.
@DMRobertson
Copy link
Contributor Author

Suggest we keep using BuildKite for a bit and see how this fares---then can turn off the webhook and remove the config from matrix-org/pipelines

@DMRobertson DMRobertson marked this pull request as ready for review August 13, 2021 09:43
Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

I can't say I know why the Dendrite run is appearing to fail. I don't see where the tap formatting script would return something other than 0 - is that failure flaky or deterministic?

Overall this is looking great. The linked output is very clean, and the resulting pipeline file doubly so!

Most of my comments are just clarifications.

.github/workflows/pipeline.yml Show resolved Hide resolved
.github/workflows/pipeline.yml Show resolved Hide resolved
.github/workflows/pipeline.yml Show resolved Hide resolved
# synapse_sytest.sh expects a synapse checkout at /src
- ${{ github.workspace }}/synapse:/src
env:
POSTGRES: ${{ matrix.postgres && 1 }}
Copy link
Member

Choose a reason for hiding this comment

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

Is && 1 a trick to say that this should be enabled by default?

Why don't we do the same for dendrite's runs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. With that said, it looks to me that dendrite_sytest.sh only ever uses postgres. Maybe the BuildKite config I've been adapting was mistaken?

The script always sets up postgres. Some other bits of perl then determine if we're going to actually use postgres. Need to ensure $POSTGRES is non-empty iff we want to use SQLite.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, not sure if I understand. If POSTGRES is empty, then we set it to true/1 instead...?

Is the same required for BLACKLIST and API?

Copy link
Contributor Author

@DMRobertson DMRobertson Aug 18, 2021

Choose a reason for hiding this comment

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

Hmmm. I think I wrote out a larger comment but that seems to have disappeared.

I think it might be helpful to work through the details from scratch.

What the vars actually do

POSTGRES

POSTGRES is handled differently for synapse and dendrite.

  • In synapse_sytest.sh we only read POSTGRES in tests [ -n "$POSTGRES" ]. We need POSTGRES to be empty or not set for SQLite, and nonempty to use postgres.
  • In Dendrite.pm we test if POSTGRES is not defined or equal to '0', and use SQLlite otherwise.

Taking both behaviours into account:

  • to use postgres, set POSTGRES to any non-empty string other than '0'
  • to use sqllite, don't define POSTGRES

WORKERS

Synapse only. Tested with [ -n "$WORKERS" ].

API

Only for dendrite. If $ENV{'API'} == '1' in Dendrite.pm, we'll pass -api to dendrite. Not sure how that will handle the var being undefined.

BLACKLIST

Only for synapse. If "$BLACKLIST" is empty (test -z) then we set BLACKLIST=sytest-blacklist. It ends up getting passed to run-tests.pl via -B.

GitHub Actions' expression language

The language is typed, but presumably ${{ expr }} converts expr to a string before substituting it into the yaml.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found the best way to experiment was to run a dummy action here: https://github.com/DMRobertson/gha-test/

As far as I can tell, a && b returns a if a is falsey, otherwise b. No type conversion done on the value that gets returned.

The two cases then:

  • when postgres isn't included in the strategy matrix

    • matrix.postgres is null
    • null && 1 evaluates to null.
    • ${{ null }} subsitutes the text null into the yaml file.
    • we end up with a yaml KV pair POSTGRES: null
    • GHA interprets this as "don't set POSTGRES"
  • when postgres: postgres is in the strategy matrix

    • matrix.postgres is 'postgres'
    • 'postgres && 1 is 1
    • ${{ 1 }} substitutes the text null into the yaml file
    • yaml KV POSTGRES: 1
    • GHA sets the POSTGRES env var to the string 1

I'm about to add a commit which confirms this by dumping the environment before we call the bootstrap script.

.github/workflows/pipeline.yml Outdated Show resolved Hide resolved
scripts/dendrite_sytest.sh Outdated Show resolved Hide resolved
.github/workflows/pipeline.yml Outdated Show resolved Hide resolved
David Robertson added 8 commits August 13, 2021 14:51
Need to ensure that API and POSTGRES are the empty strings for dendrite
when they're meant to be off. But ${{ matrix.api == 'full-http' && foo
}} seems to yield either foo or `false`. Stick with what we know works.
but only on BUILDKITE. Keep this around until we're confident with the
GHA workflow.
@DMRobertson
Copy link
Contributor Author

DMRobertson commented Aug 13, 2021

@anoadragon453 Updated as per your comments, (many thanks).

These runs might be of interest:

- Don't use API for synapse; use right matrix key for WORKERS
- echo env vars before we invoke bootstrap script
@DMRobertson
Copy link
Contributor Author

Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

Thanks for answering my query in so much detail! I'm afraid at the moment that your links seem to lead to a private repository that I can't access. I'd like to take a look at the CI runs before approving.

Thanks for tackling the other items as well. Very small nits below in the meantime.

scripts/dendrite_sytest.sh Show resolved Hide resolved
@@ -201,6 +201,7 @@ rsync --ignore-missing-args --min-size=1B -av /work/server-0 /work/server-1 /log
#export TOP=/src
#/venv/bin/coverage combine

# Generate annotate.md This is Buildkite-specific.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# Generate annotate.md This is Buildkite-specific.
# Generate annotate.md. This is Buildkite-specific.

@@ -20,23 +20,23 @@ jobs:
fail-fast: false
matrix:
include:
- label: Python 3.6 / SQLite / Monolith
- label: Py3.6 / SQLite / Monolith
Copy link
Member

Choose a reason for hiding this comment

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

bionic has SQLite 3.22.0 - it can be useful to list it, we've had issues with older SQLite's in the past.

@DMRobertson
Copy link
Contributor Author

I'm afraid at the moment that your links seem to lead to a private repository that I can't access. I'd like to take a look at the CI runs before approving.

Oh bugger. I initially had a public fork where I was testing this stuff out. It looks like I've gone on to delete that fork, presumably when I realised the done thing was to make a branch within the main matrix-org repo. That is unfortunate and presumably means that all the actions runs are gone.

I think it might be best to push the branch I was working on directly to the main sytest repo and open a new pull request.

@anoadragon453
Copy link
Member

anoadragon453 commented Aug 25, 2021

Oh, I've just realised I reviewed the other PR while it was marked as a draft. I'm not sure if that PR was intended just to show off the CI or whether we were moving discussion there.

Either way, ✔️ on the other PR.

@DMRobertson
Copy link
Contributor Author

See the other PR, #1127

DMRobertson pushed a commit that referenced this pull request Aug 31, 2021
Suggest we leave Buildkite running in parallel for the time being. In particular we want to ensure that the cross-branch synapse-sytest and dendrite-sytest stuff works.

Co-authored-by: Andrew Morgan <[email protected]>
DMRobertson pushed a commit that referenced this pull request Sep 8, 2021
In #1115 I didn't correctly handle the situation where there's a corresponding synapse/dendrite branch to fetch. #1128 fell victim to this.

Fix: reuse the shell script from matrix-org/synapse#10160, i.e. consult a wider range of GHA's environment variables.

Co-authored-by: Andrew Morgan <[email protected]>
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.

2 participants