Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commit message intermittently missing package name #66

Open
tsmalls93 opened this issue Sep 17, 2024 · 9 comments · Fixed by #69
Open

Commit message intermittently missing package name #66

tsmalls93 opened this issue Sep 17, 2024 · 9 comments · Fixed by #69
Labels
bug Something isn't working

Comments

@tsmalls93
Copy link
Contributor

I have noticed on a couple of occasions that the commit message is just "chore(kobold): ". I am not sure of the cause. The issue appears to be intermittent, because often when I re-trigger the webhook it works.

@github-actions github-actions bot added the triage requires review label Sep 17, 2024
@bluebrown
Copy link
Owner

Hi, thanks for reporting. There was a pull request recently regarding to the messages. It was a bit messy. I tried to clean up afterwards but it may have some bugs.

@bluebrown
Copy link
Owner

related code is around here

c := Change{

and here

msg, err = GetCommitMessage(changes)

@bluebrown bluebrown added bug Something isn't working and removed triage requires review labels Sep 25, 2024
@rossigee
Copy link
Contributor

rossigee commented Oct 8, 2024

Maybe related #67

@tsmalls93
Copy link
Contributor Author

Apologies for the delay in response. I have confirmed that this bug is still occurring in 0.4.1.

@bluebrown
Copy link
Owner

Yeah I figured that missing error handle wasnt the cause. Its very unlikely it accually error something like strings.Builder.Write, or what it was.

Does it actually change images when it commits those messages?

@tsmalls93
Copy link
Contributor Author

Yeah, it still updates the images.

@tsmalls93
Copy link
Contributor Author

Unfortunately, it looks like this is still an issue.

Screenshot 2024-12-16 at 9 22 27 AM

@bluebrown bluebrown reopened this Dec 17, 2024
@bluebrown
Copy link
Owner

Can you share the actual image ref? You can anonymize some parts,
but the overall structure would be interesting.

@tsmalls93
Copy link
Contributor Author

Sure. Our repo isn't available to the internet, but the image in this instance was nexus.kub.org/backstage:1.10.1. My pipeline looks like this:

    [[channel]]
    name = "nexus"
    decoder = "kub.nexus@v1"

    [[decoder]]
    name = "kub.nexus@v1"
    script = """
    load("encoding/json.star", "json")

    def main(input):
      data = json.decode(input)
      action = data.get("action", None)
      if action != "CREATED" and action != "UPDATED":
          fail("skipping action: " + action)
      component = data.get("component", None)
      name = component.get("name", None)
      version = component.get("version", None)
      image = "nexus.kub.org/{}:{}".format(name, version)
      output = [image]
      return output
    """

    [[pipeline]]
    name = "argocd-devops"
    repo_uri = "[email protected]:platform/argocd-devops?ref=main"
    dest_branch = "kobold"
    channels = ["nexus"]
    post_hook = "kub.github-pr@v1"

    [[post_hook]]
    name = "kub.github-pr@v1"
    script = """
    load("http.star", "http")

    def main(repo, src_branch, dest_branch, title, body, changes, warnings):
      parts = repo.split("/")
      name = parts[-1]
      owner = parts[-2].split(":")[-1]

      url = "https://github.kub.org/api/v3/repos/" + owner + "/" + name + "/pulls"

      headers = {
          "Accept": "application/vnd.github+json",
          "Authorization": "Bearer " + host_env["GITHUB_TOKEN"],
          "X-GitHub-Api-Version": "2022-11-28",
      }

      data = {"title": title, "body": body, "head": dest_branch, "base": src_branch}

      res = http.post(url, headers = headers, json_body = data)
      if res.status_code != 201:
          print("hook: pr failed: base=" + src_branch + " head=" + dest_branch + " repo=" + repo)
          return res.body()

      print("github pr created: " + res.json()["url"])
      return None
    """

This relevant parts of the webhook payload are as follows:

{
    "action": "CREATED",
    "component": {
        "name": "backstage",
        "version": "1.10.1"
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants