Skip to contentSkip to conversation

QEMU Gating CI

PATCH In review Cleber Rosa 9 participants 39 messages Jul 9, 2020 – Sep 4, 2020

lore
Share & tools
lore
#0 lore raw

v2 cover QEMU Gating CI

The idea about a public facing Gating CI for QEMU was summarized in an RFC[1]. Since then, it was decided that a simpler version should be attempted first.

At this point, there are two specific runners (an aarch64 and an s390) registered with GitLab, at https://gitlab.com/qemu-project, currently setup to the "qemu" repository.

Changes from v1:

- Added jobs that require specific GitLab runners already available (Ubuntu 20.04 on aarch64, and Ubuntu 18.04 on s390x)
- Removed jobs that require specific GitLab runners not yet available (Fedora 30, FreeBSD 12.1)
- Updated documentation
- Added copyright and license to new scripts
- Moved script to from "contrib" to "scripts/ci/"
- Moved setup playbooks form "contrib" to "scripts/ci/setup"
- Moved "gating.yml" to ".gitlab-ci.d" directory
- Removed "staging" only branch restriction on jobs defined in ".gitlab-ci.yml", assumes that the additional jobs on the staging branch running on the freely available gitlab shared runner are positive
- Dropped patches 1-3 (already merged)
- Simplified amount of version specifity on Ubuntu, from 18.04.3 to simply 18.04 (assumes no diverse minor levels will be used or specific runners)

Changes from the RFC patches[2] accompanying the RFC document:

- Moved gating job definitions to .gitlab-ci-gating.yml
- Added info on "--disable-libssh" build option requirement
(https://bugs.launchpad.net/qemu/+bug/1838763) to Ubuntu 18.04 jobs
- Added info on "--disable-glusterfs" build option requirement (there's no static version of those libs in distro supplied packages) to one
- Dropped ubuntu-18.04.3-x86_64-notools job definition, because it doesn't fall into the general scope of gating job described by PMM (and it did not run any test)
- Added w32 and w64 cross builds based on Fedora 30
- Added a FreeBSD based job that builds all targets and runs make check
- Added "-jnproc" and "-jsysctl -n hw.ncpu" options to make as a simple but effective way of speeding up the builds and tests by using a number of make jobs matching the number of CPUs
- Because the Ansible playbooks reference the content on Dockerfiles, some fixes to some Dockerfiles caught in the process were included
- New patch with script to check or wait on a pipeline execution

[1] - https://lists.gnu.org/archive/html/qemu-devel/2019-12/msg00231.html
[2] - https://lists.gnu.org/archive/html/qemu-devel/2020-02/msg00154.html

Cleber Rosa (2):
GitLab Gating CI: introduce pipeline-status contrib script GitLab Gating CI: initial set of jobs, documentation and scripts

 .gitlab-ci.d/gating.yml                | 146 +++++++++++++++++
 .gitlab-ci.yml                         |   1 +
 docs/devel/testing.rst                 | 147 +++++++++++++++++
 scripts/ci/gitlab-pipeline-status      | 156 ++++++++++++++++++
 scripts/ci/setup/build-environment.yml | 217 +++++++++++++++++++++++++
 scripts/ci/setup/gitlab-runner.yml     |  72 ++++++++
 scripts/ci/setup/inventory             |   2 +
 scripts/ci/setup/vars.yml              |  13 ++
 8 files changed, 754 insertions(+)
 create mode 100644 .gitlab-ci.d/gating.yml
 create mode 100755 scripts/ci/gitlab-pipeline-status
 create mode 100644 scripts/ci/setup/build-environment.yml
 create mode 100644 scripts/ci/setup/gitlab-runner.yml
 create mode 100644 scripts/ci/setup/inventory
 create mode 100644 scripts/ci/setup/vars.yml
Signature · 1 line
2.25.4
#1 lore raw

PATCH v2 1/2 GitLab Gating CI: introduce pipeline-status contrib script

This script is intended to be used right after a push to a branch.

By default, it will look for the pipeline associated with the commit that is the HEAD of the *local* staging branch. It can be used as a one time check, or with the --wait option to wait until the pipeline completes.

If the pipeline is successful, then a merge of the staging branch into the master branch should be the next step.

---
 scripts/ci/gitlab-pipeline-status | 156 ++++++++++++++++++++++++++++++
 1 file changed, 156 insertions(+)
 create mode 100755 scripts/ci/gitlab-pipeline-status
scripts/ci/gitlab-pipeline-status new file +156 -0
new file mode 100755
index 0000000000..4a9de39872
@@ -0,0 +1,156 @@
+#!/usr/bin/env python3
+#
+# Copyright (c) 2019-2020 Red Hat, Inc.
+#
+# Author:
+#  Cleber Rosa <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+"""
+Checks the GitLab pipeline status for a given commit commit
+"""
+
+# pylint: disable=C0103
+
+import argparse
+import http.client
+import json
+import os
+import subprocess
+import time
+import sys
+
+
+def get_local_staging_branch_commit():
+    """
+    Returns the commit sha1 for the *local* branch named "staging"
+    """
+    result = subprocess.run(['git', 'rev-parse', 'staging'],
+                            stdin=subprocess.DEVNULL,
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.DEVNULL,
+                            cwd=os.path.dirname(__file__),
+                            universal_newlines=True).stdout.strip()
+    if result == 'staging':
+        raise ValueError("There's no local staging branch")
+    if len(result) != 40:
+        raise ValueError("Branch staging HEAD doesn't look like a sha1")
+    return result
+
+
+def get_pipeline_status(project_id, commit_sha1):
+    """
+    Returns the JSON content of the pipeline status API response
+    """
+    url = '/api/v4/projects/{}/pipelines?sha={}'.format(project_id,
+                                                        commit_sha1)
+    connection = http.client.HTTPSConnection('gitlab.com')
+    connection.request('GET', url=url)
+    response = connection.getresponse()
+    if response.code != http.HTTPStatus.OK:
+        raise ValueError("Failed to receive a successful response")
+    json_response = json.loads(response.read())
+    # afaict, there should one one pipeline for the same project + commit
+    # if this assumption is false, we can add further filters to the
+    # url, such as username, and order_by.
+    if not json_response:
+        raise ValueError("No pipeline found")
+    return json_response[0]
+
+
+def wait_on_pipeline_success(timeout, interval,
+                             project_id, commit_sha):
+    """
+    Waits for the pipeline to end up to the timeout given
+    """
+    start = time.time()
+    while True:
+        if time.time() >= (start + timeout):
+            print("Waiting on the pipeline success timed out")
+            return False
+
+        status = get_pipeline_status(project_id, commit_sha)
+        if status['status'] == 'running':
+            time.sleep(interval)
+            print('running...')
+            continue
+
+        if status['status'] == 'success':
+            return True
+
+        msg = "Pipeline ended unsuccessfully, check: %s" % status['web_url']
+        print(msg)
+        return False
+
+
+def main():
+    """
+    Script entry point
+    """
+    parser = argparse.ArgumentParser(
+        prog='pipeline-status',
+        description='check or wait on a pipeline status')
+
+    parser.add_argument('-t', '--timeout', type=int, default=7200,
+                        help=('Amount of time (in seconds) to wait for the '
+                              'pipeline to complete.  Defaults to '
+                              '%(default)s'))
+    parser.add_argument('-i', '--interval', type=int, default=60,
+                        help=('Amount of time (in seconds) to wait between '
+                              'checks of the pipeline status.  Defaults '
+                              'to %(default)s'))
+    parser.add_argument('-w', '--wait', action='store_true', default=False,
+                        help=('Wether to wait, instead of checking only once '
+                              'the status of a pipeline'))
+    parser.add_argument('-p', '--project-id', type=int, default=11167699,
+                        help=('The GitLab project ID. Defaults to the project '
+                              'for https://gitlab.com/qemu-project/qemu, that '
+                              'is, "%(default)s"'))
+    try:
+        default_commit = get_local_staging_branch_commit()
+        commit_required = False
+    except ValueError:
+        default_commit = ''
+        commit_required = True
+    parser.add_argument('-c', '--commit', required=commit_required,
+                        default=default_commit,
+                        help=('Look for a pipeline associated with the given '
+                              'commit.  If one is not explicitly given, the '
+                              'commit associated with the local branch named '
+                              '"staging" is used.  Default: %(default)s'))
+    parser.add_argument('--verbose', action='store_true', default=False,
+                        help=('A minimal verbosity level that prints the '
+                              'overall result of the check/wait'))
+
+    args = parser.parse_args()
+
+    try:
+        if args.wait:
+            success = wait_on_pipeline_success(
+                args.timeout,
+                args.interval,
+                args.project_id,
+                args.commit)
+        else:
+            status = get_pipeline_status(args.project_id,
+                                         args.commit)
+            success = status['status'] == 'success'
+    except Exception as error:      # pylint: disable=W0703
+        success = False
+        if args.verbose:
+            print("ERROR: %s" % error.args[0])
+
+    if success:
+        if args.verbose:
+            print('success')
+        sys.exit(0)
+    else:
+        if args.verbose:
+            print('failure')
+        sys.exit(1)
+
+
+if __name__ == '__main__':
+    main()
Signature · 1 line
2.25.4
#2 lore raw

Re: [PATCH v2 1/2] GitLab Gating CI: introduce pipeline-status contrib script

Quoted 24 lines · Cleber Rosa

This script is intended to be used right after a push to a branch.

By default, it will look for the pipeline associated with the commit that is the HEAD of the *local* staging branch. It can be used as a one time check, or with the --wait option to wait until the pipeline completes.

If the pipeline is successful, then a merge of the staging branch into the master branch should be the next step.

---
 scripts/ci/gitlab-pipeline-status | 156 ++++++++++++++++++++++++++++++
 1 file changed, 156 insertions(+)
 create mode 100755 scripts/ci/gitlab-pipeline-status
scripts/ci/gitlab-pipeline-status new file +2 -0
new file mode 100755
index 0000000000..4a9de39872
@@ -0,0 +1,156 @@
+#!/usr/bin/env python3
+#

scripts/ci/gitlab-pipeline-status line 12

Quoted 10 lines
scripts/ci/gitlab-pipeline-status new file +10 -0
+# Copyright (c) 2019-2020 Red Hat, Inc.
+#
+# Author:
+#  Cleber Rosa <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+"""
+Checks the GitLab pipeline status for a given commit commit

s/commit$/(hash|sha|ID|)

Quoted 8 lines
scripts/ci/gitlab-pipeline-status new file +8 -0
+"""
+
+# pylint: disable=C0103
+
+import argparse
+import http.client
+import json
+import os

scripts/ci/gitlab-pipeline-status line 30

Quoted 10 lines
scripts/ci/gitlab-pipeline-status new file +10 -0
+import subprocess
+import time
+import sys
+
+
+def get_local_staging_branch_commit():
+    """
+    Returns the commit sha1 for the *local* branch named "staging"
+    """
+    result = subprocess.run(['git', 'rev-parse', 'staging'],

If one day Peter decides that "staging" is not a cool name anymore and use a different name for the branch :) we should account for that and make it a variable, possibly even parametrize this function with it.

scripts/ci/gitlab-pipeline-status line 37

Quoted 7 lines
scripts/ci/gitlab-pipeline-status new file +7 -0
+                            stdin=subprocess.DEVNULL,
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.DEVNULL,
+                            cwd=os.path.dirname(__file__),
+                            universal_newlines=True).stdout.strip()
+    if result == 'staging':
+        raise ValueError("There's no local staging branch")

"There's no local branch named 'staging'" would IMO be more descriptive, so as not to confuse it with staging in git.

Quoted 7 lines
scripts/ci/gitlab-pipeline-status new file +7 -0
+    if len(result) != 40:
+        raise ValueError("Branch staging HEAD doesn't look like a sha1")
+    return result
+
+
+def get_pipeline_status(project_id, commit_sha1):
+    """

scripts/ci/gitlab-pipeline-status line 54

Quoted 10 lines
scripts/ci/gitlab-pipeline-status new file +10 -0
+    Returns the JSON content of the pipeline status API response
+    """
+    url = '/api/v4/projects/{}/pipelines?sha={}'.format(project_id,
+                                                        commit_sha1)
+    connection = http.client.HTTPSConnection('gitlab.com')
+    connection.request('GET', url=url)
+    response = connection.getresponse()
+    if response.code != http.HTTPStatus.OK:
+        raise ValueError("Failed to receive a successful response")
+    json_response = json.loads(response.read())

a blank line separating the commentary block would slightly help readability

scripts/ci/gitlab-pipeline-status line 55

Quoted 1 line
scripts/ci/gitlab-pipeline-status new file +1 -0
+    # afaict, there should one one pipeline for the same project + commit

s/one one/be only one/

scripts/ci/gitlab-pipeline-status line 66

Quoted 11 lines
scripts/ci/gitlab-pipeline-status new file +11 -0
+    # if this assumption is false, we can add further filters to the
+    # url, such as username, and order_by.
+    if not json_response:
+        raise ValueError("No pipeline found")
+    return json_response[0]
+
+
+def wait_on_pipeline_success(timeout, interval,
+                             project_id, commit_sha):
+    """
+    Waits for the pipeline to end up to the timeout given

"Waits for the pipeline to finish within the given timeout"

scripts/ci/gitlab-pipeline-status line 71

Quoted 5 lines
scripts/ci/gitlab-pipeline-status new file +5 -0
+    """
+    start = time.time()
+    while True:
+        if time.time() >= (start + timeout):
+            print("Waiting on the pipeline success timed out")

s/success//
(the pipeline doesn't always have to finish with success)

scripts/ci/gitlab-pipeline-status line 83

Quoted 12 lines
scripts/ci/gitlab-pipeline-status new file +12 -0
+            return False
+
+        status = get_pipeline_status(project_id, commit_sha)
+        if status['status'] == 'running':
+            time.sleep(interval)
+            print('running...')
+            continue
+
+        if status['status'] == 'success':
+            return True
+
+        msg = "Pipeline ended unsuccessfully, check: %s" % status['web_url']

I think more common expression is "Pipeline failed"

scripts/ci/gitlab-pipeline-status line 86

Quoted 3 lines
scripts/ci/gitlab-pipeline-status new file +3 -0
+        print(msg)
+        return False
+

...

Code-wise looks OK to me, but since I don't know what Peter's requirements on/expectations of this script are, I can't do a more thorough review.

Regards,
Erik

#3 lore raw

Re: [PATCH v2 1/2] GitLab Gating CI: introduce pipeline-status contrib script

Quoted 52 lines · Erik Skultety
Quoted 24 lines · Cleber Rosa

This script is intended to be used right after a push to a branch.

By default, it will look for the pipeline associated with the commit that is the HEAD of the *local* staging branch. It can be used as a one time check, or with the --wait option to wait until the pipeline completes.

If the pipeline is successful, then a merge of the staging branch into the master branch should be the next step.

---
 scripts/ci/gitlab-pipeline-status | 156 ++++++++++++++++++++++++++++++
 1 file changed, 156 insertions(+)
 create mode 100755 scripts/ci/gitlab-pipeline-status
scripts/ci/gitlab-pipeline-status new file +2 -0
new file mode 100755
index 0000000000..4a9de39872
@@ -0,0 +1,156 @@
+#!/usr/bin/env python3
+#

scripts/ci/gitlab-pipeline-status line 12

Quoted 10 lines
scripts/ci/gitlab-pipeline-status new file +10 -0
+# Copyright (c) 2019-2020 Red Hat, Inc.
+#
+# Author:
+#  Cleber Rosa <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+"""
+Checks the GitLab pipeline status for a given commit commit

s/commit$/(hash|sha|ID|)

Quoted 14 lines
scripts/ci/gitlab-pipeline-status new file +14 -0
+"""
+
+# pylint: disable=C0103
+
+import argparse
+import http.client
+import json
+import os
+import subprocess
+import time
+import sys
+
+
+def get_local_staging_branch_commit():
Quoted 8 lines

scripts/ci/gitlab-pipeline-status line 30

Quoted 4 lines
scripts/ci/gitlab-pipeline-status new file +4 -0
+    """
+    Returns the commit sha1 for the *local* branch named "staging"
+    """
+    result = subprocess.run(['git', 'rev-parse', 'staging'],

If one day Peter decides that "staging" is not a cool name anymore and use a different name for the branch :) we should account for that and make it a variable, possibly even parametrize this function with it.

This script can be used by any fork, not only Peter. So having a parameter (default to 'staging') is a requisite IMO.

Quoted 31 lines

scripts/ci/gitlab-pipeline-status line 37

Quoted 7 lines
scripts/ci/gitlab-pipeline-status new file +7 -0
+                            stdin=subprocess.DEVNULL,
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.DEVNULL,
+                            cwd=os.path.dirname(__file__),
+                            universal_newlines=True).stdout.strip()
+    if result == 'staging':
+        raise ValueError("There's no local staging branch")

"There's no local branch named 'staging'" would IMO be more descriptive, so as not to confuse it with staging in git.

Quoted 7 lines
scripts/ci/gitlab-pipeline-status new file +7 -0
+    if len(result) != 40:
+        raise ValueError("Branch staging HEAD doesn't look like a sha1")
+    return result
+
+
+def get_pipeline_status(project_id, commit_sha1):
+    """

scripts/ci/gitlab-pipeline-status line 54

Quoted 10 lines
scripts/ci/gitlab-pipeline-status new file +10 -0
+    Returns the JSON content of the pipeline status API response
+    """
+    url = '/api/v4/projects/{}/pipelines?sha={}'.format(project_id,
+                                                        commit_sha1)
+    connection = http.client.HTTPSConnection('gitlab.com')
+    connection.request('GET', url=url)
+    response = connection.getresponse()
+    if response.code != http.HTTPStatus.OK:
+        raise ValueError("Failed to receive a successful response")
+    json_response = json.loads(response.read())

a blank line separating the commentary block would slightly help readability

Quoted 3 lines

scripts/ci/gitlab-pipeline-status line 55

Quoted 1 line
scripts/ci/gitlab-pipeline-status new file +1 -0
+    # afaict, there should one one pipeline for the same project + commit

s/one one/be only one/

'afaict' is not a word.

Quoted 15 lines

scripts/ci/gitlab-pipeline-status line 66

Quoted 12 lines
scripts/ci/gitlab-pipeline-status new file +11 -0
+    # if this assumption is false, we can add further filters to the
+    # url, such as username, and order_by.
+    if not json_response:
+        raise ValueError("No pipeline found")
+    return json_response[0]
+
+
+def wait_on_pipeline_success(timeout, interval,
+                             project_id, commit_sha):
+    """
+    Waits for the pipeline to end up to the timeout given

"Waits for the pipeline to finish within the given timeout"

Quoted 15 lines

scripts/ci/gitlab-pipeline-status line 71

Quoted 5 lines
scripts/ci/gitlab-pipeline-status new file +5 -0
+    """
+    start = time.time()
+    while True:
+        if time.time() >= (start + timeout):
+            print("Waiting on the pipeline success timed out")

s/success//
(the pipeline doesn't always have to finish with success)

Quoted 6 lines
scripts/ci/gitlab-pipeline-status new file +6 -0
+            return False
+
+        status = get_pipeline_status(project_id, commit_sha)
+        if status['status'] == 'running':
+            time.sleep(interval)
+            print('running...')

If we want to automate the use of this script by a daemon, it would be better to use the logging class. Then maybe 'running...' is for the DEBUG level, Other print() calls can be updated to WARN/INFO levels.

Quoted 20 lines

scripts/ci/gitlab-pipeline-status line 83

Quoted 6 lines
scripts/ci/gitlab-pipeline-status new file +6 -0
+            continue
+
+        if status['status'] == 'success':
+            return True
+
+        msg = "Pipeline ended unsuccessfully, check: %s" % status['web_url']

I think more common expression is "Pipeline failed"

scripts/ci/gitlab-pipeline-status line 86

Quoted 3 lines
scripts/ci/gitlab-pipeline-status new file +3 -0
+        print(msg)
+        return False
+

...

Code-wise looks OK to me, but since I don't know what Peter's requirements on/expectations of this script are, I can't do a more thorough review.

Regards,
Erik

#4 lore raw

Re: [PATCH v2 1/2] GitLab Gating CI: introduce pipeline-status contrib script

Quoted 133 lines · Philippe Mathieu-Daudé
Quoted 52 lines · Erik Skultety
Quoted 24 lines · Cleber Rosa

This script is intended to be used right after a push to a branch.

By default, it will look for the pipeline associated with the commit that is the HEAD of the *local* staging branch. It can be used as a one time check, or with the --wait option to wait until the pipeline completes.

If the pipeline is successful, then a merge of the staging branch into the master branch should be the next step.

---
 scripts/ci/gitlab-pipeline-status | 156 ++++++++++++++++++++++++++++++
 1 file changed, 156 insertions(+)
 create mode 100755 scripts/ci/gitlab-pipeline-status
scripts/ci/gitlab-pipeline-status new file +2 -0
new file mode 100755
index 0000000000..4a9de39872
@@ -0,0 +1,156 @@
+#!/usr/bin/env python3
+#

scripts/ci/gitlab-pipeline-status line 12

Quoted 10 lines
scripts/ci/gitlab-pipeline-status new file +10 -0
+# Copyright (c) 2019-2020 Red Hat, Inc.
+#
+# Author:
+#  Cleber Rosa <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+"""
+Checks the GitLab pipeline status for a given commit commit

s/commit$/(hash|sha|ID|)

Quoted 14 lines
scripts/ci/gitlab-pipeline-status new file +14 -0
+"""
+
+# pylint: disable=C0103
+
+import argparse
+import http.client
+import json
+import os
+import subprocess
+import time
+import sys
+
+
+def get_local_staging_branch_commit():
Quoted 8 lines

scripts/ci/gitlab-pipeline-status line 30

Quoted 4 lines
scripts/ci/gitlab-pipeline-status new file +4 -0
+    """
+    Returns the commit sha1 for the *local* branch named "staging"
+    """
+    result = subprocess.run(['git', 'rev-parse', 'staging'],

If one day Peter decides that "staging" is not a cool name anymore and use a different name for the branch :) we should account for that and make it a variable, possibly even parametrize this function with it.

This script can be used by any fork, not only Peter. So having a parameter (default to 'staging') is a requisite IMO.

Quoted 31 lines

scripts/ci/gitlab-pipeline-status line 37

Quoted 7 lines
scripts/ci/gitlab-pipeline-status new file +7 -0
+                            stdin=subprocess.DEVNULL,
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.DEVNULL,
+                            cwd=os.path.dirname(__file__),
+                            universal_newlines=True).stdout.strip()
+    if result == 'staging':
+        raise ValueError("There's no local staging branch")

"There's no local branch named 'staging'" would IMO be more descriptive, so as not to confuse it with staging in git.

Quoted 7 lines
scripts/ci/gitlab-pipeline-status new file +7 -0
+    if len(result) != 40:
+        raise ValueError("Branch staging HEAD doesn't look like a sha1")
+    return result
+
+
+def get_pipeline_status(project_id, commit_sha1):
+    """

scripts/ci/gitlab-pipeline-status line 54

Quoted 10 lines
scripts/ci/gitlab-pipeline-status new file +10 -0
+    Returns the JSON content of the pipeline status API response
+    """
+    url = '/api/v4/projects/{}/pipelines?sha={}'.format(project_id,
+                                                        commit_sha1)
+    connection = http.client.HTTPSConnection('gitlab.com')
+    connection.request('GET', url=url)
+    response = connection.getresponse()
+    if response.code != http.HTTPStatus.OK:
+        raise ValueError("Failed to receive a successful response")
+    json_response = json.loads(response.read())

a blank line separating the commentary block would slightly help readability

Quoted 3 lines

scripts/ci/gitlab-pipeline-status line 55

Quoted 1 line
scripts/ci/gitlab-pipeline-status new file +1 -0
+    # afaict, there should one one pipeline for the same project + commit

s/one one/be only one/

'afaict' is not a word.

Quoted 15 lines

scripts/ci/gitlab-pipeline-status line 66

Quoted 12 lines
scripts/ci/gitlab-pipeline-status new file +11 -0
+    # if this assumption is false, we can add further filters to the
+    # url, such as username, and order_by.
+    if not json_response:
+        raise ValueError("No pipeline found")
+    return json_response[0]
+
+
+def wait_on_pipeline_success(timeout, interval,
+                             project_id, commit_sha):
+    """
+    Waits for the pipeline to end up to the timeout given

"Waits for the pipeline to finish within the given timeout"

Quoted 15 lines

scripts/ci/gitlab-pipeline-status line 71

Quoted 5 lines
scripts/ci/gitlab-pipeline-status new file +5 -0
+    """
+    start = time.time()
+    while True:
+        if time.time() >= (start + timeout):
+            print("Waiting on the pipeline success timed out")

s/success//
(the pipeline doesn't always have to finish with success)

Quoted 6 lines
scripts/ci/gitlab-pipeline-status new file +6 -0
+            return False
+
+        status = get_pipeline_status(project_id, commit_sha)
+        if status['status'] == 'running':
+            time.sleep(interval)
+            print('running...')
Quoted 21 lines

If we want to automate the use of this script by a daemon, it would be better to use the logging class. Then maybe 'running...' is for the DEBUG level, Other print() calls can be updated to WARN/INFO levels.

Quoted 16 lines

scripts/ci/gitlab-pipeline-status line 83

Quoted 6 lines
scripts/ci/gitlab-pipeline-status new file +6 -0
+            continue
+
+        if status['status'] == 'success':
+            return True
+
+        msg = "Pipeline ended unsuccessfully, check: %s" % status['web_url']

I think more common expression is "Pipeline failed"

scripts/ci/gitlab-pipeline-status line 86

Quoted 3 lines
scripts/ci/gitlab-pipeline-status new file +3 -0
+        print(msg)
+        return False
+

...

Code-wise looks OK to me, but since I don't know what Peter's requirements on/expectations of this script are, I can't do a more thorough review.

Ok, I'll add some of the trivial suggestions and take this patch through my gitlab tree, so Peter can start integrating the gitlab CI in his merge workflow. We can then later add additional features like the parameter for the branch name or the logging class.
(I'll skip the second patch for now since there were more questions raised there which should likely be answered / discussed first)

Thomas

#5 lore raw

Re: [PATCH v2 1/2] GitLab Gating CI: introduce pipeline-status contrib script

In reply to Philippe Mathieu-Daudé
Quoted 62 lines · Philippe Mathieu-Daudé
Quoted 52 lines · Erik Skultety
Quoted 24 lines · Cleber Rosa

This script is intended to be used right after a push to a branch.

By default, it will look for the pipeline associated with the commit that is the HEAD of the *local* staging branch. It can be used as a one time check, or with the --wait option to wait until the pipeline completes.

If the pipeline is successful, then a merge of the staging branch into the master branch should be the next step.

---
 scripts/ci/gitlab-pipeline-status | 156 ++++++++++++++++++++++++++++++
 1 file changed, 156 insertions(+)
 create mode 100755 scripts/ci/gitlab-pipeline-status
scripts/ci/gitlab-pipeline-status new file +2 -0
new file mode 100755
index 0000000000..4a9de39872
@@ -0,0 +1,156 @@
+#!/usr/bin/env python3
+#

scripts/ci/gitlab-pipeline-status line 12

Quoted 10 lines
scripts/ci/gitlab-pipeline-status new file +10 -0
+# Copyright (c) 2019-2020 Red Hat, Inc.
+#
+# Author:
+#  Cleber Rosa <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+"""
+Checks the GitLab pipeline status for a given commit commit

s/commit$/(hash|sha|ID|)

Quoted 14 lines
scripts/ci/gitlab-pipeline-status new file +14 -0
+"""
+
+# pylint: disable=C0103
+
+import argparse
+import http.client
+import json
+import os
+import subprocess
+import time
+import sys
+
+
+def get_local_staging_branch_commit():
Quoted 8 lines

scripts/ci/gitlab-pipeline-status line 30

Quoted 4 lines
scripts/ci/gitlab-pipeline-status new file +4 -0
+    """
+    Returns the commit sha1 for the *local* branch named "staging"
+    """
+    result = subprocess.run(['git', 'rev-parse', 'staging'],

If one day Peter decides that "staging" is not a cool name anymore and use a different name for the branch :) we should account for that and make it a variable, possibly even parametrize this function with it.

Quoted 3 lines

This script can be used by any fork, not only Peter. So having a parameter (default to 'staging') is a requisite IMO.

Right, as explained in the reply to Erik, this is just used for finding the commit ID for the staging branch. Still, I'm making it configurable in a new patch, and if people want, we can change the current behavior to accept any kind of revision (but this would probably mean changing the options or names, given that -c/--commit is quite descriptive).

Quoted 31 lines
Quoted 31 lines

scripts/ci/gitlab-pipeline-status line 37

Quoted 7 lines
scripts/ci/gitlab-pipeline-status new file +7 -0
+                            stdin=subprocess.DEVNULL,
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.DEVNULL,
+                            cwd=os.path.dirname(__file__),
+                            universal_newlines=True).stdout.strip()
+    if result == 'staging':
+        raise ValueError("There's no local staging branch")

"There's no local branch named 'staging'" would IMO be more descriptive, so as not to confuse it with staging in git.

Quoted 7 lines
scripts/ci/gitlab-pipeline-status new file +7 -0
+    if len(result) != 40:
+        raise ValueError("Branch staging HEAD doesn't look like a sha1")
+    return result
+
+
+def get_pipeline_status(project_id, commit_sha1):
+    """

scripts/ci/gitlab-pipeline-status line 54

Quoted 10 lines
scripts/ci/gitlab-pipeline-status new file +10 -0
+    Returns the JSON content of the pipeline status API response
+    """
+    url = '/api/v4/projects/{}/pipelines?sha={}'.format(project_id,
+                                                        commit_sha1)
+    connection = http.client.HTTPSConnection('gitlab.com')
+    connection.request('GET', url=url)
+    response = connection.getresponse()
+    if response.code != http.HTTPStatus.OK:
+        raise ValueError("Failed to receive a successful response")
+    json_response = json.loads(response.read())

a blank line separating the commentary block would slightly help readability

Quoted 6 lines
Quoted 3 lines

scripts/ci/gitlab-pipeline-status line 55

Quoted 1 line
scripts/ci/gitlab-pipeline-status new file +1 -0
+    # afaict, there should one one pipeline for the same project + commit

s/one one/be only one/

'afaict' is not a word.

Yes, good point. Thomas has addressed this.

Quoted 31 lines
Quoted 15 lines

scripts/ci/gitlab-pipeline-status line 66

Quoted 12 lines
scripts/ci/gitlab-pipeline-status new file +11 -0
+    # if this assumption is false, we can add further filters to the
+    # url, such as username, and order_by.
+    if not json_response:
+        raise ValueError("No pipeline found")
+    return json_response[0]
+
+
+def wait_on_pipeline_success(timeout, interval,
+                             project_id, commit_sha):
+    """
+    Waits for the pipeline to end up to the timeout given

"Waits for the pipeline to finish within the given timeout"

Quoted 15 lines

scripts/ci/gitlab-pipeline-status line 71

Quoted 5 lines
scripts/ci/gitlab-pipeline-status new file +5 -0
+    """
+    start = time.time()
+    while True:
+        if time.time() >= (start + timeout):
+            print("Waiting on the pipeline success timed out")

s/success//
(the pipeline doesn't always have to finish with success)

Quoted 6 lines
scripts/ci/gitlab-pipeline-status new file +6 -0
+            return False
+
+        status = get_pipeline_status(project_id, commit_sha)
+        if status['status'] == 'running':
+            time.sleep(interval)
+            print('running...')
Quoted 5 lines

If we want to automate the use of this script by a daemon, it would be better to use the logging class. Then maybe 'running...' is for the DEBUG level, Other print() calls can be updated to WARN/INFO levels.

Makes sense. I'll look into using proper logging in a future improvement series.

Thanks,
- Cleber.

#6 lore raw

Re: [PATCH v2 1/2] GitLab Gating CI: introduce pipeline-status contrib script

In reply to Erik Skultety
Quoted 29 lines · Erik Skultety
Quoted 28 lines · Cleber Rosa

This script is intended to be used right after a push to a branch.

By default, it will look for the pipeline associated with the commit that is the HEAD of the *local* staging branch. It can be used as a one time check, or with the --wait option to wait until the pipeline completes.

If the pipeline is successful, then a merge of the staging branch into the master branch should be the next step.

---
 scripts/ci/gitlab-pipeline-status | 156 ++++++++++++++++++++++++++++++
 1 file changed, 156 insertions(+)
 create mode 100755 scripts/ci/gitlab-pipeline-status
scripts/ci/gitlab-pipeline-status new file +6 -0
new file mode 100755
index 0000000000..4a9de39872
@@ -0,0 +1,156 @@
+#!/usr/bin/env python3
+#
+# Copyright (c) 2019-2020 Red Hat, Inc.
+#
+# Author:
+#  Cleber Rosa <[email protected]>
Quoted 9 lines

scripts/ci/gitlab-pipeline-status line 12

Quoted 6 lines
scripts/ci/gitlab-pipeline-status new file +6 -0
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+"""
+Checks the GitLab pipeline status for a given commit commit

s/commit$/(hash|sha|ID|)

Just for the record, this was picked up by Thomas (thanks Thomas!).

Quoted 14 lines
Quoted 14 lines
scripts/ci/gitlab-pipeline-status new file +14 -0
+"""
+
+# pylint: disable=C0103
+
+import argparse
+import http.client
+import json
+import os
+import subprocess
+import time
+import sys
+
+
+def get_local_staging_branch_commit():
Quoted 9 lines

scripts/ci/gitlab-pipeline-status line 30

Quoted 4 lines
scripts/ci/gitlab-pipeline-status new file +4 -0
+    """
+    Returns the commit sha1 for the *local* branch named "staging"
+    """
+    result = subprocess.run(['git', 'rev-parse', 'staging'],

If one day Peter decides that "staging" is not a cool name anymore and use a different name for the branch :) we should account for that and make it a variable, possibly even parametrize this function with it.

This function is currently only called to set a default for the -c/--commit command line option, so users can always set it to the commit ID of any branch. But, your point still holds with regards to future extensibility. I'll send a patch with that change.

Quoted 11 lines

scripts/ci/gitlab-pipeline-status line 37

Quoted 7 lines
scripts/ci/gitlab-pipeline-status new file +7 -0
+                            stdin=subprocess.DEVNULL,
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.DEVNULL,
+                            cwd=os.path.dirname(__file__),
+                            universal_newlines=True).stdout.strip()
+    if result == 'staging':
+        raise ValueError("There's no local staging branch")

"There's no local branch named 'staging'" would IMO be more descriptive, so as not to confuse it with staging in git.

Ack, also picked up by Thomas.

Quoted 11 lines
Quoted 11 lines
scripts/ci/gitlab-pipeline-status new file +11 -0
+    if len(result) != 40:
+        raise ValueError("Branch staging HEAD doesn't look like a sha1")
+    return result
+
+
+def get_pipeline_status(project_id, commit_sha1):
+    """
+    Returns the JSON content of the pipeline status API response
+    """
+    url = '/api/v4/projects/{}/pipelines?sha={}'.format(project_id,
+                                                        commit_sha1)
Quoted 9 lines

scripts/ci/gitlab-pipeline-status line 54

Quoted 6 lines
scripts/ci/gitlab-pipeline-status new file +6 -0
+    connection = http.client.HTTPSConnection('gitlab.com')
+    connection.request('GET', url=url)
+    response = connection.getresponse()
+    if response.code != http.HTTPStatus.OK:
+        raise ValueError("Failed to receive a successful response")
+    json_response = json.loads(response.read())

a blank line separating the commentary block would slightly help readability

It would also be a good idea to follow PEP 257, but since there's currently no check/enforcement, I'll defer to one it's introduced (hopefully soon).

Quoted 4 lines

scripts/ci/gitlab-pipeline-status line 55

Quoted 1 line
scripts/ci/gitlab-pipeline-status new file +1 -0
+    # afaict, there should one one pipeline for the same project + commit

s/one one/be only one/

Ack, also picked up by Thomas (thanks again!).

Quoted 5 lines
Quoted 5 lines
scripts/ci/gitlab-pipeline-status new file +5 -0
+    # if this assumption is false, we can add further filters to the
+    # url, such as username, and order_by.
+    if not json_response:
+        raise ValueError("No pipeline found")
+    return json_response[0]
Quoted 9 lines

scripts/ci/gitlab-pipeline-status line 66

Quoted 6 lines
scripts/ci/gitlab-pipeline-status new file +6 -0
+
+
+def wait_on_pipeline_success(timeout, interval,
+                             project_id, commit_sha):
+    """
+    Waits for the pipeline to end up to the timeout given

"Waits for the pipeline to finish within the given timeout"

Absolutely better, and also picked up by Thomas.

Quoted 9 lines

scripts/ci/gitlab-pipeline-status line 71

Quoted 5 lines
scripts/ci/gitlab-pipeline-status new file +5 -0
+    """
+    start = time.time()
+    while True:
+        if time.time() >= (start + timeout):
+            print("Waiting on the pipeline success timed out")

s/success//
(the pipeline doesn't always have to finish with success)

You're right, your suggestion improves the message, indeed.

But, I think the wording is still confusing as it took me some time to understand that this timeout was about how long this script will wait. (my fault here). So I'm going to propose that this changes to:

"Timeout (-t/--timeout) of %i seconds reached, won't wait any longer for the pipeline to complete".

Quoted 6 lines
Quoted 6 lines
scripts/ci/gitlab-pipeline-status new file +6 -0
+            return False
+
+        status = get_pipeline_status(project_id, commit_sha)
+        if status['status'] == 'running':
+            time.sleep(interval)
+            print('running...')
Quoted 9 lines

scripts/ci/gitlab-pipeline-status line 83

Quoted 6 lines
scripts/ci/gitlab-pipeline-status new file +6 -0
+            continue
+
+        if status['status'] == 'success':
+            return True
+
+        msg = "Pipeline ended unsuccessfully, check: %s" % status['web_url']

I think more common expression is "Pipeline failed"

Agreed, and already addressed by Thomas (will I run out of thanks?).

Quoted 10 lines

scripts/ci/gitlab-pipeline-status line 86

Quoted 3 lines
scripts/ci/gitlab-pipeline-status new file +3 -0
+        print(msg)
+        return False
+

...

Code-wise looks OK to me, but since I don't know what Peter's requirements on/expectations of this script are, I can't do a more thorough review.

Regards,
Erik

Thanks Erik!

- Cleber.

Tested-by on v2 1/2
#7 lore raw

Re: [PATCH v2 1/2] GitLab Gating CI: introduce pipeline-status contrib script

In reply to Cleber Rosa
Quoted 7 lines · Cleber Rosa

This script is intended to be used right after a push to a branch.

By default, it will look for the pipeline associated with the commit that is the HEAD of the *local* staging branch. It can be used as a one time check, or with the --wait option to wait until the pipeline completes.

Quoted 8 lines

If the pipeline is successful, then a merge of the staging branch into the master branch should be the next step.

---
 scripts/ci/gitlab-pipeline-status | 156 ++++++++++++++++++++++++++++++
 1 file changed, 156 insertions(+)
 create mode 100755 scripts/ci/gitlab-pipeline-status

FWIW, I gave it a try and it works for me:

running...
running...
running...
running...
Pipeline ended unsuccessfully, check:
https://gitlab.com/huth/qemu/-/pipelines/164735644

(yes, that problem with the test that takes too long still persists, but that's another topic)

#8 lore raw

PATCH v2 2/2 GitLab Gating CI: initial set of jobs, documentation and scripts

In reply to Cleber Rosa

This is a mapping of Peter's "remake-merge-builds" and "pull-buildtest" scripts, gone through some updates, adding some build option and removing others.

The jobs currently cover the machines that the QEMU project owns, and that are setup and ready to run jobs:

- Ubuntu 18.04 on S390x
- Ubuntu 20.04 on aarch64

During the development of this set of jobs, the GitLab CI was tested with many other architectures, including ppc64, s390x and aarch64, along with the other OSs (not included here):

- Fedora 30
- FreeBSD 12.1

More information can be found in the documentation itself.

---
 .gitlab-ci.d/gating.yml                | 146 +++++++++++++++++
 .gitlab-ci.yml                         |   1 +
 docs/devel/testing.rst                 | 147 +++++++++++++++++
 scripts/ci/setup/build-environment.yml | 217 +++++++++++++++++++++++++
 scripts/ci/setup/gitlab-runner.yml     |  72 ++++++++
 scripts/ci/setup/inventory             |   2 +
 scripts/ci/setup/vars.yml              |  13 ++
 7 files changed, 598 insertions(+)
 create mode 100644 .gitlab-ci.d/gating.yml
 create mode 100644 scripts/ci/setup/build-environment.yml
 create mode 100644 scripts/ci/setup/gitlab-runner.yml
 create mode 100644 scripts/ci/setup/inventory
 create mode 100644 scripts/ci/setup/vars.yml
.gitlab-ci.d/gating.yml new file +146 -0
new file mode 100644
index 0000000000..5562df5708
@@ -0,0 +1,146 @@
+variables:
+  GIT_SUBMODULE_STRATEGY: recursive
+
+# All ubuntu-18.04 jobs should run successfully in an environment
+# setup by the scripts/ci/setup/build-environment.yml task
+# "Install basic packages to build QEMU on Ubuntu 18.04/20.04"
+ubuntu-18.04-s390x-all-linux-static:
+ tags:
+ - ubuntu_18.04
+ - s390x
+ rules:
+ - if: '$CI_COMMIT_REF_NAME == "staging"'
+ script:
+ # --disable-libssh is needed because of https://bugs.launchpad.net/qemu/+bug/1838763
+ # --disable-glusterfs is needed because there's no static version of those libs in distro supplied packages
+ - ./configure --enable-debug --static --disable-system --disable-glusterfs --disable-libssh
+ - make --output-sync -j`nproc`
+ - make --output-sync -j`nproc` check V=1
+ - make --output-sync -j`nproc` check-tcg V=1
+
+ubuntu-18.04-s390x-all:
+ tags:
+ - ubuntu_18.04
+ - s390x
+ rules:
+ - if: '$CI_COMMIT_REF_NAME == "staging"'
+ script:
+ - ./configure --disable-libssh
+ - make --output-sync -j`nproc`
+ - make --output-sync -j`nproc` check V=1
+
+ubuntu-18.04-s390x-alldbg:
+ tags:
+ - ubuntu_18.04
+ - s390x
+ rules:
+ - if: '$CI_COMMIT_REF_NAME == "staging"'
+ script:
+ - ./configure --enable-debug --disable-libssh
+ - make clean
+ - make --output-sync -j`nproc`
+ - make --output-sync -j`nproc` check V=1
+
+ubuntu-18.04-s390x-clang:
+ tags:
+ - ubuntu_18.04
+ - s390x
+ rules:
+ - if: '$CI_COMMIT_REF_NAME == "staging"'
+ script:
+ - ./configure --disable-libssh --cc=clang --cxx=clang++ --enable-sanitizers
+ - make --output-sync -j`nproc`
+ - make --output-sync -j`nproc` check V=1
+
+ubuntu-18.04-s390x-tci:
+ tags:
+ - ubuntu_18.04
+ - s390x
+ rules:
+ - if: '$CI_COMMIT_REF_NAME == "staging"'
+ script:
+ - ./configure --disable-libssh --enable-tcg-interpreter
+ - make --output-sync -j`nproc`
+
+ubuntu-18.04-s390x-notcg:
+ tags:
+ - ubuntu_18.04
+ - s390x
+ rules:
+ - if: '$CI_COMMIT_REF_NAME == "staging"'
+ script:
+ - ./configure --disable-libssh --disable-tcg
+ - make --output-sync -j`nproc`
+ - make --output-sync -j`nproc` check V=1
+
+# All ubuntu-20.04 jobs should run successfully in an environment
+# setup by the scripts/ci/setup/qemu/build-environment.yml task
+# "Install basic packages to build QEMU on Ubuntu 18.04/20.04"
+ubuntu-20.04-aarch64-all-linux-static:
+ tags:
+ - ubuntu_20.04
+ - aarch64
+ rules:
+ - if: '$CI_COMMIT_REF_NAME == "staging"'
+ script:
+ # --disable-libssh is needed because of https://bugs.launchpad.net/qemu/+bug/1838763
+ # --disable-glusterfs is needed because there's no static version of those libs in distro supplied packages
+ - ./configure --enable-debug --static --disable-system --disable-glusterfs --disable-libssh
+ - make --output-sync -j`nproc`
+ - make --output-sync -j`nproc` check V=1
+ - make --output-sync -j`nproc` check-tcg V=1
+
+ubuntu-20.04-aarch64-all:
+ tags:
+ - ubuntu_20.04
+ - aarch64
+ rules:
+ - if: '$CI_COMMIT_REF_NAME == "staging"'
+ script:
+ - ./configure --disable-libssh
+ - make --output-sync -j`nproc`
+ - make --output-sync -j`nproc` check V=1
+
+ubuntu-20.04-aarch64-alldbg:
+ tags:
+ - ubuntu_20.04
+ - aarch64
+ rules:
+ - if: '$CI_COMMIT_REF_NAME == "staging"'
+ script:
+ - ./configure --enable-debug --disable-libssh
+ - make clean
+ - make --output-sync -j`nproc`
+ - make --output-sync -j`nproc` check V=1
+
+ubuntu-20.04-aarch64-clang:
+ tags:
+ - ubuntu_20.04
+ - aarch64
+ rules:
+ - if: '$CI_COMMIT_REF_NAME == "staging"'
+ script:
+ - ./configure --disable-libssh --cc=clang --cxx=clang++ --enable-sanitizers
+ - make --output-sync -j`nproc`
+ - make --output-sync -j`nproc` check V=1
+
+ubuntu-20.04-aarch64-tci:
+ tags:
+ - ubuntu_20.04
+ - aarch64
+ rules:
+ - if: '$CI_COMMIT_REF_NAME == "staging"'
+ script:
+ - ./configure --disable-libssh --enable-tcg-interpreter
+ - make --output-sync -j`nproc`
+
+ubuntu-20.04-aarch64-notcg:
+ tags:
+ - ubuntu_20.04
+ - aarch64
+ rules:
+ - if: '$CI_COMMIT_REF_NAME == "staging"'
+ script:
+ - ./configure --disable-libssh --disable-tcg
+ - make --output-sync -j`nproc`
+ - make --output-sync -j`nproc` check V=1
.gitlab-ci.yml +1 -0
index 349c77aa58..49efe38529 100644
@@ -1,6 +1,7 @@
 include:
   - local: '/.gitlab-ci.d/edk2.yml'
   - local: '/.gitlab-ci.d/opensbi.yml'
+  - local: '/.gitlab-ci.d/gating.yml'
 
 .update_apt_template: &before_script_apt
  before_script:
docs/devel/testing.rst +147 -0

150 lines not on this page · raw message

scripts/ci/setup/build-environment.yml new file +217 -0

217 lines not on this page · raw message

scripts/ci/setup/gitlab-runner.yml new file +72 -0

72 lines not on this page · raw message

scripts/ci/setup/inventory new file +2 -0
new file mode 100644
index 0000000000..8bb7ba6b33
@@ -0,0 +1,2 @@
+[local]
+localhost
scripts/ci/setup/vars.yml new file +13 -0
new file mode 100644
index 0000000000..621435d030
@@ -0,0 +1,13 @@
+# The version of the gitlab-runner to use
+gitlab_runner_version: 13.1.1
+# The base location of gitlab-runner binaries, this will be suffixed by $OS-$ARCH
+gitlab_runner_base_url: https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-
+# The URL of the gitlab server to use, usually https://gitlab.com unless you're
+# using a private GitLab instance
+gitlab_runner_server_url: https://gitlab.com
+# Defaults to linux, checks can be used to change this
+gitlab_runner_os: linux
+# Defaults to amd64 (x86_64), checks can be used to change this
+gitlab_runner_arch: amd64
+# A unique token made available by GitLab to your project for registering runners
+gitlab_runner_registration_token: PLEASE_PROVIDE_A_VALID_TOKEN
Signature · 1 line
2.25.4
#9 lore raw

Re: [PATCH v2 2/2] GitLab Gating CI: initial set of jobs, documentation and scripts

Quoted 50 lines · Cleber Rosa

This is a mapping of Peter's "remake-merge-builds" and "pull-buildtest" scripts, gone through some updates, adding some build option and removing others.

The jobs currently cover the machines that the QEMU project owns, and that are setup and ready to run jobs:

- Ubuntu 18.04 on S390x
- Ubuntu 20.04 on aarch64

During the development of this set of jobs, the GitLab CI was tested with many other architectures, including ppc64, s390x and aarch64, along with the other OSs (not included here):

- Fedora 30
- FreeBSD 12.1

More information can be found in the documentation itself.

---
 .gitlab-ci.d/gating.yml                | 146 +++++++++++++++++
 .gitlab-ci.yml                         |   1 +
 docs/devel/testing.rst                 | 147 +++++++++++++++++
 scripts/ci/setup/build-environment.yml | 217 +++++++++++++++++++++++++
 scripts/ci/setup/gitlab-runner.yml     |  72 ++++++++
 scripts/ci/setup/inventory             |   2 +
 scripts/ci/setup/vars.yml              |  13 ++
 7 files changed, 598 insertions(+)
 create mode 100644 .gitlab-ci.d/gating.yml
 create mode 100644 scripts/ci/setup/build-environment.yml
 create mode 100644 scripts/ci/setup/gitlab-runner.yml
 create mode 100644 scripts/ci/setup/inventory
 create mode 100644 scripts/ci/setup/vars.yml
.gitlab-ci.d/gating.yml new file +9 -0
new file mode 100644
index 0000000000..5562df5708
@@ -0,0 +1,146 @@
+variables:
+  GIT_SUBMODULE_STRATEGY: recursive
+
+# All ubuntu-18.04 jobs should run successfully in an environment
+# setup by the scripts/ci/setup/build-environment.yml task
+# "Install basic packages to build QEMU on Ubuntu 18.04/20.04"
+ubuntu-18.04-s390x-all-linux-static:
+ tags:
+ - ubuntu_18.04

.gitlab-ci.d/gating.yml line 19

Quoted 10 lines
.gitlab-ci.d/gating.yml new file +10 -0
+ - s390x
+ rules:
+ - if: '$CI_COMMIT_REF_NAME == "staging"'
+ script:
+ # --disable-libssh is needed because of https://bugs.launchpad.net/qemu/+bug/1838763
+ # --disable-glusterfs is needed because there's no static version of those libs in distro supplied packages
+ - ./configure --enable-debug --static --disable-system --disable-glusterfs --disable-libssh
+ - make --output-sync -j`nproc`
+ - make --output-sync -j`nproc` check V=1
+ - make --output-sync -j`nproc` check-tcg V=1

I know this patch doesn't introduce a FreeBSD job, but later in the patch it's clear you'd want to introduce them at some point, so:
'nproc' doesn't exist on FreeBSD, but getconf _NPROCESSORS_ONLN does, so you may want to use it right from the start.

...

.gitlab-ci.d/gating.yml line 25

Quoted 6 lines
.gitlab-ci.d/gating.yml new file +6 -0
+
+CI
+==
+
+QEMU has configurations enabled for a number of different CI services.
+The most update information about them and their status can be found

s/update/up to date/

.gitlab-ci.d/gating.yml line 33

Quoted 8 lines
.gitlab-ci.d/gating.yml new file +8 -0
+at::
+
+   https://wiki.qemu.org/Testing/CI
+
+Gating CI
+----------
+
+A Pull Requests will only to be merged if they successfully go through

s/A /
s/to be/be/

.gitlab-ci.d/gating.yml line 34

Quoted 1 line
.gitlab-ci.d/gating.yml new file +1 -0
+a different set of CI jobs.  GitLab's CI is the service/framework used

s/a different set/different sets/ (I may be wrong with this one)

...

Quoted 24 lines
.gitlab-ci.d/gating.yml new file +24 -0
+
+gitlab-runner setup and registration
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The gitlab-runner agent needs to be installed on each machine that
+will run jobs.  The association between a machine and a GitLab project
+happens with a registration token.  To find the registration token for
+your repository/project, navigate on GitLab's web UI to:
+
+ * Settings (the gears like icon), then
+ * CI/CD, then
+ * Runners, and click on the "Expand" button, then
+ * Under "Set up a specific Runner manually", look for the value under
+   "Use the following registration token during setup"
+
+Edit the ``scripts/ci/setup/vars.yml`` file, setting the
+``gitlab_runner_registration_token`` variable to the value obtained
+earlier.
+
+.. note:: gitlab-runner is not available from the standard location
+          for all OS and architectures combinations.  For some systems,
+          a custom build may be necessary.  Some builds are avaiable
+          at https://cleber.fedorapeople.org/gitlab-runner/ and this
+          URI may be used as a value on ``vars.yml``

.gitlab-ci.d/gating.yml line 68

Quoted 10 lines
.gitlab-ci.d/gating.yml new file +10 -0
+
+To run the playbook, execute::
+
+  cd scripts/ci/setup
+  ansible-playbook -i inventory gitlab-runner.yml
+
+.. note:: there are currently limitations to gitlab-runner itself when
+          setting up a service under FreeBSD systems.  You will need to
+          perform steps 4 to 10 manually, as described at
+          https://docs.gitlab.com/runner/install/freebsd.html

What kinds of limitations? Is it architecture constrained maybe? I'm asking because we have all of the steps covered by an Ansible playbook, so I kinda got triggered by the word "manually". Also, the document only mentions 9 steps overall.

Regards,
Erik

#10 lore raw

Re: [PATCH v2 2/2] GitLab Gating CI: initial set of jobs, documentation and scripts

Quoted 67 lines · Erik Skultety
Quoted 50 lines · Cleber Rosa

This is a mapping of Peter's "remake-merge-builds" and "pull-buildtest" scripts, gone through some updates, adding some build option and removing others.

The jobs currently cover the machines that the QEMU project owns, and that are setup and ready to run jobs:

- Ubuntu 18.04 on S390x
- Ubuntu 20.04 on aarch64

During the development of this set of jobs, the GitLab CI was tested with many other architectures, including ppc64, s390x and aarch64, along with the other OSs (not included here):

- Fedora 30
- FreeBSD 12.1

More information can be found in the documentation itself.

---
 .gitlab-ci.d/gating.yml                | 146 +++++++++++++++++
 .gitlab-ci.yml                         |   1 +
 docs/devel/testing.rst                 | 147 +++++++++++++++++
 scripts/ci/setup/build-environment.yml | 217 +++++++++++++++++++++++++
 scripts/ci/setup/gitlab-runner.yml     |  72 ++++++++
 scripts/ci/setup/inventory             |   2 +
 scripts/ci/setup/vars.yml              |  13 ++
 7 files changed, 598 insertions(+)
 create mode 100644 .gitlab-ci.d/gating.yml
 create mode 100644 scripts/ci/setup/build-environment.yml
 create mode 100644 scripts/ci/setup/gitlab-runner.yml
 create mode 100644 scripts/ci/setup/inventory
 create mode 100644 scripts/ci/setup/vars.yml
.gitlab-ci.d/gating.yml new file +9 -0
new file mode 100644
index 0000000000..5562df5708
@@ -0,0 +1,146 @@
+variables:
+  GIT_SUBMODULE_STRATEGY: recursive
+
+# All ubuntu-18.04 jobs should run successfully in an environment
+# setup by the scripts/ci/setup/build-environment.yml task
+# "Install basic packages to build QEMU on Ubuntu 18.04/20.04"
+ubuntu-18.04-s390x-all-linux-static:
+ tags:
+ - ubuntu_18.04

.gitlab-ci.d/gating.yml line 19

Quoted 10 lines
.gitlab-ci.d/gating.yml new file +10 -0
+ - s390x
+ rules:
+ - if: '$CI_COMMIT_REF_NAME == "staging"'
+ script:
+ # --disable-libssh is needed because of https://bugs.launchpad.net/qemu/+bug/1838763
+ # --disable-glusterfs is needed because there's no static version of those libs in distro supplied packages
+ - ./configure --enable-debug --static --disable-system --disable-glusterfs --disable-libssh
+ - make --output-sync -j`nproc`
+ - make --output-sync -j`nproc` check V=1
+ - make --output-sync -j`nproc` check-tcg V=1

I know this patch doesn't introduce a FreeBSD job, but later in the patch it's clear you'd want to introduce them at some point, so:
'nproc' doesn't exist on FreeBSD, but getconf _NPROCESSORS_ONLN does, so you may want to use it right from the start.

Quoted 2 lines

...

Sure, thanks for the info.

Quoted 9 lines

.gitlab-ci.d/gating.yml

Quoted 6 lines
.gitlab-ci.d/gating.yml new file +6 -0
+
+CI
+==
+
+QEMU has configurations enabled for a number of different CI services.
+The most update information about them and their status can be found

s/update/up to date/

Good catch!

Quoted 12 lines

.gitlab-ci.d/gating.yml

Quoted 8 lines
.gitlab-ci.d/gating.yml new file +8 -0
+at::
+
+   https://wiki.qemu.org/Testing/CI
+
+Gating CI
+----------
+
+A Pull Requests will only to be merged if they successfully go through

s/A /
s/to be/be/

Quoted 5 lines
Quoted 1 line

+a different set of CI jobs. GitLab's CI is the service/framework used

s/a different set/different sets/ (I may be wrong with this one)

...

I think you're right. But, to keep it simpler, I'm using:

"Pull Requests will only be merged if they successfully go through different CI jobs."

Quoted 32 lines
Quoted 32 lines
.gitlab-ci.d/gating.yml new file +31 -0
+
+gitlab-runner setup and registration
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The gitlab-runner agent needs to be installed on each machine that
+will run jobs.  The association between a machine and a GitLab project
+happens with a registration token.  To find the registration token for
+your repository/project, navigate on GitLab's web UI to:
+
+ * Settings (the gears like icon), then
+ * CI/CD, then
+ * Runners, and click on the "Expand" button, then
+ * Under "Set up a specific Runner manually", look for the value under
+   "Use the following registration token during setup"
+
+Edit the ``scripts/ci/setup/vars.yml`` file, setting the
+``gitlab_runner_registration_token`` variable to the value obtained
+earlier.
+
+.. note:: gitlab-runner is not available from the standard location
+          for all OS and architectures combinations.  For some systems,
+          a custom build may be necessary.  Some builds are avaiable
+          at https://cleber.fedorapeople.org/gitlab-runner/ and this
+          URI may be used as a value on ``vars.yml``
+
+To run the playbook, execute::
+
+  cd scripts/ci/setup
+  ansible-playbook -i inventory gitlab-runner.yml
+
+.. note:: there are currently limitations to gitlab-runner itself when
Quoted 9 lines

.gitlab-ci.d/gating.yml

Quoted 3 lines
.gitlab-ci.d/gating.yml new file +3 -0
+          setting up a service under FreeBSD systems.  You will need to
+          perform steps 4 to 10 manually, as described at
+          https://docs.gitlab.com/runner/install/freebsd.html

What kinds of limitations? Is it architecture constrained maybe? I'm asking because we have all of the steps covered by an Ansible playbook, so I kinda got triggered by the word "manually". Also, the document only mentions 9 steps overall.

FreeBSD's "service management" (systemd/sys-v like) is not covered by the GO library[1] used on gitlab-runner. It's not ideal, and the second best solution would be to script the equivalent handling within the playbook, but I remember trying and finding some inconsistencies. Then, I had to give it up and defer to whenever a FreeBSD job is actually added.

Quoted 2 lines

Regards,
Erik

[1] - https://github.com/ayufan/golang-kardianos-service

Thanks for the review, I'll be sending a v3 shortly.
- Cleber.

#11 lore raw

Re: [PATCH v2 2/2] GitLab Gating CI: initial set of jobs, documentation and scripts

Quoted 12 lines · Cleber Rosa
Quoted 10 lines · Erik Skultety

docs/devel/testing.rst exercise as many corner cases as possible. It is a useful test suite · line 1125

Quoted 4 lines · Cleber Rosa

+.. note:: there are currently limitations to gitlab-runner itself when

docs/devel/testing.rst +3 -0
+          setting up a service under FreeBSD systems.  You will need to
+          perform steps 4 to 10 manually, as described at
+          https://docs.gitlab.com/runner/install/freebsd.html

What kinds of limitations? Is it architecture constrained maybe? I'm asking because we have all of the steps covered by an Ansible playbook, so I kinda got triggered by the word "manually". Also, the document only mentions 9 steps overall.

Quoted 8 lines

FreeBSD's "service management" (systemd/sys-v like) is not covered by the GO library[1] used on gitlab-runner. It's not ideal, and the second best solution would be to script the equivalent handling within the playbook, but I remember trying and finding some inconsistencies. Then, I had to give it up and defer to whenever a FreeBSD job is actually added.

[1] - https://github.com/ayufan/golang-kardianos-service

Note that this is a fork of

https://github.com/kardianos/service

where FreeBSD support was added recently with

https://github.com/kardianos/service/commit/14b2cc59a290407a6f1cb3daba59069429d9665b

I'm not sure why gitlab-runner would use a fork rather than the primary repository, but perhaps they can be convinced to switch and gain better FreeBSD support in the process.

Signature · 1 line
Andrea Bolognani / Red Hat / Virtualization
#12 lore raw

Re: [PATCH v2 2/2] GitLab Gating CI: initial set of jobs, documentation and scripts

Quoted 22 lines · Andrea Bolognani
Quoted 12 lines · Cleber Rosa
Quoted 10 lines · Erik Skultety

docs/devel/testing.rst exercise as many corner cases as possible. It is a useful test suite · line 1125

Quoted 4 lines · Cleber Rosa

+.. note:: there are currently limitations to gitlab-runner itself when

docs/devel/testing.rst +3 -0
+          setting up a service under FreeBSD systems.  You will need to
+          perform steps 4 to 10 manually, as described at
+          https://docs.gitlab.com/runner/install/freebsd.html

What kinds of limitations? Is it architecture constrained maybe? I'm asking because we have all of the steps covered by an Ansible playbook, so I kinda got triggered by the word "manually". Also, the document only mentions 9 steps overall.

Quoted 8 lines

FreeBSD's "service management" (systemd/sys-v like) is not covered by the GO library[1] used on gitlab-runner. It's not ideal, and the second best solution would be to script the equivalent handling within the playbook, but I remember trying and finding some inconsistencies. Then, I had to give it up and defer to whenever a FreeBSD job is actually added.

[1] - https://github.com/ayufan/golang-kardianos-service

Quoted 8 lines

Note that this is a fork of

https://github.com/kardianos/service

where FreeBSD support was added recently with

https://github.com/kardianos/service/commit/14b2cc59a290407a6f1cb3daba59069429d9665b

That's good news!

Quoted 4 lines

I'm not sure why gitlab-runner would use a fork rather than the primary repository, but perhaps they can be convinced to switch and gain better FreeBSD support in the process.

I can only imagine they were using the fork because the primary repository did not have the bits they needed there... and were not willing or were not successful and getting them there.

We can ask/hope/wait for gitlab to switch, and then this will no longer be an issue indeed.

Thanks,
- Cleber.

Quoted 3 lines
Signature · 1 line
Andrea Bolognani / Red Hat / Virtualization
#13 lore raw

Re: [PATCH v2 2/2] GitLab Gating CI: initial set of jobs, documentation and scripts

In reply to Cleber Rosa
Quoted 17 lines · Cleber Rosa

This is a mapping of Peter's "remake-merge-builds" and "pull-buildtest" scripts, gone through some updates, adding some build option and removing others.

The jobs currently cover the machines that the QEMU project owns, and that are setup and ready to run jobs:

- Ubuntu 18.04 on S390x
- Ubuntu 20.04 on aarch64

During the development of this set of jobs, the GitLab CI was tested with many other architectures, including ppc64, s390x and aarch64, along with the other OSs (not included here):

- Fedora 30
- FreeBSD 12.1

Quoted 7 lines

More information can be found in the documentation itself.

---
 .gitlab-ci.d/gating.yml                | 146 +++++++++++++++++
 .gitlab-ci.yml                         |   1 +
 docs/devel/testing.rst                 | 147 +++++++++++++++++

Time to consider moving the CI doc in a separate file...

Quoted 4 lines
 scripts/ci/setup/build-environment.yml | 217 +++++++++++++++++++++++++
 scripts/ci/setup/gitlab-runner.yml     |  72 ++++++++
 scripts/ci/setup/inventory             |   2 +
 scripts/ci/setup/vars.yml              |  13 ++

Should we name these last two as inventory.template and vars.yml.template?

Maybe you can add them with gitlab-runner.yml and a part of the documentation in a first patch,

Then build-environment.yml and another part of the doc in another patch,

Finally gating.yml and the related missing doc as the last patch?

Quoted 6 lines
 7 files changed, 598 insertions(+)
 create mode 100644 .gitlab-ci.d/gating.yml
 create mode 100644 scripts/ci/setup/build-environment.yml
 create mode 100644 scripts/ci/setup/gitlab-runner.yml
 create mode 100644 scripts/ci/setup/inventory
 create mode 100644 scripts/ci/setup/vars.yml

[...]

#14 lore raw

Re: [PATCH v2 2/2] GitLab Gating CI: initial set of jobs, documentation and scripts

Quoted 28 lines · Philippe Mathieu-Daudé
Quoted 17 lines · Cleber Rosa

This is a mapping of Peter's "remake-merge-builds" and "pull-buildtest" scripts, gone through some updates, adding some build option and removing others.

The jobs currently cover the machines that the QEMU project owns, and that are setup and ready to run jobs:

- Ubuntu 18.04 on S390x
- Ubuntu 20.04 on aarch64

During the development of this set of jobs, the GitLab CI was tested with many other architectures, including ppc64, s390x and aarch64, along with the other OSs (not included here):

- Fedora 30
- FreeBSD 12.1

Quoted 7 lines

More information can be found in the documentation itself.

---
 .gitlab-ci.d/gating.yml                | 146 +++++++++++++++++
 .gitlab-ci.yml                         |   1 +
 docs/devel/testing.rst                 | 147 +++++++++++++++++

Time to consider moving the CI doc in a separate file...

Quoted 8 lines
Quoted 4 lines
 scripts/ci/setup/build-environment.yml | 217 +++++++++++++++++++++++++
 scripts/ci/setup/gitlab-runner.yml     |  72 ++++++++
 scripts/ci/setup/inventory             |   2 +
 scripts/ci/setup/vars.yml              |  13 ++

Should we name these last two as inventory.template and vars.yml.template?

I get your point, and actually like your suggestion but I've not seen this done on any Ansible based projects I've come across. The inventory file, for instance, is tends to be this "localhost" version pretty much everywhere. The same goes for vars.yml, so I'm inclined to leave them as is... but if you have strong feelings against it, I won't fuss nor fight.

Quoted 9 lines

Maybe you can add them with gitlab-runner.yml and a part of the documentation in a first patch,

Then build-environment.yml and another part of the doc in another patch,

Finally gating.yml and the related missing doc as the last patch?

Sounds good. This is indeed a very large patch as it is.

Thanks!
- Cleber.

#15 lore raw

Re: [PATCH v2 2/2] GitLab Gating CI: initial set of jobs, documentation and scripts

In reply to Cleber Rosa
Quoted 14 lines · Cleber Rosa

This is a mapping of Peter's "remake-merge-builds" and "pull-buildtest" scripts, gone through some updates, adding some build option and removing others.

The jobs currently cover the machines that the QEMU project owns, and that are setup and ready to run jobs:

- Ubuntu 18.04 on S390x
- Ubuntu 20.04 on aarch64

During the development of this set of jobs, the GitLab CI was tested with many other architectures, including ppc64, s390x and aarch64, along with the other OSs (not included here):

Quoted 8 lines

- Fedora 30
- FreeBSD 12.1

More information can be found in the documentation itself.

---
 .gitlab-ci.d/gating.yml                | 146 +++++++++++++++++

AFAIK, the jobs in this file just augment what is already defined in the main .gitlab-ci.yml. Also since we're providing setup info for other people to configure custom runners, these jobs are usable for non-gating CI scenarios too.

IOW, the jobs in this file happen to be usable for gating, but they are not the only gating jobs, and can be used for non-gating reasons.

This is a complicated way of saying that gating.yml is not a desirable filename, so I'd suggest splitting it in two and having these files named based on what their contents is, rather than their use case:

.gitlab-ci.d/runners-s390x.yml
.gitlab-ci.d/runners-aarch64.yml

The existing jobs in .gitlab-ci.yml could possibly be moved into a .gitlab-ci.d/runners-shared.yml file for consistency.

Quoted 21 lines
 .gitlab-ci.yml                         |   1 +
 docs/devel/testing.rst                 | 147 +++++++++++++++++
 scripts/ci/setup/build-environment.yml | 217 +++++++++++++++++++++++++
 scripts/ci/setup/gitlab-runner.yml     |  72 ++++++++
 scripts/ci/setup/inventory             |   2 +
 scripts/ci/setup/vars.yml              |  13 ++
 7 files changed, 598 insertions(+)
 create mode 100644 .gitlab-ci.d/gating.yml
 create mode 100644 scripts/ci/setup/build-environment.yml
 create mode 100644 scripts/ci/setup/gitlab-runner.yml
 create mode 100644 scripts/ci/setup/inventory
 create mode 100644 scripts/ci/setup/vars.yml
.gitlab-ci.d/gating.yml new file +2 -0
new file mode 100644
index 0000000000..5562df5708
@@ -0,0 +1,146 @@
+variables:
+  GIT_SUBMODULE_STRATEGY: recursive

.gitlab-ci.d/gating.yml line 12

Quoted 10 lines
.gitlab-ci.d/gating.yml new file +10 -0
+
+# All ubuntu-18.04 jobs should run successfully in an environment
+# setup by the scripts/ci/setup/build-environment.yml task
+# "Install basic packages to build QEMU on Ubuntu 18.04/20.04"
+ubuntu-18.04-s390x-all-linux-static:
+ tags:
+ - ubuntu_18.04
+ - s390x
+ rules:
+ - if: '$CI_COMMIT_REF_NAME == "staging"'

I think I'd make it more flexible in particular to allow multiple branches. For example I have multiple subsystems and have separate branches for each.

This could be as simple as allowing a regex prefix

- if: '$CI_COMMIT_REF_NAME =~ /^staging/'

Quoted 6 lines
scripts/ci/setup/build-environment.yml new file +0 -0
new file mode 100644
index 0000000000..89b35386c7

scripts/ci/setup/build-environment.yml line 10

Quoted 10 lines
scripts/ci/setup/build-environment.yml new file +10 -0
@@ -0,0 +1,217 @@
+---
+- name: Installation of basic packages to build QEMU
+  hosts: all
+  vars_files:
+    - vars.yml
+  tasks:
+    - name: Install basic packages to build QEMU on Ubuntu 18.04/20.04
+      apt:
+        update_cache: yes
+        # This matches the packages on tests/docker/Dockerfiles/ubuntu1804.docker

I'd be inclined to actually use docker on the custom runners.

eg. instead of having separate physical machines or VMs for each (distro, arch) pair, have a single host distro for the arch. Then use docker to provide the build environment against each distro.

IOW, a RHEL-8 aarch64 host, running docker for ubuntu18.04, fedora30 etc.

That way we don't end up duplicating all these packages, and instead can use tests/docker/Dockerfiles/ubuntu1804.docker. This ensures that if a user needs to reproduce a build failure on their own local aarch64 machine, they can run docker and get the exact same build architecture.

It also has the benefit that we don't need to worry about how to setup gitlab runners for every distro we care about. We only need to do gitlab runner for the standard host distro, which spawns a pristine throwaway docker env.

I appreciate this is a big change from what you've done in this patch though, so don't consider this comment a blocker for initial merge. I think we should do this as the long term strategy though. Essentially for Linux builds, everything should always be container based.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#16 lore raw

Re: [PATCH v2 2/2] GitLab Gating CI: initial set of jobs, documentation and scripts

Quoted 31 lines · Daniel P. Berrangé

scripts/ci/setup/build-environment.yml line 10

Quoted 9 lines · Cleber Rosa

+- name: Installation of basic packages to build QEMU

scripts/ci/setup/build-environment.yml new file +8 -0
+  hosts: all
+  vars_files:
+    - vars.yml
+  tasks:
+    - name: Install basic packages to build QEMU on Ubuntu 18.04/20.04
+      apt:
+        update_cache: yes
+        # This matches the packages on tests/docker/Dockerfiles/ubuntu1804.docker

I'd be inclined to actually use docker on the custom runners.

eg. instead of having separate physical machines or VMs for each (distro, arch) pair, have a single host distro for the arch. Then use docker to provide the build environment against each distro.

IOW, a RHEL-8 aarch64 host, running docker for ubuntu18.04, fedora30 etc.

That way we don't end up duplicating all these packages, and instead can use tests/docker/Dockerfiles/ubuntu1804.docker. This ensures that if a user needs to reproduce a build failure on their own local aarch64 machine, they can run docker and get the exact same build architecture.

It also has the benefit that we don't need to worry about how to setup gitlab runners for every distro we care about. We only need to do gitlab runner for the standard host distro, which spawns a pristine throwaway docker env.

Quoted 4 lines

I appreciate this is a big change from what you've done in this patch though, so don't consider this comment a blocker for initial merge. I think we should do this as the long term strategy though. Essentially for Linux builds, everything should always be container based.

Agreed. You should be able to set up a fairly minimal environment, which consists of Docker, gitlab-runner and not much else, using a long-term supported distro such as CentOS and then just schedule whatever container build on it. No need to provision a new machine every time a new Fedora release comes out, just create a container image for it and add it to the mix.

Additionally, the gitlab-runner Docker executor provides more isolation than the shell executor, so running untrusted builds becomes a more reasonable proposition - this is how the shared runners on gitlab.com work - and you don't have to worry about your jobs cleaning up properly after themselves nearly as much.

Signature · 1 line
Andrea Bolognani / Red Hat / Virtualization
#17 lore raw

Re: [PATCH v2 2/2] GitLab Gating CI: initial set of jobs, documentation and scripts

Quoted 37 lines · Andrea Bolognani
Quoted 31 lines · Daniel P. Berrangé

scripts/ci/setup/build-environment.yml line 10

Quoted 9 lines · Cleber Rosa

+- name: Installation of basic packages to build QEMU

scripts/ci/setup/build-environment.yml new file +8 -0
+  hosts: all
+  vars_files:
+    - vars.yml
+  tasks:
+    - name: Install basic packages to build QEMU on Ubuntu 18.04/20.04
+      apt:
+        update_cache: yes
+        # This matches the packages on tests/docker/Dockerfiles/ubuntu1804.docker

I'd be inclined to actually use docker on the custom runners.

eg. instead of having separate physical machines or VMs for each (distro, arch) pair, have a single host distro for the arch. Then use docker to provide the build environment against each distro.

IOW, a RHEL-8 aarch64 host, running docker for ubuntu18.04, fedora30 etc.

That way we don't end up duplicating all these packages, and instead can use tests/docker/Dockerfiles/ubuntu1804.docker. This ensures that if a user needs to reproduce a build failure on their own local aarch64 machine, they can run docker and get the exact same build architecture.

It also has the benefit that we don't need to worry about how to setup gitlab runners for every distro we care about. We only need to do gitlab runner for the standard host distro, which spawns a pristine throwaway docker env.

Quoted 4 lines

I appreciate this is a big change from what you've done in this patch though, so don't consider this comment a blocker for initial merge. I think we should do this as the long term strategy though. Essentially for Linux builds, everything should always be container based.

Quoted 7 lines

Agreed. You should be able to set up a fairly minimal environment, which consists of Docker, gitlab-runner and not much else, using a long-term supported distro such as CentOS and then just schedule whatever container build on it. No need to provision a new machine every time a new Fedora release comes out, just create a container image for it and add it to the mix.

Hi Andrea,

There's nothing preventing this from happening, but limiting the runners to this configuration, prevents a lot more from happening.

Quoted 6 lines

Additionally, the gitlab-runner Docker executor provides more isolation than the shell executor, so running untrusted builds becomes a more reasonable proposition - this is how the shared runners on gitlab.com work - and you don't have to worry about your jobs cleaning up properly after themselves nearly as much.

I understand and agree to the the benefits of using the gitlab-runner Docker executor... until you want to run tests on non-Docker environments :).

Hopefully the explanation on my previous reply to Daniel will also serve for the points you raised here. I would have loved to have worked on a more abstract, container only environments, but that proved to be unrealistic.

Cheers,
- Cleber.

Quoted 3 lines
Signature · 1 line
Andrea Bolognani / Red Hat / Virtualization
#18 lore raw

Re: [PATCH v2 2/2] GitLab Gating CI: initial set of jobs, documentation and scripts

Quoted 58 lines · Cleber Rosa
Quoted 37 lines · Andrea Bolognani
Quoted 31 lines · Daniel P. Berrangé

scripts/ci/setup/build-environment.yml line 10

Quoted 9 lines · Cleber Rosa

+- name: Installation of basic packages to build QEMU

scripts/ci/setup/build-environment.yml new file +8 -0
+  hosts: all
+  vars_files:
+    - vars.yml
+  tasks:
+    - name: Install basic packages to build QEMU on Ubuntu 18.04/20.04
+      apt:
+        update_cache: yes
+        # This matches the packages on tests/docker/Dockerfiles/ubuntu1804.docker

I'd be inclined to actually use docker on the custom runners.

eg. instead of having separate physical machines or VMs for each (distro, arch) pair, have a single host distro for the arch. Then use docker to provide the build environment against each distro.

IOW, a RHEL-8 aarch64 host, running docker for ubuntu18.04, fedora30 etc.

That way we don't end up duplicating all these packages, and instead can use tests/docker/Dockerfiles/ubuntu1804.docker. This ensures that if a user needs to reproduce a build failure on their own local aarch64 machine, they can run docker and get the exact same build architecture.

It also has the benefit that we don't need to worry about how to setup gitlab runners for every distro we care about. We only need to do gitlab runner for the standard host distro, which spawns a pristine throwaway docker env.

Quoted 4 lines

I appreciate this is a big change from what you've done in this patch though, so don't consider this comment a blocker for initial merge. I think we should do this as the long term strategy though. Essentially for Linux builds, everything should always be container based.

Quoted 7 lines

Agreed. You should be able to set up a fairly minimal environment, which consists of Docker, gitlab-runner and not much else, using a long-term supported distro such as CentOS and then just schedule whatever container build on it. No need to provision a new machine every time a new Fedora release comes out, just create a container image for it and add it to the mix.

Hi Andrea,

There's nothing preventing this from happening, but limiting the runners to this configuration, prevents a lot more from happening.

Quoted 6 lines

Additionally, the gitlab-runner Docker executor provides more isolation than the shell executor, so running untrusted builds becomes a more reasonable proposition - this is how the shared runners on gitlab.com work - and you don't have to worry about your jobs cleaning up properly after themselves nearly as much.

Quoted 8 lines

I understand and agree to the the benefits of using the gitlab-runner Docker executor... until you want to run tests on non-Docker environments :).

Hopefully the explanation on my previous reply to Daniel will also serve for the points you raised here. I would have loved to have worked on a more abstract, container only environments, but that proved to be unrealistic.

For Linux targets, it should be possible to have exclusively container based testing environments. At worst you can run a privileged container and expose arbitrary host resources to it, so you can do anything in the container that you would otherwise do in bare metal. For non-Linux, we should be able to satisfy our needs with VMs, and indeed VMs can be used for Linux too if we want to emulate some specific hardware for testing that we don't have accessible to containers on bare metal. IOW, the testing environment can be entirely defined by the recipes we have in tests/docker and tests/vm. Bare metal hosts are simply a way to host the containers or vms.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#19 lore raw

Re: [PATCH v2 2/2] GitLab Gating CI: initial set of jobs, documentation and scripts

Quoted 68 lines · Daniel P. Berrangé
Quoted 58 lines · Cleber Rosa
Quoted 37 lines · Andrea Bolognani
Quoted 31 lines · Daniel P. Berrangé

scripts/ci/setup/build-environment.yml line 10

Quoted 9 lines · Cleber Rosa

+- name: Installation of basic packages to build QEMU

scripts/ci/setup/build-environment.yml new file +8 -0
+  hosts: all
+  vars_files:
+    - vars.yml
+  tasks:
+    - name: Install basic packages to build QEMU on Ubuntu 18.04/20.04
+      apt:
+        update_cache: yes
+        # This matches the packages on tests/docker/Dockerfiles/ubuntu1804.docker

I'd be inclined to actually use docker on the custom runners.

eg. instead of having separate physical machines or VMs for each (distro, arch) pair, have a single host distro for the arch. Then use docker to provide the build environment against each distro.

IOW, a RHEL-8 aarch64 host, running docker for ubuntu18.04, fedora30 etc.

That way we don't end up duplicating all these packages, and instead can use tests/docker/Dockerfiles/ubuntu1804.docker. This ensures that if a user needs to reproduce a build failure on their own local aarch64 machine, they can run docker and get the exact same build architecture.

It also has the benefit that we don't need to worry about how to setup gitlab runners for every distro we care about. We only need to do gitlab runner for the standard host distro, which spawns a pristine throwaway docker env.

Quoted 4 lines

I appreciate this is a big change from what you've done in this patch though, so don't consider this comment a blocker for initial merge. I think we should do this as the long term strategy though. Essentially for Linux builds, everything should always be container based.

Quoted 7 lines

Agreed. You should be able to set up a fairly minimal environment, which consists of Docker, gitlab-runner and not much else, using a long-term supported distro such as CentOS and then just schedule whatever container build on it. No need to provision a new machine every time a new Fedora release comes out, just create a container image for it and add it to the mix.

Hi Andrea,

There's nothing preventing this from happening, but limiting the runners to this configuration, prevents a lot more from happening.

Quoted 6 lines

Additionally, the gitlab-runner Docker executor provides more isolation than the shell executor, so running untrusted builds becomes a more reasonable proposition - this is how the shared runners on gitlab.com work - and you don't have to worry about your jobs cleaning up properly after themselves nearly as much.

Quoted 8 lines

I understand and agree to the the benefits of using the gitlab-runner Docker executor... until you want to run tests on non-Docker environments :).

Hopefully the explanation on my previous reply to Daniel will also serve for the points you raised here. I would have loved to have worked on a more abstract, container only environments, but that proved to be unrealistic.

Quoted 11 lines

For Linux targets, it should be possible to have exclusively container based testing environments. At worst you can run a privileged container and expose arbitrary host resources to it, so you can do anything in the container that you would otherwise do in bare metal. For non-Linux, we should be able to satisfy our needs with VMs, and indeed VMs can be used for Linux too if we want to emulate some specific hardware for testing that we don't have accessible to containers on bare metal. IOW, the testing environment can be entirely defined by the recipes we have in tests/docker and tests/vm. Bare metal hosts are simply a way to host the containers or vms.

I don't think you're following my point. It's not about what's possible to be done, but what's the baseline of the test environment we want to have.

It's unwise to attempt to compare the results of a test that run under a container with "arbitrary host resources" exposed to it, to the results of a test running on the host without the container layer. Think, for instance, if QE would be willing to do the former only, and sign off on it, when customers are using the later.

I hope this makes the point clearer.
- Cleber.

Quoted 7 lines

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#20 lore raw

Re: [PATCH v2 2/2] GitLab Gating CI: initial set of jobs, documentation and scripts

In reply to Daniel P. Berrangé
Quoted 20 lines · Daniel P. Berrangé
Quoted 19 lines · Cleber Rosa

This is a mapping of Peter's "remake-merge-builds" and "pull-buildtest" scripts, gone through some updates, adding some build option and removing others.

The jobs currently cover the machines that the QEMU project owns, and that are setup and ready to run jobs:

- Ubuntu 18.04 on S390x
- Ubuntu 20.04 on aarch64

During the development of this set of jobs, the GitLab CI was tested with many other architectures, including ppc64, s390x and aarch64, along with the other OSs (not included here):

- Fedora 30
- FreeBSD 12.1

More information can be found in the documentation itself.

Quoted 9 lines
Quoted 3 lines
---
 .gitlab-ci.d/gating.yml                | 146 +++++++++++++++++

AFAIK, the jobs in this file just augment what is already defined in the main .gitlab-ci.yml. Also since we're providing setup info for other people to configure custom runners, these jobs are usable for non-gating CI scenarios too.

If you mean that they introduced new jobs, you're right.

Quoted 3 lines

IOW, the jobs in this file happen to be usable for gating, but they are not the only gating jobs, and can be used for non-gating reasons.

Right, I do not doubt these jobs may be useful to other people and on scenarios other than "before merging a patch series".

Quoted 10 lines

This is a complicated way of saying that gating.yml is not a desirable filename, so I'd suggest splitting it in two and having these files named based on what their contents is, rather than their use case:

   .gitlab-ci.d/runners-s390x.yml
   .gitlab-ci.d/runners-aarch64.yml

The existing jobs in .gitlab-ci.yml could possibly be moved into a .gitlab-ci.d/runners-shared.yml file for consistency.

Do you imply that every gitlab CI job should be a gating job? And that the same jobs should be used when other people with their own forks? I find this problematic because:

* It would trigger pipelines with jobs that, unless every user has the same runners configured, would have unfulfilled jobs that don't have a matching hardware.

* It dilutes the idea that those jobs are inherently different with regards to the management of their infrastructure.

* It destroys the notion of layered testing, for whatever people find that worth it, where a faster turnaround could/would be possible with fewer jobs for every push, and many more jobs before a merge.

Finally, I find the split by runner architecture you suggested problematic because different organizations may have jobs for the same architecture. I believe that files for different organizations may be a better organization instead. Entries in the MAINTAINERS are one example where the grouping by architecture may not be optimal.

Quoted 62 lines
Quoted 21 lines
 .gitlab-ci.yml                         |   1 +
 docs/devel/testing.rst                 | 147 +++++++++++++++++
 scripts/ci/setup/build-environment.yml | 217 +++++++++++++++++++++++++
 scripts/ci/setup/gitlab-runner.yml     |  72 ++++++++
 scripts/ci/setup/inventory             |   2 +
 scripts/ci/setup/vars.yml              |  13 ++
 7 files changed, 598 insertions(+)
 create mode 100644 .gitlab-ci.d/gating.yml
 create mode 100644 scripts/ci/setup/build-environment.yml
 create mode 100644 scripts/ci/setup/gitlab-runner.yml
 create mode 100644 scripts/ci/setup/inventory
 create mode 100644 scripts/ci/setup/vars.yml
.gitlab-ci.d/gating.yml new file +2 -0
new file mode 100644
index 0000000000..5562df5708
@@ -0,0 +1,146 @@
+variables:
+  GIT_SUBMODULE_STRATEGY: recursive

.gitlab-ci.d/gating.yml line 12

Quoted 10 lines
.gitlab-ci.d/gating.yml new file +10 -0
+
+# All ubuntu-18.04 jobs should run successfully in an environment
+# setup by the scripts/ci/setup/build-environment.yml task
+# "Install basic packages to build QEMU on Ubuntu 18.04/20.04"
+ubuntu-18.04-s390x-all-linux-static:
+ tags:
+ - ubuntu_18.04
+ - s390x
+ rules:
+ - if: '$CI_COMMIT_REF_NAME == "staging"'

I think I'd make it more flexible in particular to allow multiple branches. For example I have multiple subsystems and have separate branches for each.

This could be as simple as allowing a regex prefix

- if: '$CI_COMMIT_REF_NAME =~ /^staging/'

Quoted 6 lines
scripts/ci/setup/build-environment.yml new file +0 -0
new file mode 100644
index 0000000000..89b35386c7

scripts/ci/setup/build-environment.yml line 10

Quoted 10 lines
scripts/ci/setup/build-environment.yml new file +10 -0
@@ -0,0 +1,217 @@
+---
+- name: Installation of basic packages to build QEMU
+  hosts: all
+  vars_files:
+    - vars.yml
+  tasks:
+    - name: Install basic packages to build QEMU on Ubuntu 18.04/20.04
+      apt:
+        update_cache: yes
+        # This matches the packages on tests/docker/Dockerfiles/ubuntu1804.docker

I'd be inclined to actually use docker on the custom runners.

Quoted 7 lines

eg. instead of having separate physical machines or VMs for each (distro, arch) pair, have a single host distro for the arch. Then use docker to provide the build environment against each distro.

IOW, a RHEL-8 aarch64 host, running docker for ubuntu18.04, fedora30 etc.

I've come across so many caveats and corner cases that having the lowest common denominator proved to be the smart and sane thing to do. For instance, building on the example you gave, running a RHEL 8 aarch64 host is a NO GO Today because RHEL 8 doesn't ship with docker and the gitlab runner needs to be taught to talk to, say, Podman.

gitlab-runner-helper images for different architectures, used to prepare the docker images before running jobs, also proved to be a challenge.

Finally, it's going to be very important for some organizations to run tests outside of container environments. For instance, Red Hat needs to run QEMU+KVM tests on bare metal and on VMs, in addition to containers.

Quoted 6 lines

That way we don't end up duplicating all these packages, and instead can use tests/docker/Dockerfiles/ubuntu1804.docker. This ensures that if a user needs to reproduce a build failure on their own local aarch64 machine, they can run docker and get the exact same build architecture.

Like I explained before, containers-only won't cut it. So, we need tooling that is environment agnostic. So far, ansible playbooks seem to be a reasonable solution. But duplicating information bothers me as much as it seems to bother you, so we need to engage in common tooling that is capable of generating those container environments, but not be limited to it. One example of a tool that seems to be a good candidate is "Libvirt's" lcitool.

Quoted 10 lines

It also has the benefit that we don't need to worry about how to setup gitlab runners for every distro we care about. We only need to do gitlab runner for the standard host distro, which spawns a pristine throwaway docker env.

I appreciate this is a big change from what you've done in this patch though, so don't consider this comment a blocker for initial merge. I think we should do this as the long term strategy though. Essentially for Linux builds, everything should always be container based.

Thanks for taking the time to give this feedback, and for making me check again the premises that led to the proposal of this design.

Hopefully, this will be an improvement over the current state of "pre-merge" testing, and at the same time can be the first step towards a scenario that has more of the characteristics you pointed out.

Best!
- Cleber.

Quoted 6 lines

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#21 lore raw

Re: [PATCH v2 2/2] GitLab Gating CI: initial set of jobs, documentation and scripts

Quoted 51 lines · Cleber Rosa
Quoted 20 lines · Daniel P. Berrangé
Quoted 19 lines · Cleber Rosa

This is a mapping of Peter's "remake-merge-builds" and "pull-buildtest" scripts, gone through some updates, adding some build option and removing others.

The jobs currently cover the machines that the QEMU project owns, and that are setup and ready to run jobs:

- Ubuntu 18.04 on S390x
- Ubuntu 20.04 on aarch64

During the development of this set of jobs, the GitLab CI was tested with many other architectures, including ppc64, s390x and aarch64, along with the other OSs (not included here):

- Fedora 30
- FreeBSD 12.1

More information can be found in the documentation itself.

Quoted 9 lines
Quoted 3 lines
---
 .gitlab-ci.d/gating.yml                | 146 +++++++++++++++++

AFAIK, the jobs in this file just augment what is already defined in the main .gitlab-ci.yml. Also since we're providing setup info for other people to configure custom runners, these jobs are usable for non-gating CI scenarios too.

If you mean that they introduced new jobs, you're right.

Quoted 3 lines

IOW, the jobs in this file happen to be usable for gating, but they are not the only gating jobs, and can be used for non-gating reasons.

Right, I do not doubt these jobs may be useful to other people and on scenarios other than "before merging a patch series".

Quoted 10 lines

This is a complicated way of saying that gating.yml is not a desirable filename, so I'd suggest splitting it in two and having these files named based on what their contents is, rather than their use case:

   .gitlab-ci.d/runners-s390x.yml
   .gitlab-ci.d/runners-aarch64.yml

The existing jobs in .gitlab-ci.yml could possibly be moved into a .gitlab-ci.d/runners-shared.yml file for consistency.

Quoted 7 lines

Do you imply that every gitlab CI job should be a gating job? And that the same jobs should be used when other people with their own forks? I find this problematic because:

* It would trigger pipelines with jobs that, unless every user has the same runners configured, would have unfulfilled jobs that don't have a matching hardware.

Jobs that require a custom runner should not be set to run by default, but individual contributors must absolutely be able to opt-in to running those jobs simply by registering a runner on their account.

Quoted 2 lines

* It dilutes the idea that those jobs are inherently different with regards to the management of their infrastructure.

I don't really know what yiu mean here, but "Inherantly different" does not sound like a desirable property.

Quoted 3 lines

* It destroys the notion of layered testing, for whatever people find that worth it, where a faster turnaround could/would be possible with fewer jobs for every push, and many more jobs before a merge.

The key goal of CI is to reduce the burden on maintainers. The biggest cost is if we merge code and failure is noticed after merge. IT is still a large cost, however, if Peter only finds a CI failure when he attempts the pre-merge test. He has to throw out the pull request putting more work on the subsystem maintainer. The subsystem maintainer may have to throw it back to the original author.

The ideal scenario that we need to strive towards is that the original author has tested their code with 100% coverage of all the CI jobs QMEU has defined.

Any time there is a job that is not run by authors, but only by the maintainers, we are putting increased burden on the maintainers, so must be minimize that.

IOW, layered testing is not desirable as goal. Rather layered testing is just a default setup, but we'd encourage contributors to run the full set of CI jobs, especially if they are frequent contributors. The more they run themselves, the less burden on subsystem maintainers and Peter, and thus the better we all scale.

Quoted 5 lines

Finally, I find the split by runner architecture you suggested problematic because different organizations may have jobs for the same architecture. I believe that files for different organizations may be a better organization instead. Entries in the MAINTAINERS are one example where the grouping by architecture may not be optimal.

I don't think we should be structuring jobs around organizations. We should be defining a set of desired jobs we wish to be able to run. Any organization can bring a runner that is capable of running the jobs and donate it to the QEMU project for our formal CI runner The organization is not defining the job though - QEMU is defining the jobs we expect to have used for testing.

This is key because any contributor needs to be able to spin up an identical envrionment to replicate any build failures. We don't want runners for merge testing that are built as a blackbox by someone. That is the single biggest painpoint with Peter's current merge jobs - we can't easily replicate Peter's merge env even if we had the matching hardware available.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#22 lore raw

Re: [PATCH v2 2/2] GitLab Gating CI: initial set of jobs, documentation and scripts

Quoted 56 lines · Daniel P. Berrangé
Quoted 55 lines · Cleber Rosa
Quoted 20 lines · Daniel P. Berrangé
Quoted 19 lines · Cleber Rosa

This is a mapping of Peter's "remake-merge-builds" and "pull-buildtest" scripts, gone through some updates, adding some build option and removing others.

The jobs currently cover the machines that the QEMU project owns, and that are setup and ready to run jobs:

- Ubuntu 18.04 on S390x
- Ubuntu 20.04 on aarch64

During the development of this set of jobs, the GitLab CI was tested with many other architectures, including ppc64, s390x and aarch64, along with the other OSs (not included here):

- Fedora 30
- FreeBSD 12.1

More information can be found in the documentation itself.

Quoted 9 lines
Quoted 3 lines
---
 .gitlab-ci.d/gating.yml                | 146 +++++++++++++++++

AFAIK, the jobs in this file just augment what is already defined in the main .gitlab-ci.yml. Also since we're providing setup info for other people to configure custom runners, these jobs are usable for non-gating CI scenarios too.

If you mean that they introduced new jobs, you're right.

Quoted 3 lines

IOW, the jobs in this file happen to be usable for gating, but they are not the only gating jobs, and can be used for non-gating reasons.

Right, I do not doubt these jobs may be useful to other people and on scenarios other than "before merging a patch series".

Quoted 10 lines

This is a complicated way of saying that gating.yml is not a desirable filename, so I'd suggest splitting it in two and having these files named based on what their contents is, rather than their use case:

   .gitlab-ci.d/runners-s390x.yml
   .gitlab-ci.d/runners-aarch64.yml

The existing jobs in .gitlab-ci.yml could possibly be moved into a .gitlab-ci.d/runners-shared.yml file for consistency.

Do you imply that every gitlab CI job should be a gating job? And that the same jobs should be used when other people with their own forks? I find this problematic because:

Quoted 8 lines
Quoted 3 lines

* It would trigger pipelines with jobs that, unless every user has the same runners configured, would have unfulfilled jobs that don't have a matching hardware.

Jobs that require a custom runner should not be set to run by default, but individual contributors must absolutely be able to opt-in to running those jobs simply by registering a runner on their account.

Agreed, and that's why they have been put into this diffent "gating" class here.

Quoted 6 lines
Quoted 2 lines

* It dilutes the idea that those jobs are inherently different with regards to the management of their infrastructure.

I don't really know what yiu mean here, but "Inherantly different" does not sound like a desirable property.

Organizations and individuals will have responsibility over the infrastructure they choose to add, which is "inherently different" from the gitlab shared machines. Not sure there's a way around it.

Quoted 11 lines
Quoted 3 lines

* It destroys the notion of layered testing, for whatever people find that worth it, where a faster turnaround could/would be possible with fewer jobs for every push, and many more jobs before a merge.

The key goal of CI is to reduce the burden on maintainers. The biggest cost is if we merge code and failure is noticed after merge. IT is still a large cost, however, if Peter only finds a CI failure when he attempts the pre-merge test. He has to throw out the pull request putting more work on the subsystem maintainer. The subsystem maintainer may have to throw it back to the original author.

Quoted 4 lines

The ideal scenario that we need to strive towards is that the original author has tested their code with 100% coverage of all the CI jobs QMEU has defined.

I agree... but it's also unrealistic at this point, right? For instance, do we have s390x boxes to run all of those? Avocado has been using Travis CI for s390x/ppc64/aarch64, and those are quite unreliable even with a load many orders of magnitude smaller then the QEMU project. So, resources are needed to have this flat, 100% coverage, "ideal scenario" you describe.

Quoted 4 lines

Any time there is a job that is not run by authors, but only by the maintainers, we are putting increased burden on the maintainers, so must be minimize that.

I agree. But if resources are limited, then should the testing scope be decresead so that it's equalized?

Quoted 6 lines

IOW, layered testing is not desirable as goal. Rather layered testing is just a default setup, but we'd encourage contributors to run the full set of CI jobs, especially if they are frequent contributors. The more they run themselves, the less burden on subsystem maintainers and Peter, and thus the better we all scale.

We agree on goals, we don't agree on the strategy though.

Quoted 6 lines
Quoted 5 lines

Finally, I find the split by runner architecture you suggested problematic because different organizations may have jobs for the same architecture. I believe that files for different organizations may be a better organization instead. Entries in the MAINTAINERS are one example where the grouping by architecture may not be optimal.

Quoted 7 lines

I don't think we should be structuring jobs around organizations. We should be defining a set of desired jobs we wish to be able to run. Any organization can bring a runner that is capable of running the jobs and donate it to the QEMU project for our formal CI runner The organization is not defining the job though - QEMU is defining the jobs we expect to have used for testing.

This was disscussed previously[1].

Quoted 7 lines

This is key because any contributor needs to be able to spin up an identical envrionment to replicate any build failures. We don't want runners for merge testing that are built as a blackbox by someone. That is the single biggest painpoint with Peter's current merge jobs - we can't easily replicate Peter's merge env even if we had the matching hardware available.

With the right automation, such as the playbooks introduced here, any person with the same hardware should have an environment to replicate a job and debug and issue.

[1] - https://lists.gnu.org/archive/html/qemu-devel/2019-12/msg00231.html

Best regards,
- Cleber.

Quoted 6 lines

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#23 lore raw

Re: [PATCH v2 2/2] GitLab Gating CI: initial set of jobs, documentation and scripts

In reply to Cleber Rosa

Hi,

Quoted 8 lines
Quoted 2 lines

IOW, a RHEL-8 aarch64 host, running docker for ubuntu18.04, fedora30 etc.

I've come across so many caveats and corner cases that having the lowest common denominator proved to be the smart and sane thing to do. For instance, building on the example you gave, running a RHEL 8 aarch64 host is a NO GO Today because RHEL 8 doesn't ship with docker and the gitlab runner needs to be taught to talk to, say, Podman.

podman got support for the docker daemon api (v2.0 I think), so this should be possible soon, without changing gitlab runner.

Also there is a kubernetes runner so you can run the thing in pretty much any cluster. k3s.io seems to be the easiest way to boot up a small kubernetes cluster on pretty much any linux system. Works on aarch64 too. Didn't try (yet) to run the gitlab runner there.

Quoted 4 lines

Finally, it's going to be very important for some organizations to run tests outside of container environments. For instance, Red Hat needs to run QEMU+KVM tests on bare metal and on VMs, in addition to containers.

Also for *BSD testing.
For setting up VM images we should use tests/vm.

Quoted 7 lines

Like I explained before, containers-only won't cut it. So, we need tooling that is environment agnostic. So far, ansible playbooks seem to be a reasonable solution. But duplicating information bothers me as much as it seems to bother you, so we need to engage in common tooling that is capable of generating those container environments, but not be limited to it. One example of a tool that seems to be a good candidate is "Libvirt's" lcitool.

What is wrong with the docker files we have?

It is a good idea anyway to use the same images for local test builds and CI. Makes it easier to reproduce CI failures locally.

take care,
Gerd

#24 lore raw

Re: [PATCH v2 2/2] GitLab Gating CI: initial set of jobs, documentation and scripts

In reply to Cleber Rosa

On Wed, Jul 08, 2020 at 10:46:57PM -0400, Cleber Rosa wrote:

Awesome, thanks for creating this stuff! Minor suggestions:

Quoted 13 lines
docs/devel/testing.rst +5 -0
index c1ff24370b..f8dab788ea 100644
@@ -1003,3 +1003,150 @@ exercise as many corner cases as possible. It is a useful test suite
 to run to exercise QEMU's linux-user code::
 
   https://linux-test-project.github.io/
+
+CI
+==
+
+QEMU has configurations enabled for a number of different CI services.

docs/devel/testing.rst exercise as many corner cases as possible. It is a useful test suite · line 1020

Quoted 10 lines
docs/devel/testing.rst +10 -0
+The most update information about them and their status can be found
+at::
+
+   https://wiki.qemu.org/Testing/CI
+
+Gating CI
+----------
+
+A Pull Requests will only to be merged if they successfully go through
+a different set of CI jobs.  GitLab's CI is the service/framework used

s/A Pull Requests/Pull Requests/
s/will only to be merged/will only be merged/

I suggest simplifying the first sentence:

Code is only merged after passing the "gating" set of CI jobs.

Whether they are called Pull Requests or Merge Requests shouldn't matter :).

docs/devel/testing.rst exercise as many corner cases as possible. It is a useful test suite · line 1024

Quoted 4 lines
docs/devel/testing.rst +4 -0
+for executing the gating jobs.
+
+The architecture of GitLab's CI service allows different machines to be
+setup with GitLab's "agent", called gitlab-runner, which will take care

s/setup/set up/ throughout this document
https://grammarist.com/spelling/set-up-vs-setup/

docs/devel/testing.rst exercise as many corner cases as possible. It is a useful test suite · line 1029

Quoted 5 lines
docs/devel/testing.rst +5 -0
+of running jobs created by events such as a push to a branch.
+
+Even though gitlab-runner can execute jobs on environments such as
+containers, this initial implementation assumes the shell executor is
+used, effectively running jobs on the same machine (be them physical

s/them/they/

docs/devel/testing.rst exercise as many corner cases as possible. It is a useful test suite · line 1030

Quoted 1 line
docs/devel/testing.rst +1 -0
+or virtual) the gitlab-runner agent is running.  This means those

s/the/where the/

Quoted 5 lines
docs/devel/testing.rst +5 -0
+machines must be setup in advance, with the requirements matching the
+jobs expected to be executed there.
+
+Machine configuration for gating jobs
+-------------------------------------

docs/devel/testing.rst exercise as many corner cases as possible. It is a useful test suite · line 1045

Quoted 10 lines
docs/devel/testing.rst +10 -0
+
+The GitLab's CI architecture allows different parties to provide
+different machines that will run different jobs.  At this point, QEMU
+will deploy a limited set of machines and jobs.  Documentation and/or
+scripts to setup those machines is located under::
+
+  scripts/ci/setup
+
+Ansible playbooks have been provided to perform two different tasks
+related to setting gitlab-runner and the build environment.

s/setting/setting up/

docs/devel/testing.rst exercise as many corner cases as possible. It is a useful test suite · line 1048

Quoted 3 lines
docs/devel/testing.rst +3 -0
+
+Other organizations involved in QEMU development may, in the near
+future, contribute their own setup documentation/scripts under

Comments about relative time lack context in a long-lived document like this one:
s/in the near future//

Quoted 6 lines
scripts/ci/setup/build-environment.yml new file +0 -0
new file mode 100644
index 0000000000..89b35386c7

scripts/ci/setup/build-environment.yml line 10

Quoted 10 lines
scripts/ci/setup/build-environment.yml new file +10 -0
@@ -0,0 +1,217 @@
+---
+- name: Installation of basic packages to build QEMU
+  hosts: all
+  vars_files:
+    - vars.yml
+  tasks:
+    - name: Install basic packages to build QEMU on Ubuntu 18.04/20.04
+      apt:
+        update_cache: yes
+        # This matches the packages on tests/docker/Dockerfiles/ubuntu1804.docker

These comments will not age well :). If you really want to leave a note then I suggest "Originally from tests/docker/Dockerfiles/ubuntu1804.docker".

scripts/ci/setup/vars.yml

Quoted 9 lines
scripts/ci/setup/inventory new file +2 -0
new file mode 100644
index 0000000000..8bb7ba6b33
@@ -0,0 +1,2 @@
+[local]
+localhost
scripts/ci/setup/vars.yml +0 -0

Perhaps this file can be called vars.yml.template and an entry for vars.yml can be added to .gitignore. A file that needs local editing should not be commited to git in-place. Otherwise it's easy to accidentally commit the local changes to git (and expose the private GitLab token!).

#25 lore raw

Re: [PATCH v2 2/2] GitLab Gating CI: initial set of jobs, documentation and scripts

Quoted 31 lines · Stefan Hajnoczi

On Wed, Jul 08, 2020 at 10:46:57PM -0400, Cleber Rosa wrote:

Awesome, thanks for creating this stuff! Minor suggestions:

Quoted 13 lines
docs/devel/testing.rst +5 -0
index c1ff24370b..f8dab788ea 100644
@@ -1003,3 +1003,150 @@ exercise as many corner cases as possible. It is a useful test suite
 to run to exercise QEMU's linux-user code::
 
   https://linux-test-project.github.io/
+
+CI
+==
+
+QEMU has configurations enabled for a number of different CI services.

docs/devel/testing.rst exercise as many corner cases as possible. It is a useful test suite · line 1020

Quoted 10 lines
docs/devel/testing.rst +10 -0
+The most update information about them and their status can be found
+at::
+
+   https://wiki.qemu.org/Testing/CI
+
+Gating CI
+----------
+
+A Pull Requests will only to be merged if they successfully go through
+a different set of CI jobs.  GitLab's CI is the service/framework used

s/A Pull Requests/Pull Requests/
s/will only to be merged/will only be merged/

Quoted 7 lines

I suggest simplifying the first sentence:

Code is only merged after passing the "gating" set of CI jobs.

Whether they are called Pull Requests or Merge Requests shouldn't matter :).

Yep, makes sense.

Quoted 8 lines

docs/devel/testing.rst exercise as many corner cases as possible. It is a useful test suite · line 1024

Quoted 4 lines
docs/devel/testing.rst +4 -0
+for executing the gating jobs.
+
+The architecture of GitLab's CI service allows different machines to be
+setup with GitLab's "agent", called gitlab-runner, which will take care

s/setup/set up/ throughout this document
https://grammarist.com/spelling/set-up-vs-setup/

Nice catch, thanks.

Quoted 8 lines

docs/devel/testing.rst exercise as many corner cases as possible. It is a useful test suite · line 1029

Quoted 5 lines
docs/devel/testing.rst +5 -0
+of running jobs created by events such as a push to a branch.
+
+Even though gitlab-runner can execute jobs on environments such as
+containers, this initial implementation assumes the shell executor is
+used, effectively running jobs on the same machine (be them physical

s/them/they/

Quoted 4 lines

docs/devel/testing.rst exercise as many corner cases as possible. It is a useful test suite · line 1030

Quoted 1 line
docs/devel/testing.rst +1 -0
+or virtual) the gitlab-runner agent is running.  This means those

s/the/where the/

Right, thanks.

Quoted 18 lines
Quoted 5 lines
docs/devel/testing.rst +5 -0
+machines must be setup in advance, with the requirements matching the
+jobs expected to be executed there.
+
+Machine configuration for gating jobs
+-------------------------------------

docs/devel/testing.rst exercise as many corner cases as possible. It is a useful test suite · line 1045

Quoted 10 lines
docs/devel/testing.rst +10 -0
+
+The GitLab's CI architecture allows different parties to provide
+different machines that will run different jobs.  At this point, QEMU
+will deploy a limited set of machines and jobs.  Documentation and/or
+scripts to setup those machines is located under::
+
+  scripts/ci/setup
+
+Ansible playbooks have been provided to perform two different tasks
+related to setting gitlab-runner and the build environment.

s/setting/setting up/

Quoted 8 lines

docs/devel/testing.rst exercise as many corner cases as possible. It is a useful test suite · line 1048

Quoted 3 lines
docs/devel/testing.rst +3 -0
+
+Other organizations involved in QEMU development may, in the near
+future, contribute their own setup documentation/scripts under

Comments about relative time lack context in a long-lived document like this one:
s/in the near future//

You're right. That was already bothering but I couldn't tell why.

Quoted 21 lines
Quoted 6 lines
scripts/ci/setup/build-environment.yml new file +0 -0
new file mode 100644
index 0000000000..89b35386c7

scripts/ci/setup/build-environment.yml line 10

Quoted 10 lines
scripts/ci/setup/build-environment.yml new file +10 -0
@@ -0,0 +1,217 @@
+---
+- name: Installation of basic packages to build QEMU
+  hosts: all
+  vars_files:
+    - vars.yml
+  tasks:
+    - name: Install basic packages to build QEMU on Ubuntu 18.04/20.04
+      apt:
+        update_cache: yes
+        # This matches the packages on tests/docker/Dockerfiles/ubuntu1804.docker

These comments will not age well :). If you really want to leave a note then I suggest "Originally from tests/docker/Dockerfiles/ubuntu1804.docker".

Quoted 15 lines

scripts/ci/setup/vars.yml

Quoted 9 lines
scripts/ci/setup/inventory new file +2 -0
new file mode 100644
index 0000000000..8bb7ba6b33
@@ -0,0 +1,2 @@
+[local]
+localhost
scripts/ci/setup/vars.yml +0 -0

Perhaps this file can be called vars.yml.template and an entry for vars.yml can be added to .gitignore. A file that needs local editing should not be commited to git in-place. Otherwise it's easy to accidentally commit the local changes to git (and expose the private GitLab token!).

Right... Philippe has already suggested this, and you've definitely increased its significance with the data leak example. So yes, let's do this rename.

Thanks for the feedback and suggestions!
- Cleber.

#26 lore raw

Re: [PATCH v2 2/2] GitLab Gating CI: initial set of jobs, documentation and scripts

In reply to Cleber Rosa
Quoted 18 lines · Cleber Rosa

This is a mapping of Peter's "remake-merge-builds" and "pull-buildtest" scripts, gone through some updates, adding some build option and removing others.

The jobs currently cover the machines that the QEMU project owns, and that are setup and ready to run jobs:

- Ubuntu 18.04 on S390x
- Ubuntu 20.04 on aarch64

During the development of this set of jobs, the GitLab CI was tested with many other architectures, including ppc64, s390x and aarch64, along with the other OSs (not included here):

- Fedora 30
- FreeBSD 12.1

More information can be found in the documentation itself.

[...]

Quoted 18 lines
docs/devel/testing.rst +10 -0
index c1ff24370b..f8dab788ea 100644
@@ -1003,3 +1003,150 @@ exercise as many corner cases as possible. It is a useful test suite
 to run to exercise QEMU's linux-user code::
 
   https://linux-test-project.github.io/
+
+CI
+==
+
+QEMU has configurations enabled for a number of different CI services.
+The most update information about them and their status can be found
+at::
+
+   https://wiki.qemu.org/Testing/CI
+

docs/devel/testing.rst exercise as many corner cases as possible. It is a useful test suite · line 1025

Quoted 10 lines
docs/devel/testing.rst +10 -0
+Gating CI
+----------
+
+A Pull Requests will only to be merged if they successfully go through
+a different set of CI jobs.  GitLab's CI is the service/framework used
+for executing the gating jobs.
+
+The architecture of GitLab's CI service allows different machines to be
+setup with GitLab's "agent", called gitlab-runner, which will take care
+of running jobs created by events such as a push to a branch.

Now that GitLab announced the free tier time limit, it may be worth mentioning (if set up) the CI pipeline can be skipped using:

  $ git push --push-option=ci.skip [...]
#27 lore raw
In reply to Cleber Rosa
Quoted 8 lines · Cleber Rosa

The idea about a public facing Gating CI for QEMU was summarized in an RFC[1]. Since then, it was decided that a simpler version should be attempted first.

At this point, there are two specific runners (an aarch64 and an s390) registered with GitLab, at https://gitlab.com/qemu-project, currently setup to the "qemu" repository.

Could I have a simple "this is the command you need to run to test your staging branch with the project gitlab" set of getting-started instructions, please?

thanks
-- PMM

#28 lore raw
Quoted 10 lines · Peter Maydell
Quoted 8 lines · Cleber Rosa

The idea about a public facing Gating CI for QEMU was summarized in an RFC[1]. Since then, it was decided that a simpler version should be attempted first.

At this point, there are two specific runners (an aarch64 and an s390) registered with GitLab, at https://gitlab.com/qemu-project, currently setup to the "qemu" repository.

Quoted 7 lines

Could I have a simple "this is the command you need to run to test your staging branch with the project gitlab" set of getting-started instructions, please?

thanks
-- PMM

Hi Peter,

Sure. It's important that PATCH 2/2 in this series is included in a branch that you need to push to the "staging" branch on the
https://gitlab.com/qemu-project/qemu repo (it could be just that one patch). Then, you can run:

  ./scripts/ci/gitlab-pipeline-status --verbose -w

And that should be it. You can drop '--verbose' if you just want the final outcome as the result.

A longer explanation: that command defaults to checking for the pipeline associated with the commit for the *local* staging branch. You can check the pipeline results on other commits, such as the latest master (by the time I write this):

  $ ./scripts/ci/gitlab-pipeline-status --verbose -c 1e6c50ad8559c18b21041ef69d8fff781a8db0bb
  success

Please let me if anything goes wrong, as I wasn't able to submit jobs to those two machines (did so on emulated ones) and the devil lies in the details.

Thanks,
- Cleber.

#29 lore raw
Quoted 9 lines · Cleber Rosa

Sure. It's important that PATCH 2/2 in this series is included in a branch that you need to push to the "staging" branch on the
https://gitlab.com/qemu-project/qemu repo (it could be just that one patch). Then, you can run:

  ./scripts/ci/gitlab-pipeline-status --verbose -w

And that should be it. You can drop '--verbose' if you just want the final outcome as the result.

I tried this (local branch named "staging", pushed to gitlab remote "staging" branch), but it said:

e104462:bionic:qemu$ ./scripts/ci/gitlab-pipeline-status --verbose -w
ERROR: No pipeline found
failure

It does seem to have kicked off the pipeline on gitlab though:
https://gitlab.com/qemu-project/qemu/-/pipelines/171671136/builds
OTOH I can't see anything on that web page that suggests that it's submitting jobs to the s390 or aarch64 boxes -- is it intended to?

thanks
-- PMM

#30 lore raw
Quoted 18 lines · Peter Maydell
Quoted 9 lines · Cleber Rosa

Sure. It's important that PATCH 2/2 in this series is included in a branch that you need to push to the "staging" branch on the
https://gitlab.com/qemu-project/qemu repo (it could be just that one patch). Then, you can run:

  ./scripts/ci/gitlab-pipeline-status --verbose -w

And that should be it. You can drop '--verbose' if you just want the final outcome as the result.

I tried this (local branch named "staging", pushed to gitlab remote "staging" branch), but it said:

e104462:bionic:qemu$ ./scripts/ci/gitlab-pipeline-status --verbose -w
ERROR: No pipeline found
failure

Quoted 5 lines

It does seem to have kicked off the pipeline on gitlab though:
https://gitlab.com/qemu-project/qemu/-/pipelines/171671136/builds
OTOH I can't see anything on that web page that suggests that it's submitting jobs to the s390 or aarch64 boxes -- is it intended to?

It looks like those jobs are all in the "test" stage of the pipeline, so it is waiting for the earlier stages to complete before running the jobs.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#31 lore raw
Quoted 19 lines · Daniel P. Berrangé
Quoted 18 lines · Peter Maydell
Quoted 9 lines · Cleber Rosa

Sure. It's important that PATCH 2/2 in this series is included in a branch that you need to push to the "staging" branch on the
https://gitlab.com/qemu-project/qemu repo (it could be just that one patch). Then, you can run:

  ./scripts/ci/gitlab-pipeline-status --verbose -w

And that should be it. You can drop '--verbose' if you just want the final outcome as the result.

I tried this (local branch named "staging", pushed to gitlab remote "staging" branch), but it said:

e104462:bionic:qemu$ ./scripts/ci/gitlab-pipeline-status --verbose -w
ERROR: No pipeline found
failure

Quoted 9 lines
Quoted 5 lines

It does seem to have kicked off the pipeline on gitlab though:
https://gitlab.com/qemu-project/qemu/-/pipelines/171671136/builds
OTOH I can't see anything on that web page that suggests that it's submitting jobs to the s390 or aarch64 boxes -- is it intended to?

It looks like those jobs are all in the "test" stage of the pipeline, so it is waiting for the earlier stages to complete before running the jobs.

Hi Daniel,

Right. IIUC the criteria for putting jobs in the test stage at the moment is "if they include running tests (in addition to builds) they should be in test". Looking at that from this perspective, they're in the right place.

But, these jobs don't depend on anything else, including container builds, so there's no reason to have them wait for so long to run. The solution may be to rename the first stage (containers) to something more generic (and unfortunately less descriptive) so that all of them will run concurrently and earlier.

Thoughts?
- Cleber.

Quoted 6 lines

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#32 lore raw
Quoted 37 lines · Cleber Rosa
Quoted 19 lines · Daniel P. Berrangé
Quoted 18 lines · Peter Maydell
Quoted 9 lines · Cleber Rosa

Sure. It's important that PATCH 2/2 in this series is included in a branch that you need to push to the "staging" branch on the
https://gitlab.com/qemu-project/qemu repo (it could be just that one patch). Then, you can run:

  ./scripts/ci/gitlab-pipeline-status --verbose -w

And that should be it. You can drop '--verbose' if you just want the final outcome as the result.

I tried this (local branch named "staging", pushed to gitlab remote "staging" branch), but it said:

e104462:bionic:qemu$ ./scripts/ci/gitlab-pipeline-status --verbose -w
ERROR: No pipeline found
failure

Quoted 9 lines
Quoted 5 lines

It does seem to have kicked off the pipeline on gitlab though:
https://gitlab.com/qemu-project/qemu/-/pipelines/171671136/builds
OTOH I can't see anything on that web page that suggests that it's submitting jobs to the s390 or aarch64 boxes -- is it intended to?

It looks like those jobs are all in the "test" stage of the pipeline, so it is waiting for the earlier stages to complete before running the jobs.

Hi Daniel,

Right. IIUC the criteria for putting jobs in the test stage at the moment is "if they include running tests (in addition to builds) they should be in test". Looking at that from this perspective, they're in the right place.

Quoted 5 lines

But, these jobs don't depend on anything else, including container builds, so there's no reason to have them wait for so long to run. The solution may be to rename the first stage (containers) to something more generic (and unfortunately less descriptive) so that all of them will run concurrently and earlier.

Just add 'needs: []' to any jobs that don't depend on earlier jobs.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#33 lore raw
Quoted 38 lines · Daniel P. Berrangé
Quoted 37 lines · Cleber Rosa
Quoted 19 lines · Daniel P. Berrangé
Quoted 18 lines · Peter Maydell
Quoted 9 lines · Cleber Rosa

Sure. It's important that PATCH 2/2 in this series is included in a branch that you need to push to the "staging" branch on the
https://gitlab.com/qemu-project/qemu repo (it could be just that one patch). Then, you can run:

  ./scripts/ci/gitlab-pipeline-status --verbose -w

And that should be it. You can drop '--verbose' if you just want the final outcome as the result.

I tried this (local branch named "staging", pushed to gitlab remote "staging" branch), but it said:

e104462:bionic:qemu$ ./scripts/ci/gitlab-pipeline-status --verbose -w
ERROR: No pipeline found
failure

Quoted 9 lines
Quoted 5 lines

It does seem to have kicked off the pipeline on gitlab though:
https://gitlab.com/qemu-project/qemu/-/pipelines/171671136/builds
OTOH I can't see anything on that web page that suggests that it's submitting jobs to the s390 or aarch64 boxes -- is it intended to?

It looks like those jobs are all in the "test" stage of the pipeline, so it is waiting for the earlier stages to complete before running the jobs.

Hi Daniel,

Right. IIUC the criteria for putting jobs in the test stage at the moment is "if they include running tests (in addition to builds) they should be in test". Looking at that from this perspective, they're in the right place.

Quoted 8 lines
Quoted 5 lines

But, these jobs don't depend on anything else, including container builds, so there's no reason to have them wait for so long to run. The solution may be to rename the first stage (containers) to something more generic (and unfortunately less descriptive) so that all of them will run concurrently and earlier.

Just add 'needs: []' to any jobs that don't depend on earlier jobs.

Great, thanks!

Long version: I remember something like this was possible (which I mentioned in the other reply), but the documentation about stages
(https://docs.gitlab.com/ee/ci/yaml/#stages) made me loose hope when writing this reply. Thanks again!

- Cleber.

Quoted 6 lines

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#34 lore raw
In reply to Peter Maydell
Quoted 11 lines · Peter Maydell
Quoted 9 lines · Cleber Rosa

Sure. It's important that PATCH 2/2 in this series is included in a branch that you need to push to the "staging" branch on the
https://gitlab.com/qemu-project/qemu repo (it could be just that one patch). Then, you can run:

  ./scripts/ci/gitlab-pipeline-status --verbose -w

And that should be it. You can drop '--verbose' if you just want the final outcome as the result.

Quoted 7 lines

I tried this (local branch named "staging", pushed to gitlab remote "staging" branch), but it said:

e104462:bionic:qemu$ ./scripts/ci/gitlab-pipeline-status --verbose -w
ERROR: No pipeline found
failure

Hi Peter,

I think this may just have been a timing issue. GitLab usually does take a few seconds after it receives a branch push to create a pipeline. Let me know if you'd like to see this within the script, or if you'd rather put a sleep between your push and the "gitlab-pipeline-status" execution.

Quoted 2 lines

It does seem to have kicked off the pipeline on gitlab though:
https://gitlab.com/qemu-project/qemu/-/pipelines/171671136/builds

There's already new content on the staging branch, but supposing my local staging branch contained commit 6e7c2dcb50907aa6be0cbc37f81801d2fa67f7b4
(https://gitlab.com/qemu-project/qemu/-/commit/6e7c2dcb50907aa6be0cbc37f81801d2fa67f7b4),
the command you ran:

  ./scripts/ci/gitlab-pipeline-status --verbose -w

Should have behaved as this (output from my machine):

  /scripts/ci/gitlab-pipeline-status --verbose -w -c 6e7c2dcb50907aa6be0cbc37f81801d2fa67f7b4
  running...
Quoted 4 lines

OTOH I can't see anything on that web page that suggests that it's submitting jobs to the s390 or aarch64 boxes -- is it intended to?

All the jobs for that pipeline have been created as expected, for instance:

https://gitlab.com/qemu-project/qemu/-/jobs/659874849

But given the recent changes to the GitLab YAML adding other phases, it's waiting for the previous phases.

The jobs introduced with this patch are in the test phase because they do builds and tests. But IIRC there's a way to tell jobs to avoid being blocked by previous phases. I'll look into that.

Until then, I hope to see the job results soon from the s390 and aarch64 boxes.

Thanks,
- Cleber.

Quoted 3 lines

thanks
-- PMM

#35 lore raw
Quoted 21 lines · Cleber Rosa
Quoted 11 lines · Peter Maydell
Quoted 9 lines · Cleber Rosa

Sure. It's important that PATCH 2/2 in this series is included in a branch that you need to push to the "staging" branch on the
https://gitlab.com/qemu-project/qemu repo (it could be just that one patch). Then, you can run:

  ./scripts/ci/gitlab-pipeline-status --verbose -w

And that should be it. You can drop '--verbose' if you just want the final outcome as the result.

Quoted 7 lines

I tried this (local branch named "staging", pushed to gitlab remote "staging" branch), but it said:

e104462:bionic:qemu$ ./scripts/ci/gitlab-pipeline-status --verbose -w
ERROR: No pipeline found
failure

Quoted 7 lines

Hi Peter,

I think this may just have been a timing issue. GitLab usually does take a few seconds after it receives a branch push to create a pipeline. Let me know if you'd like to see this within the script, or if you'd rather put a sleep between your push and the "gitlab-pipeline-status" execution.

Ah, right. I ran the command again and it does (eventually) print "running...". I think the ideal behaviour would be for the script to have some kind of "waiting for pipeline to start..." phase where it sits and polls for the pipeline to appear, with a pretty long timeout (minutes?).

Quoted 20 lines
Quoted 2 lines

It does seem to have kicked off the pipeline on gitlab though:
https://gitlab.com/qemu-project/qemu/-/pipelines/171671136/builds

There's already new content on the staging branch, but supposing my local staging branch contained commit 6e7c2dcb50907aa6be0cbc37f81801d2fa67f7b4
(https://gitlab.com/qemu-project/qemu/-/commit/6e7c2dcb50907aa6be0cbc37f81801d2fa67f7b4),
the command you ran:

  ./scripts/ci/gitlab-pipeline-status --verbose -w

Should have behaved as this (output from my machine):

  /scripts/ci/gitlab-pipeline-status --verbose -w -c 6e7c2dcb50907aa6be0cbc37f81801d2fa67f7b4
  running...
Quoted 4 lines

OTOH I can't see anything on that web page that suggests that it's submitting jobs to the s390 or aarch64 boxes -- is it intended to?

Quoted 7 lines

All the jobs for that pipeline have been created as expected, for instance:

   https://gitlab.com/qemu-project/qemu/-/jobs/659874849

But given the recent changes to the GitLab YAML adding other phases, it's waiting for the previous phases.

The page now says "This job has been skipped"...

thanks
-- PMM

#36 lore raw
Quoted 30 lines · Peter Maydell
Quoted 21 lines · Cleber Rosa
Quoted 11 lines · Peter Maydell
Quoted 9 lines · Cleber Rosa

Sure. It's important that PATCH 2/2 in this series is included in a branch that you need to push to the "staging" branch on the
https://gitlab.com/qemu-project/qemu repo (it could be just that one patch). Then, you can run:

  ./scripts/ci/gitlab-pipeline-status --verbose -w

And that should be it. You can drop '--verbose' if you just want the final outcome as the result.

Quoted 7 lines

I tried this (local branch named "staging", pushed to gitlab remote "staging" branch), but it said:

e104462:bionic:qemu$ ./scripts/ci/gitlab-pipeline-status --verbose -w
ERROR: No pipeline found
failure

Quoted 7 lines

Hi Peter,

I think this may just have been a timing issue. GitLab usually does take a few seconds after it receives a branch push to create a pipeline. Let me know if you'd like to see this within the script, or if you'd rather put a sleep between your push and the "gitlab-pipeline-status" execution.

Quoted 6 lines

Ah, right. I ran the command again and it does (eventually) print "running...". I think the ideal behaviour would be for the script to have some kind of "waiting for pipeline to start..." phase where it sits and polls for the pipeline to appear, with a pretty long timeout (minutes?).

Fair enough. I'll send a patch to change the script behavior.

Quoted 23 lines
Quoted 23 lines
Quoted 2 lines

It does seem to have kicked off the pipeline on gitlab though:
https://gitlab.com/qemu-project/qemu/-/pipelines/171671136/builds

There's already new content on the staging branch, but supposing my local staging branch contained commit 6e7c2dcb50907aa6be0cbc37f81801d2fa67f7b4
(https://gitlab.com/qemu-project/qemu/-/commit/6e7c2dcb50907aa6be0cbc37f81801d2fa67f7b4),
the command you ran:

  ./scripts/ci/gitlab-pipeline-status --verbose -w

Should have behaved as this (output from my machine):

  /scripts/ci/gitlab-pipeline-status --verbose -w -c 6e7c2dcb50907aa6be0cbc37f81801d2fa67f7b4
  running...
Quoted 4 lines

OTOH I can't see anything on that web page that suggests that it's submitting jobs to the s390 or aarch64 boxes -- is it intended to?

All the jobs for that pipeline have been created as expected, for instance:

Quoted 7 lines
Quoted 4 lines
   https://gitlab.com/qemu-project/qemu/-/jobs/659874849

But given the recent changes to the GitLab YAML adding other phases, it's waiting for the previous phases.

The page now says "This job has been skipped"...

I saw that, and I was very disappointed... I double checked the machines, the runners status, tag names and they all seem to be OK.

So, I think the reason for the skip (there's an open issue on GitLab itself about not communicating to users the reason) is that GitLab does a late evaluation of the job condition. For those jobs the condition is:

rules:
- if: '$CI_COMMIT_REF_NAME == "staging"'

Which by the time the job was evaluated it was no longer true (there was new content on the staging branch). There are multiple ways to solve the problem, including (and in my order of preference):

1. using '$CI_COMMIT_BRANCH' instead of '$CI_COMMIT_REF_NAME', given that the pushed branch name should be kept stable even if the content (thus reference name) changes

2. not changing anything if you believe that under normal circunstances one pipeline for the staging will be running at a time.

I'll prepare a new version with #1, unless you have a strong feeling against it.

- Cleber.

Quoted 3 lines

thanks
-- PMM

#37 lore raw
Quoted 3 lines · Cleber Rosa
Quoted 2 lines · Peter Maydell
Quoted 1 line · Cleber Rosa

...

Quoted 31 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

OTOH I can't see anything on that web page that suggests that it's submitting jobs to the s390 or aarch64 boxes -- is it intended to?

All the jobs for that pipeline have been created as expected, for instance:

Quoted 7 lines
Quoted 4 lines
   https://gitlab.com/qemu-project/qemu/-/jobs/659874849

But given the recent changes to the GitLab YAML adding other phases, it's waiting for the previous phases.

The page now says "This job has been skipped"...

I saw that, and I was very disappointed... I double checked the machines, the runners status, tag names and they all seem to be OK.

So, I think the reason for the skip (there's an open issue on GitLab itself about not communicating to users the reason) is that GitLab does a late evaluation of the job condition. For those jobs the condition is:

rules:
- if: '$CI_COMMIT_REF_NAME == "staging"'

Which by the time the job was evaluated it was no longer true (there was new content on the staging branch). There are multiple ways to solve the problem, including (and in my order of preference):

Quoted 7 lines

1. using '$CI_COMMIT_BRANCH' instead of '$CI_COMMIT_REF_NAME', given that the pushed branch name should be kept stable even if the content (thus reference name) changes

2. not changing anything if you believe that under normal circunstances one pipeline for the staging will be running at a time.

For mainstream, usually one at a time is enough, because if you tests various and one is merged, then you need to rerun on top of the merged one, so it is not very useful.

For other users, it is useful. I'd certainly finish a patch, run the script, switch branch in another console, do some other work, run another instance of the script concurrently with the 1st one, etc...

Quoted 9 lines

I'll prepare a new version with #1, unless you have a strong feeling against it.

- Cleber.

Quoted 3 lines

thanks
-- PMM

#38 lore raw
In reply to Cleber Rosa
Quoted 10 lines · Cleber Rosa

So, I think the reason for the skip (there's an open issue on GitLab itself about not communicating to users the reason) is that GitLab does a late evaluation of the job condition. For those jobs the condition is:

rules:
- if: '$CI_COMMIT_REF_NAME == "staging"'

Which by the time the job was evaluated it was no longer true (there was new content on the staging branch).

What caused the new content on the staging branch? I only pushed the once (to go to commit 6e7c2dcb50907aa) -- is some other mechanism updating it? Looking at what it now seems to point to it looks like it's being mirrored from the git.qemu.org repo... Either we should turn that off, or tests need to be pushed to git.qemu.org:staging (which might introduce a delay if the mirror isn't immediate)...

thanks
-- PMM