openzipkin / zipkin-gcp

Reporters and collectors for use in Google Cloud Platform
https://cloud.google.com/trace/docs/zipkin
Apache License 2.0
91 stars 54 forks source link

Add Docker Hub test hook to run Zipkin GCP with credential #159

Closed saturnism closed 4 years ago

saturnism commented 4 years ago

Final piece for #130

codefromthecrypt commented 4 years ago

maybe add a link to the docker hub build for convenience?

anuraaga commented 4 years ago

Thanks for working on this! I forgot it's often annoying loading a service account in CI since GOOGLE_APPLICATION_CREDENTIALS must be a path to a file - maybe motivation to update google-auth libraries to fallback to JSON parsing when the environment variable doesn't resolve to a real file? ;)

Anyways, if possible we should avoid overriding the test hook and use the same docker-compose.test.yml format / command as our upstream tests.

https://github.com/openzipkin/zipkin/blob/master/docker/docker-compose.test.yml

Using a volume, I think this can be relatively simple - this compose shows a service account on my machine. Can you try using something like this?

version: "3.6"
volumes:
  gcp-service-account:
services:
  extract-service-account:
    image: busybox
    volumes:
      - gcp-service-account:/credentials:rw
    command: sh -c 'echo $GOOGLE_APPLICATION_CREDENTIALS_BASE64 | base64 -d > /credentials/service-account-key.json'
    environment:
      - GOOGLE_APPLICATION_CREDENTIALS_BASE64
  show-service-account:
    image: busybox
    volumes:
      - gcp-service-account:/credentials:ro
    command: sh -c 'cat /credentials/service-account-key.json'
    depends_on:
      - extract-service-account
saturnism commented 4 years ago

maybe add a link to the docker hub build for convenience?

Will do once something is running successfully; it's in a private docker hub repository atm just in case i did something wrong w/ the credentials.

saturnism commented 4 years ago

Thanks for working on this! I forgot it's often annoying loading a service account in CI since GOOGLE_APPLICATION_CREDENTIALS must be a path to a file - maybe motivation to update google-auth libraries to fallback to JSON parsing

I have seen quite a few use cases and requests that this would benefit :( /cc @chingor13

avoid overriding the test hook and use the same docker-compose.test.yml format / command as our upstream tests.

This is is great info! Will give this a try.

saturnism commented 4 years ago

@anuraaga the docker compose hook was much easier indeed. thanks!

saturnism commented 4 years ago

Docker test is passing now:

https://cloud.docker.com/repository/registry-1.docker.io/saturnism/zipkin-gcp/builds/a5640777-a3cc-4ad3-a0a5-e3ab72fdbde0

I feel this is ready to go.

saturnism commented 4 years ago

I've added the env var w/ the credential key into openzipkin/zipkin-gcp auto build configuration.