Avatar is empty for cron builds

#1

The avatar does not show up properly for cron builds. I am running Drone 1.0-rc6 with Gitea 1.7.4. The image src and the column in the builds table is empty.

Also, this is an unrelated issue, but is the total build time supposed to count the time spent waiting for a free agent?

0 Likes

#2

I tested with GitHub and I was unable to reproduce the problem which indicates this is isolated to Gitea. The avatar URL comes from the Gitea API. Have you tested to confirm this is not a problem with the Gitea API returning an empty avatar value?

0 Likes

#3

I had a look at the webhook logs, and the correct avatar is being sent. The correct avatar is also being returned from the API.

Here is an example of this issue: https://drone.geek1011.net/geek1011/drtapi

Build #15 is manually triggered from #6, build #14 is manually triggered from #13, and builds #7-13 are triggered by cron. All builds #6 and after are with 1.0.0-rc6.

Here is the webhook sent for #6:

{
  "secret": "SECRET",
  "ref": "refs/heads/master",
  "before": "c6079b6054471abd1c1c4edc401a42694a705018",
  "after": "08b174dbdb4a7507251f092f1693293006729c84",
  "compare_url": "https://git.geek1011.net/geek1011/drtapi/compare/c6079b6054471abd1c1c4edc401a42694a705018...08b174dbdb4a7507251f092f1693293006729c84",
  "commits": [
    {
      "id": "08b174dbdb4a7507251f092f1693293006729c84",
      "message": "Fixed v2 API index base URL\n",
      "url": "https://git.geek1011.net/geek1011/drtapi/commit/08b174dbdb4a7507251f092f1693293006729c84",
      "author": {
        "name": "Patrick G",
        "email": "geek1011@outlook.com",
        "username": "geek1011"
      },
      "committer": {
        "name": "Patrick G",
        "email": "geek1011@outlook.com",
        "username": "geek1011"
      },
      "verification": null,
      "timestamp": "2019-02-25T00:24:56-05:00"
    }
  ],
  "repository": {
    "id": 76,
    "owner": {
      "id": 1,
      "login": "geek1011",
      "full_name": "Patrick G",
      "email": "geek1011@outlook.com",
      "avatar_url": "https://secure.gravatar.com/avatar/ed92cc217be9a873ae064b39af816962?d=identicon",
      "language": "en-US",
      "username": "geek1011"
    },
    "name": "drtapi",
    "full_name": "geek1011/drtapi",
    "description": "DRT bus information.",
    "empty": false,
    "private": false,
    "fork": false,
    "parent": null,
    "mirror": false,
    "size": 2991,
    "html_url": "https://git.geek1011.net/geek1011/drtapi",
    "ssh_url": "git@git.geek1011.net:geek1011/drtapi.git",
    "clone_url": "https://git.geek1011.net/geek1011/drtapi.git",
    "website": "",
    "stars_count": 1,
    "forks_count": 0,
    "watchers_count": 1,
    "open_issues_count": 0,
    "default_branch": "master",
    "archived": false,
    "created_at": "2017-10-09T11:18:28-04:00",
    "updated_at": "2019-02-25T00:25:05-05:00",
    "permissions": {
      "admin": false,
      "push": false,
      "pull": false
    }
  },
  "pusher": {
    "id": 1,
    "login": "geek1011",
    "full_name": "Patrick G",
    "email": "geek1011@outlook.com",
    "avatar_url": "https://secure.gravatar.com/avatar/ed92cc217be9a873ae064b39af816962?d=identicon",
    "language": "en-US",
    "username": "geek1011"
  },
  "sender": {
    "id": 1,
    "login": "geek1011",
    "full_name": "Patrick G",
    "email": "geek1011@outlook.com",
    "avatar_url": "https://secure.gravatar.com/avatar/ed92cc217be9a873ae064b39af816962?d=identicon",
    "language": "en-US",
    "username": "geek1011"
  }
}

I will test this with a fresh installation when I have more time, probably sometime next week.

Update: Also, the build_author_name column is empty too.

0 Likes

#4

This is not something I can reproduce via GitHub, so I recommend taking a look at the following sections in the Drone codebase to further triage with your Gitea instance:

Happy to accept a patch if you determine there are improvements that can be made to Drone and how it fetches data.

1 Like

#5

It seems the struct is completely wrong:

type commit struct {
    ID string           `json:"id"`
    Sha string          `json:"sha"`
    Message string      `json:"message"`
    URL string          `json:"url"`
    Author signature    `json:"author"`
    Committer signature `json:"committer"`
    Timestamp Time      `json:"timestamp"`
}

type signature struct {
    Name     string `json:"name"`
    Email    string `json:"email"`
    Username string `json:"username"`
}

This is the response for the commits API:

{
  "url": "https://git.geek1011.net/api/v1/repos/geek1011/drtapi/git/commits/08b174dbdb4a7507251f092f1693293006729c84",
  "sha": "08b174dbdb4a7507251f092f1693293006729c84",
  "html_url": "https://git.geek1011.net/geek1011/drtapi/commits/08b174dbdb4a7507251f092f1693293006729c84",
  "commit": {
    "url": "https://git.geek1011.net/api/v1/repos/geek1011/drtapi/git/commits/08b174dbdb4a7507251f092f1693293006729c84",
    "author": {
      "name": "Patrick G",
      "email": "geek1011@outlook.com",
      "date": "2019-02-25T00:24:56-05:00"
    },
    "committer": {
      "name": "Patrick G",
      "email": "geek1011@outlook.com",
      "date": "2019-02-25T00:24:56-05:00"
    },
    "message": "Fixed v2 API index base URL",
    "tree": {
      "url": "https://git.geek1011.net/api/v1/repos/geek1011/drtapi/trees/08b174dbdb4a7507251f092f1693293006729c84",
      "sha": "08b174dbdb4a7507251f092f1693293006729c84"
    }
  },
  "author": {
    "id": 1,
    "login": "geek1011",
    "full_name": "Patrick G",
    "email": "geek1011@outlook.com",
    "avatar_url": "https://secure.gravatar.com/avatar/ed92cc217be9a873ae064b39af816962?d=identicon",
    "language": "en-US",
    "is_admin": true,
    "username": "geek1011"
  },
  "committer": {
    "id": 1,
    "login": "geek1011",
    "full_name": "Patrick G",
    "email": "geek1011@outlook.com",
    "avatar_url": "https://secure.gravatar.com/avatar/ed92cc217be9a873ae064b39af816962?d=identicon",
    "language": "en-US",
    "is_admin": true,
    "username": "geek1011"
  },
  "parents": [
    {
      "url": "https://git.geek1011.net/api/v1/repos/geek1011/drtapi/git/commits/c6079b6054471abd1c1c4edc401a42694a705018",
      "sha": "c6079b6054471abd1c1c4edc401a42694a705018"
    }
  ]
}

It would also explain why the commit message for those builds is empty as well.

The API has not changed since it was added to Drone.

Based on the test data here and here, this was not even supported to begin with. Not all the fields in https://github.com/drone/go-scm/blob/57adc7045a172d3e01b4a25805a60ed5f6033054/scm/git.go#L41 are present.

Note that the commit struct is correct for it’s use in the branches, as this is the API response:

{
  "name": "master",
  "commit": {
    "id": "08b174dbdb4a7507251f092f1693293006729c84",
    "message": "Fixed v2 API index base URL\n",
    "url": "/geek1011/drtapi/commit/08b174dbdb4a7507251f092f1693293006729c84",
    "author": {
      "name": "Patrick G",
      "email": "geek1011@outlook.com",
      "username": "geek1011"
    },
    "committer": {
      "name": "Patrick G",
      "email": "geek1011@outlook.com",
      "username": "geek1011"
    },
    "verification": {
      "verified": true,
      "reason": "Patrick G <geek1011@outlook.com> / A2FD79F68A2AB707",
      "signature": "-----BEGIN PGP SIGNATURE-----\n\niQFJBAABCgAzFiEERXj65TNk2jPRdyBQov159ooqtwcFAlxzfC8VHGdlZWsxMDEx\nQG91dGxvb2suY29tAAoJEKL9efaKKrcHmWQIANeaZ8MaT+TEuYgpDXSAyz0FWIUn\nMYw+cH6K4wzuiOMrT6lap/I/X39lzhdPdqy/c62u5hjGAJp71Rk0Nf/VMzmPD7kF\nqzHTefXAKyqSRNrVI/h3Kx5siHD76mP7GOxAlvLIl0LJ+qnm3SeFkVutqLa0AkMH\nIU2dPbAGo5Gtu6Zl5fCDymv537lBZI3NnD0hmCZZltX0K6hRp6j7O329BJEtAwL/\nqfeT7Pujh/934S4GfMPX+a8E0KWgH9CeI0RQ2TV3zNDOP7EWfy+G7u2m8VxM9Y88\nMNoJobHSBzdMzLzy0DA1vZ2z/AjskZ2LyOS99xG2/8P7BbfeVGPS6srf06s=\n=NvIS\n-----END PGP SIGNATURE-----",
      "payload": "tree c4e2ca5e47fabae60a4e0837036f7493cae1dc2d\nparent c6079b6054471abd1c1c4edc401a42694a705018\nauthor Patrick G <geek1011@outlook.com> 1551072296 -0500\ncommitter Patrick G <geek1011@outlook.com> 1551072296 -0500\n\nFixed v2 API index base URL\n"
    },
    "timestamp": "2019-02-25T00:24:56-05:00",
    "added": null,
    "removed": null,
    "modified": null
  }
}

The Gitea response for a commit signature and a user are different.

I have opened drone/go-scm#19 to fix this issue.

0 Likes

#6

Thanks for taking the time to research and submit a patch.

0 Likes

#7

No problem! It was really bothering me, as it made it harder to scan the list of builds.

Also, what do you think of adding some sort of badge/indicator to cron builds on the list to differentiate them from the other ones? It would make the list a lot more readable compared to looking at the commit hashes of each one.

0 Likes

#8

I recommend proposing via an issue in github.com/drone/drone-ui. This will alert the team responsible for the design to start thinking about potential UX improvements.

1 Like

#9

Are there any plans to merge my PR anytime soon?

0 Likes