drone-plugins/drone-docker

Target not being observed in GCR

Closed this issue · 6 comments

Looking at the code it seems that we're not getting the PLUGIN_TARGET env var so even if I set this, that configuration is ignored.

Config:

  - name: build-image-web-app
    image: plugins/gcr
    settings:
      registry: us.gcr.io
      dockerfile: dockerfiles/web-app.Dockerfile
      tags:
        - ${DRONE_TAG:-${DRONE_BRANCH}}
      repo: us.gcr.io/magicalbanana/web_app
      target: production
      json_key:
        from_secret: gcr-creds-container-builder-private-key
    depends_on:
      - slack-notification-start-build-images
    when:
      ref:
        - refs/heads/dev
        - refs/heads/master
        - refs/tags/*
      event:
        - tag
        - deployment
        - push

Drone Logs:

+ /usr/local/bin/docker build --rm=true -f dockerfiles/web-app.Dockerfile -t 9ab56e3561ee965121a87b7f44da60f92df9d5a3 . --pull=true --target production --label org.label-schema.schema-version=1.0 --label org.label-schema.build-date=2020-07-09T13:42:39Z --label org.label-schema.vcs-ref=9ab56e3561ee965121a87b7f44da60f92df9d5a3 --label org.label-schema.vcs-url=https://github.com/magicalbanana/web-app-portal.git

please provide a working copy of your yaml so that configuration issues can be ruled out, and so that others can try to reproduce the problem.

also note that PLUGIN_TARGET is read here. The gcr plugin is a small wrapper around the docker plugin and is used to set some extra variables before invoking the docker plugin binary here.

also please provide a copy of the logs (from the Drone user interface) for this step so we can see what Docker commands the plugin are trying to execute.

@ashwilliams1 I just looked at it and it actually does set the --target.

ok great! sounds like target is being set, so I will close the issue. If you have any further questions, lets move the discussion to the support forum at discourse.drone.io.