Github webhook unmarshall error


The past few days Github webhook parsing fails sometimes with errors like:

  • Cannot unmarshal '76058828' of type int into a string value
  • Cannot unmarshal '7.615998e+06' of type float64 into a string value

where the number is the commit hash’s first few characters.

This happend at the start of the pipeline, nothing is executed.

I start my investigation now, just sharing this maybe others see this too. I’m suspecting a Github format change?

Ran the tests in src/ with my webhook payload. The Github webhook parsing worked.

Found the error template
return fmt.Errorf("Cannot unmarshal '%v' to type %T into a string value", name, name)

I fear the error is coming form the layer where Drone tries to create Docker volumes/networks etc.

Geez, could it be that if a hash starts with numbers only something parses it as int instead of a string. Probably in libcompose.

Will keep an eye out for hashes that start with a long number sequence (without characters).

Btw, libcompose is deprecated

I presume this is for Drone 0.8 because Drone 1.0 does not use libcompose? I would recommend upgrading to 1.0. If you can reproduce this problem in 1.0 let me know and I can investigate further.

1 Like

Thanks for reply.

I think I figured it out.

      BRANCH: ${DRONE_BRANCH//\//-}
      SHA: ${DRONE_COMMIT_SHA:0:8}

The SHA variable needs to be quoted :slight_smile: