drone-plugins / drone-manifest

Drone plugin to push Docker manifests
http://plugins.drone.io/drone-plugins/drone-manifest
Apache License 2.0
16 stars 9 forks source link

Receiving "error in the configuration: both spec and arguments provided: configuration error" #41

Open joe-elliott opened 1 year ago

joe-elliott commented 1 year ago

So this seems to be related to this change:

https://github.com/drone-plugins/drone-manifest/pull/40

Our configuration looks like:

- image: plugins/manifest
  name: manifest-tempo
  settings:
    password:
      from_secret: docker_password
    spec: .drone/docker-manifest.tmpl
    target: tempo
    username:
      from_secret: docker_username

and our template looks like:


image: grafana/{{config.target}}
tags:
  - latest
  - {{build.tags}}
manifests:
  - image: grafana/{{config.target}}:{{build.tags}}-amd64
    platform:
      architecture: amd64
      os: linux
  - image: grafana/{{config.target}}:{{build.tags}}-arm64
    platform:
      architecture: arm64
      os: linux

in particular this condition is causing our issue:

https://github.com/drone-plugins/drone-manifest/blob/af5721dace68ce1cacae7fccdf948efda66da35a/plugin/plugin.go#L167

is it intentional that we can't provide a target and a template? note that we use the target in our template. is there a better way to do that?

donny-dont commented 1 year ago

Hey @joe-elliott so in the 1.4.0 version of this plugin there were two paths. The spec path and the from-args path. If you had a spec path then it would ignore any settings values that from-args would use. For this newer implementation I made it an error when that happened because it isn't clear to the plugin which path it should be taking.

I also stopped the configuration values from being added because a username and password is being provided in it so by having it go into a template file there's potential for those secrets leaking.

Are you using the template multiple times in a pipeline? If not just replace {{config.target}} with tempo. If so we should iterate on a solution for your project.

joe-elliott commented 1 year ago

Yeah, we are using it 3 times:

https://github.com/grafana/tempo/blob/main/.drone/drone.yml#L137-L163

Is there a way to pass in arbitrary key value pairs and build the template off of that? Something like:

- image: plugins/manifest
  name: manifest-tempo
  settings:
    spec: .drone/docker-manifest.tmpl
    templateVals:
      target: tempo
donny-dont commented 1 year ago

Not currently but that's something we can do. @joe-elliott could you pin the manifest plugin at 1.4.0 till this is resolved?

joe-elliott commented 1 year ago

Not currently but that's something we can do. @joe-elliott could you pin the manifest plugin at 1.4.0 till this is resolved?

Can do. Thanks for the quick response @donny-dont