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

tags setting/.tags file ignored in manifest mode #32

Open kylewallpe opened 2 years ago

kylewallpe commented 2 years ago

The docs for the manifest plugin list tags as an optional setting for manifest (not spec) mode. And in spec mode, a .tags file is read, and populates tags.

My expectation would be that either of these would add onto the list of tags specified by the target setting in manifest mode. However, it seems both tags setting and .tags file are ignored in manifest mode.

Example sanitized .drone.yml:

---
kind: pipeline
type: docker
name: publish amd64 image

# default autoscaler node is arm64

steps:
  - name: publish app image
    image: plugins/docker
    settings:
      dockerfile: Dockerfile
      registry: our.private.registry
      repo: our.private.registry/this-thing
      tags:
        - build-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}-${DRONE_BUILD_NUMBER}

depends_on: []

---
kind: pipeline
type: docker
name: publish arm64 image

node:
  arch: arm64
platform:
  os: linux
  arch: arm64

steps:
steps:
  - name: publish app image
    image: plugins/docker
    settings:
      dockerfile: Dockerfile
      registry: our.private.registry
      repo: our.private.registry/this-thing
      tags:
        - build-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}-${DRONE_BUILD_NUMBER}

depends_on: []

---
kind: pipeline
type: docker
name: publish manifest

# default autoscaler node is arm64

steps:
  - name: publish
    image: plugins/manifest
    settings:
      target: our.private.registry/this-thing:build-${DRONE_BUILD_NUMBER}
      template: our.private.registry/this-thing:build-OS-ARCH-${DRONE_BUILD_NUMBER}
      tags:
        - latest-${DRONE_BRANCH//\//-}
        - ${DRONE_COMMIT_SHA:0:8}
      platforms:
        - linux/arm64
        - linux/amd64

depends_on:
  - publish amd64 image
  - publish arm64 image

I’ve also tried generating a .tags file for the publish manifest.publish step. The results are the same either way:

latest: Pulling from plugins/manifest
Digest: sha256:...
Status: Image is up to date for plugins/manifest:latest
2022/06/22 16:47:14 pushing our.private.registry/this-thing:build-OS-ARCH-33 to our.private.registry/this-thing:build-33 linux/arm64, linux/amd64
Digest: sha256:... ...

The additional tags are not pushed to our docker registry.

Originally posted at https://community.harness.io/t/manifest-plugin-tags-setting-tags-file-have-no-effect/12178

tphoney commented 2 years ago

Hey @kylewallpe from looking at the logic of the plugin, if autotag is true, then user set tags are ignored. drone-manifest/main.go at 92722b712a4a378262ca8f3e39e34248646c8a7b · drone-plugins/drone-manifest · GitHub Can you confirm

kylewallpe commented 1 year ago

Hi @tphoney. According to the docs, auto_tags defaults to false anyway. But even with both auto_tags and default_tags explicitly set to false in the pipeline definition, the behavior is the same.