~sircmpwn/sr.ht-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 3

[PATCH dispatch.sr.ht] Set BUILD_* environment variables

Details
Message ID
<20210226210512.31887-1-yyp@disroot.org>
DKIM signature
pass
Download raw message
Patch: +6 -0
---
 dispatchsrht/tasks/github/common.py                 | 1 +
 dispatchsrht/tasks/github/github_commit_to_build.py | 1 +
 dispatchsrht/tasks/github/github_pr_to_build.py     | 1 +
 dispatchsrht/tasks/gitlab/common.py                 | 1 +
 dispatchsrht/tasks/gitlab/gitlab_commit_to_build.py | 1 +
 dispatchsrht/tasks/gitlab/gitlab_mr_to_build.py     | 1 +
 6 files changed, 6 insertions(+)

diff --git a/dispatchsrht/tasks/github/common.py b/dispatchsrht/tasks/github/common.py
index 3a32069..cfe356b 100644
--- a/dispatchsrht/tasks/github/common.py
+++ b/dispatchsrht/tasks/github/common.py
@@ -175,6 +175,7 @@ def submit_github_build(tag, hook, repo, commit, base=None,
        if not manifest.environment:
            manifest.environment = env
        else:
            manifest.environment.setdefault("BUILD_SUBMITTER", "dispatch.sr.ht")
            manifest.environment.update(env)

        notify_payload = {
diff --git a/dispatchsrht/tasks/github/github_commit_to_build.py b/dispatchsrht/tasks/github/github_commit_to_build.py
index d52edb7..6062fb5 100644
--- a/dispatchsrht/tasks/github/github_commit_to_build.py
+++ b/dispatchsrht/tasks/github/github_commit_to_build.py
@@ -88,6 +88,7 @@ class GitHubCommitToBuild(TaskDef):
        if not valid.ok:
            return "Got request, but it has no commits"
        return submit_github_build("commits", hook, repo, commit, env={
            "BUILD_REASON": "github-commit",
            "GITHUB_DELIVERY": request.headers.get("X-GitHub-Delivery"),
            "GITHUB_EVENT": request.headers.get("X-GitHub-Event"),
            "GITHUB_REF": ref,
diff --git a/dispatchsrht/tasks/github/github_pr_to_build.py b/dispatchsrht/tasks/github/github_pr_to_build.py
index 747706a..6cede88 100644
--- a/dispatchsrht/tasks/github/github_pr_to_build.py
+++ b/dispatchsrht/tasks/github/github_pr_to_build.py
@@ -126,6 +126,7 @@ class GitHubPRToBuild(TaskDef):
                    "automerge": hook.automerge, 
                    "pr": pr["number"]
                }, env={
                    "BUILD_REASON": "github-pr",
                    "GITHUB_DELIVERY": request.headers.get("X-GitHub-Delivery"),
                    "GITHUB_EVENT": request.headers.get("X-GitHub-Event"),
                    "GITHUB_PR_NUMBER": str(pr["number"]),
diff --git a/dispatchsrht/tasks/gitlab/common.py b/dispatchsrht/tasks/gitlab/common.py
index 0c181e1..f5af968 100644
--- a/dispatchsrht/tasks/gitlab/common.py
+++ b/dispatchsrht/tasks/gitlab/common.py
@@ -165,6 +165,7 @@ def submit_gitlab_build(tag, auth, hook, project, commit,
            return "There are no build manifests in this repository."

    env.update({
        "BUILD_SUBMITTER": "dispatch.sr.ht",
        "GITLAB_REPOSITORY": hook.repo_name,
        "GITLAB_EVENT": request.headers.get('X-Gitlab-Event'),
    })
diff --git a/dispatchsrht/tasks/gitlab/gitlab_commit_to_build.py b/dispatchsrht/tasks/gitlab/gitlab_commit_to_build.py
index 2072bd4..1d606ef 100644
--- a/dispatchsrht/tasks/gitlab/gitlab_commit_to_build.py
+++ b/dispatchsrht/tasks/gitlab/gitlab_commit_to_build.py
@@ -172,6 +172,7 @@ class GitLabCommitToBuild(TaskDef):
            return "Unable to fetch commit information"

        urls = submit_gitlab_build("commits", auth, hook, project, commit, env={
            "BUILD_REASON": "gitlab-commit",
            "GITLAB_REF": ref,
        })
        if isinstance(urls, str):
diff --git a/dispatchsrht/tasks/gitlab/gitlab_mr_to_build.py b/dispatchsrht/tasks/gitlab/gitlab_mr_to_build.py
index a40c93a..ef521b4 100644
--- a/dispatchsrht/tasks/gitlab/gitlab_mr_to_build.py
+++ b/dispatchsrht/tasks/gitlab/gitlab_mr_to_build.py
@@ -171,6 +171,7 @@ class GitLabMRToBuild(TaskDef):
        merge_req = project.mergerequests.get(object_attrs["iid"])

        urls = submit_gitlab_build("mrs", auth, hook, project, commit, source, {
            "BUILD_REASON": "gitlab-mr",
            "GITLAB_MR_NUMBER": object_attrs["iid"],
            "GITLAB_MR_TITLE": object_attrs["title"],
            "GITLAB_BASE_REPO": project.attributes["name_with_namespace"],
-- 
2.30.1

[dispatch.sr.ht/patches] build success

builds.sr.ht
Details
Message ID
<C9JRQ7NZBM19.S9AOLAXV91YN@cirno>
In-Reply-To
<20210226210512.31887-1-yyp@disroot.org> (view parent)
DKIM signature
missing
Download raw message
dispatch.sr.ht/patches: SUCCESS in 2m4s

[Set BUILD_* environment variables][0] from [Alexey Yerin][1]

[0]: https://lists.sr.ht/~sircmpwn/sr.ht-dev/patches/20627
[1]: mailto:yyp@disroot.org

✓ #441132 SUCCESS dispatch.sr.ht/patches/archlinux.yml https://builds.sr.ht/~sircmpwn/job/441132
✓ #441133 SUCCESS dispatch.sr.ht/patches/debian.yml    https://builds.sr.ht/~sircmpwn/job/441133
✓ #441131 SUCCESS dispatch.sr.ht/patches/alpine.yml    https://builds.sr.ht/~sircmpwn/job/441131
Details
Message ID
<C9KL9QIIP7YQ.27DM19DAL48B4@taiga>
In-Reply-To
<20210226210512.31887-1-yyp@disroot.org> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
On Fri Feb 26, 2021 at 4:05 PM EST, Alexey Yerin wrote:
> ---
> dispatchsrht/tasks/github/common.py | 1 +
> dispatchsrht/tasks/github/github_commit_to_build.py | 1 +
> dispatchsrht/tasks/github/github_pr_to_build.py | 1 +
> dispatchsrht/tasks/gitlab/common.py | 1 +
> dispatchsrht/tasks/gitlab/gitlab_commit_to_build.py | 1 +
> dispatchsrht/tasks/gitlab/gitlab_mr_to_build.py | 1 +
> 6 files changed, 6 insertions(+)
>
> diff --git a/dispatchsrht/tasks/github/common.py
> b/dispatchsrht/tasks/github/common.py
> index 3a32069..cfe356b 100644
> --- a/dispatchsrht/tasks/github/common.py
> +++ b/dispatchsrht/tasks/github/common.py
> @@ -175,6 +175,7 @@ def submit_github_build(tag, hook, repo, commit,
> base=None,
> if not manifest.environment:
> manifest.environment = env
> else:
> + manifest.environment.setdefault("BUILD_SUBMITTER", "dispatch.sr.ht")
> manifest.environment.update(env)

Looks like this only works on the one branch. Should be done outside of
the if statement.

Rest of this LGTM
Details
Message ID
<C9LBU622SHQ3.21GY59FZRFBJL@desktop>
In-Reply-To
<C9KL9QIIP7YQ.27DM19DAL48B4@taiga> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
> Looks like this only works on the one branch. Should be done outside of
> the if statement.

Oops, didn't notice this bug. Thanks for pointing out!
Reply to thread Export thread (mbox)