report build results in Git web interfaces #32

Closed
opened 2020-08-31 18:11:33 +08:00 by sb10q · 5 comments

Tick/X marks next to commits on GitHub and Gitea.

Tick/X marks next to commits on GitHub and Gitea.

This worked:

curl -X POST \
    "https://git.m-labs.hk/api/v1/repos/astro/sandbox/statuses/1ec011810948177d245765a64cf2c2b977413ac9?token=$token" \
    -H "accept: application/json" \
    -H "Content-Type: application/json" \
    -d "{ \"context\": \"curl\", \"description\": \"No new bugs\", \"state\": \"success\", \"target_url\": \"https://nixbld.m-labs.hk\"}"

Next: figuring out how to get from $HYDRA_JSON to the input commit id.

This worked: ```sh curl -X POST \ "https://git.m-labs.hk/api/v1/repos/astro/sandbox/statuses/1ec011810948177d245765a64cf2c2b977413ac9?token=$token" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ -d "{ \"context\": \"curl\", \"description\": \"No new bugs\", \"state\": \"success\", \"target_url\": \"https://nixbld.m-labs.hk\"}" ``` Next: figuring out how to get from $HYDRA_JSON to the input commit id.

Which Hydra jobs are relevant for the build status of a commit?


There's already a Hydra plugin for Github statuses. We can adapt it for Gitea.

For Github:

Get a token at https://github.com/settings/tokens with only the repo:status scope. I'll need the /etc/nixos/secret/ filename.

As the token-generating user will be visible in a commit status, you might consider creating a "nixbld.m-labs.hk" bot account on Github. This user has to have access to the repos.

My findings for services.hydra.extraConfig so far:

<githubstatus>
# Regex:
jobs = artiq:fast-beta:artiq
# Accepts an array:
inputs = artiqSrc
# Context reidentifies subsequent updates (eg. pending -> success)
excludeBuildFromContext = 1
useShortContext = 1
# Get at https://github.com/settings/tokens
authorization = token 0000000000000000000000000000000000000000
</githubstatus>

Example statuses in my current artiq fork: https://github.com/astro/artiq/commits/master

Which Hydra jobs are relevant for the build status of a commit? ----- There's already a Hydra plugin for Github statuses. We can adapt it for Gitea. For Github: Get a token at https://github.com/settings/tokens with only the **repo:status** scope. I'll need the `/etc/nixos/secret/` filename. As the token-generating user will be visible in a commit status, you might consider creating a "nixbld.m-labs.hk" bot account on Github. This user has to have access to the repos. My findings for `services.hydra.extraConfig` so far: ``` <githubstatus> # Regex: jobs = artiq:fast-beta:artiq # Accepts an array: inputs = artiqSrc # Context reidentifies subsequent updates (eg. pending -> success) excludeBuildFromContext = 1 useShortContext = 1 # Get at https://github.com/settings/tokens authorization = token 0000000000000000000000000000000000000000 </githubstatus> ``` Example statuses in my current artiq fork: https://github.com/astro/artiq/commits/master
Poster
Owner
  • artiq:fast:extended-tests -> github artiq
  • artiq:fast-beta:extended-tests -> github artiq
  • artiq:zynq:zc706-hitl-tests -> gitea artiq-zynq
* artiq:fast:extended-tests -> github artiq * artiq:fast-beta:extended-tests -> github artiq * artiq:zynq:zc706-hitl-tests -> gitea artiq-zynq

GiteaStatus plugin upstream PR: https://github.com/NixOS/hydra/pull/849

Would you like this as an additional patch for the hydra config in it-infra?

GiteaStatus plugin upstream PR: https://github.com/NixOS/hydra/pull/849 Would you like this as an additional patch for the hydra config in it-infra?
Poster
Owner

Would you like this as an additional patch for the hydra config in it-infra?

Yes.

> Would you like this as an additional patch for the hydra config in it-infra? Yes.
sb10q closed this issue 2021-01-26 18:17:57 +08:00
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nix-scripts#32
There is no content yet.