[Wikitech-l] Re: How to specify version of MW that Jenkins should run?

2022-09-15 Thread Antoine Musso

Le 15/09/2022 à 08:55, Robert Vogel via Wikitech-l a écrit :
@Hashar: Just wondering, are there any plans to change CI configs 
after moving development/code-review from gerrit to gitlab [1]? Maybe 
some file living in the repo directly rather than using a centralized 
repo like `integration/config`?


[1] https://www.mediawiki.org/wiki/GitLab/Gerrit_to_GitLab


Hello,


In short it is complicated. Essentially, YES, GitLab provides a way to 
define your CI jobs directly in the code repository (see Gitlab CI quick 
start ).



In longer form it is even more complicated. Given I like wall of texts, 
below is some historical context regarding migrating MediaWiki CI. It is 
rather long form and most can probably stop reading at this point.



*Current CI*


The test infrastructure for MediaWiki is build with:

- Zuul a workflow system (X happens in Gerrit, do A, B, C tasks, report 
to Gerrit)


- Jenkins freestyle jobs, which you can really think as a library of 
shell scripts running shell scripts serially. The jobs are mostly 
invoking commands inside containers (docker run )


- Docker images to provide the execution environment (such as the same 
php version and php extensions Wikimedia uses in production)



The Zuul version we use is from 2017 and has all the CI configuration 
centralized (the infamous integration/config repository) though in 
practice the job/container delegates a lot of the logic to CI entry 
points 
 
such as composer test. Zuul got frozen just before a large rework by 
upstream. It is around that time we:


- moved from a shared build environment to Docker images

- I wrote Quibble  to simplify the 
execution stack (instead of a hundred of scripts scattered in three 
different repositories)



*A digression about GitLab*


My grand idea at the time was to be able to trigger a Kubernetes job 
with a list of parameters (provided by Zuul and consumed by Quibble) and 
an execution environment (a Docker image). Then later on find out a way 
to integrate with the our tool to create container image on the fly: the 
novel Blubber . The upgrade 
to Zuul, phase out of Jenkins and moving the execution from WMCS to a 
Kubernetes cluster,  those did not happen. The foundation had other 
technical priorities and to be fair we did not have the human resources 
to achieve any of it.



A bit later we formed a working group for the future of CI, you can see 
the requirements at 
https://www.mediawiki.org/wiki/Wikimedia_Release_Engineering_Team/CI_Futures_WG/Requirements 
, and a feedback request on wikitech-l 
. 
Different solutions got evaluated and I have required Zuul version 3 to 
be included in the evaluation at least for comparison. Defining the CI 
workflow in the code repository is referred to as "*self serve CI*". 
That became popular with Travis CI. Zuul and Jenkins projects 
implemented similar feature around 2017 as well (Zuul version 3 and 
Jenkins with pipeline as code).



Proof of concepts for 3 different CI systems were build in 2019 one got 
picked (Argo) and we had a nice proposal: 
https://www.mediawiki.org/wiki/Wikimedia_Release_Engineering_Team/Seakeeper_proposal 
. It is a good read as to what we envisioned to push.



Due to internal tensions at the foundation (others wanted to adopt 
GitLab, some *really* hate Gerrit, others would rather use GitHub), our 
Seakeeper proposal got shot at some point late in 2019.  I was not in 
any of this discussions since I had other matters to deal with and went 
briefly out of job due to some Kafkaesque 
 legal situation. Eventually 
Covid has hit early in 2020. In short I don't think I had the mental 
state to be involved or consulted in any of those discussions (nor do I 
think anyone would have thought of reaching out to the /de facto/ 
internal CI expert, but I am exaggerating and ranting at this point. I 
apologize).



GitLab entered the foundation annual plan for July 2020 - June 2021.  
You can read the public announce at 
https://lists.wikimedia.org/hyperkitty/list/wikitech-l@lists.wikimedia.org/message/S6GHXFS2GD2XFCDXT47KDY26RFHCK7R3/ 
. There were some backslashes about lack of a public consultation (and 
rightfully so) but in the end the decision had already been made.  To my 
knowledge all people who were actively pushing for GitLab have since 
left the foundation or moved to different departments.



*Self serve CI!*


All of that to say that, in GitLab, one can define the CI workflow 
directly from the repository. I think the documentation is 
https://docs.gitlab.com/ee/ci/pipelines/merge_request_pipelines.html and 
that system is entirely different than our current 

[Wikitech-l] Re: How to specify version of MW that Jenkins should run?

2022-09-15 Thread Sebastian Berlin
Thanks for the explanations, Antoine. I'll have a look and see if I can
figure it out. Also agree with what Robert just said that it would be nice
if this was more easily configurable. Not sure what other extensions are
supporting, but I'm guessing not all of them are targeting latest MW alpha.

*Sebastian Berlin*
Utvecklare/*Developer*
Wikimedia Sverige (WMSE)

E-post/*E-Mail*: sebastian.ber...@wikimedia.se
Telefon/*Phone*: (+46) 0707 - 92 03 84


On Thu, 15 Sept 2022 at 08:56, Robert Vogel via Wikitech-l <
wikitech-l@lists.wikimedia.org> wrote:

> @Hashar: Just wondering, are there any plans to change CI configs after
> moving development/code-review from gerrit to gitlab [1]? Maybe some file
> living in the repo directly rather than using a centralized repo like
> `integration/config`?
>
> [1] https://www.mediawiki.org/wiki/GitLab/Gerrit_to_GitLab
>
> --
> Robert
> --
> *Von:* Antoine Musso 
> *Gesendet:* Dienstag, 13. September 2022 15:42
> *An:* Wikitech-l ; Sebastian Berlin <
> sebastian.ber...@wikimedia.se>
> *Betreff:* [Wikitech-l] Re: How to specify version of MW that Jenkins
> should run?
>
> Le 12/09/2022 à 12:20, Sebastian Berlin a écrit :
>
> I'm having some issues with Jenkins running the latest version of MW for
> an extension (Wikispeech
> ). Jenkins run with
> the 1.40 alpha, but we want the extension to support the latest LTS (1.35
> as of right now).
>
> I tried changing in extension.json to:
> "requires": {
>  "MediaWiki": "1.35.*"
> }
> which caused an error for Jenkins:
>
> 12:44:09 A dependency error was encountered while installing the extension
> "Wikispeech": Wikispeech is not compatible with the current MediaWiki core
> (version 1.40.0-alpha), it requires: 1.35.*.
>
> The whole log is here: https://phabricator.wikimedia.org/P34482.
>
> How can I specify what version of MW to run with? I've looked at both the
> MW wiki and Wikitech, but hasn't found any instructions for this.
>
> Hello,
>
> There are a lot of good answers and hints in this thread. I will
> complement the answers since I am the one that has introduced the CI system
> currently used for MediaWiki and I used to be in the Wikimedia Foundation
> team which was responsible for MediaWiki development (Platform Engineering,
> disbanded in 2015).
>
> MediaWiki is primarily developed for the Wikimedia project and the focus
> on CI is to ensure that the master branch of MediaWiki core, extensions,
> skins and their composer dependencies are working well together.  The CI
> jobs prefixed "wmf-quibble" clone a few dozen of extensions and are
> triggered whenever one send a patch to one of those extensions or
> mediawiki/core. Hence we have more or less a guarantee that the master
> branches of the participating repositories are all working together.
>
> For the deployment to the Wikimedia cluster, we cut a new deployment
> branch (wmf/XXX) directly from the master branch. Since a change could only
> have been merged in the master branch if all the CI jobs passed, we are
> pretty sure that the set of repositories with their wmf branches are
> passing tests. There are some caveats still but that is the rough idea.
>
> The MediaWiki releases are generated from the REL* branches and CI follows
> the same logic. If one send a patch to their extensions REL1_35 branch, CI
> checkout the REL1_35 branch of mediawiki/core and any other repositories
> participating in the job.
>
> Thus if you send a patch to WikiSpeech REL1_35 you would get
> mediawiki/core and Vector at REL1_35 as well ensuring everything works well
> together (and by everything, I mean what ever is covered by tests). But if
> you send a patch for the master branch, it is the master branch of all
> repositories being checked out. In all case the value(s) of the requires
> field in extension.json does not affect the branch used in CI. It is
> entirely based on the convention that all repos are using the same branch.
>
> There are lot of use cases for developers ensuring the master branch is
> compatible with the current development version (master) AND keeping back
> compatibility all the way up to the latest LTS. But that is not enforced by
> CI. I know Translate does it, most probably through manual testing.
>
>
> What we could potentially do is create a job which would inspect the
> extension requires field to get the target branch to test (so if one
> requires 1.35, target the REL1_35 branch) then invoke the testrunner with
> that branch override (--branch REL1_35). Then if you send a patch to
> WikiSpeech master branch, such a job would test its code against
> mediawiki/core / vector using REL1_35. I am not entirely sure how to
> implement it, but the best place would probably be
> https://gerrit.wikimedia.org/g/integration/quibble/  It is the code
> holding all the logic to clone/checkout repositories, setup MediaWiki and
> run the test suite.  I am guessing when a change is 

[Wikitech-l] Re: How to specify version of MW that Jenkins should run?

2022-09-15 Thread Robert Vogel via Wikitech-l
@Hashar: Just wondering, are there any plans to change CI configs after moving 
development/code-review from gerrit to gitlab [1]? Maybe some file living in 
the repo directly rather than using a centralized repo like 
`integration/config`?

[1] https://www.mediawiki.org/wiki/GitLab/Gerrit_to_GitLab

--
Robert

Von: Antoine Musso 
Gesendet: Dienstag, 13. September 2022 15:42
An: Wikitech-l ; Sebastian Berlin 

Betreff: [Wikitech-l] Re: How to specify version of MW that Jenkins should run?

Le 12/09/2022 à 12:20, Sebastian Berlin a écrit :
I'm having some issues with Jenkins running the latest version of MW for an 
extension (Wikispeech). 
Jenkins run with the 1.40 alpha, but we want the extension to support the 
latest LTS (1.35 as of right now).

I tried changing in extension.json to:
"requires": {
 "MediaWiki": "1.35.*"
}
which caused an error for Jenkins:
12:44:09 A dependency error was encountered while installing the extension 
"Wikispeech": Wikispeech is not compatible with the current MediaWiki core 
(version 1.40.0-alpha), it requires: 1.35.*.
The whole log is here: https://phabricator.wikimedia.org/P34482.

How can I specify what version of MW to run with? I've looked at both the MW 
wiki and Wikitech, but hasn't found any instructions for this.

Hello,

There are a lot of good answers and hints in this thread. I will complement the 
answers since I am the one that has introduced the CI system currently used for 
MediaWiki and I used to be in the Wikimedia Foundation team which was 
responsible for MediaWiki development (Platform Engineering, disbanded in 2015).

MediaWiki is primarily developed for the Wikimedia project and the focus on CI 
is to ensure that the master branch of MediaWiki core, extensions, skins and 
their composer dependencies are working well together.  The CI jobs prefixed 
"wmf-quibble" clone a few dozen of extensions and are triggered whenever one 
send a patch to one of those extensions or mediawiki/core. Hence we have more 
or less a guarantee that the master branches of the participating repositories 
are all working together.

For the deployment to the Wikimedia cluster, we cut a new deployment branch 
(wmf/XXX) directly from the master branch. Since a change could only have been 
merged in the master branch if all the CI jobs passed, we are pretty sure that 
the set of repositories with their wmf branches are passing tests. There are 
some caveats still but that is the rough idea.

The MediaWiki releases are generated from the REL* branches and CI follows the 
same logic. If one send a patch to their extensions REL1_35 branch, CI checkout 
the REL1_35 branch of mediawiki/core and any other repositories participating 
in the job.

Thus if you send a patch to WikiSpeech REL1_35 you would get mediawiki/core and 
Vector at REL1_35 as well ensuring everything works well together (and by 
everything, I mean what ever is covered by tests). But if you send a patch for 
the master branch, it is the master branch of all repositories being checked 
out. In all case the value(s) of the requires field in extension.json does not 
affect the branch used in CI. It is entirely based on the convention that all 
repos are using the same branch.

There are lot of use cases for developers ensuring the master branch is 
compatible with the current development version (master) AND keeping back 
compatibility all the way up to the latest LTS. But that is not enforced by CI. 
I know Translate does it, most probably through manual testing.


What we could potentially do is create a job which would inspect the extension 
requires field to get the target branch to test (so if one requires 1.35, 
target the REL1_35 branch) then invoke the testrunner with that branch override 
(--branch REL1_35). Then if you send a patch to WikiSpeech master branch, such 
a job would test its code against mediawiki/core / vector using REL1_35. I am 
not entirely sure how to implement it, but the best place would probably be 
https://gerrit.wikimedia.org/g/integration/quibble/  It is the code holding all 
the logic to clone/checkout repositories, setup MediaWiki and run the test 
suite.  I am guessing when a change is targeting an extension or skin, Quibble 
would clone it first, inspect the extension.json and then internally set the 
default branch (the `--branch` parameter). And we can have a Jenkins job using 
that feature and running along the rest of the jobs.

It will most probably be fine for extensions that do not have many other 
dependencies.

The relevant task would be https://phabricator.wikimedia.org/T196467 . I think 
the devil is defining the workflow that is needed, which is more or less the 
text above.


Antoine "hashar" Musso




___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org