hashicorp / waypoint

A tool to build, deploy, and release any application on any platform.
https://waypointproject.io
Other
4.76k stars 327 forks source link

Build with aws-ecr-pull requiring docker.AccessInfo due to no registry stanza with remote runner #4896

Open magickatt opened 1 year ago

magickatt commented 1 year ago

Describe the bug

Have had this working previously (unsure how to replicate) with a Runner on the same EKS cluster as the Server, but am running into an issue trying to build using the aws-ecr-pull plugin whereby it will not work without a registry stanza, which from documentation should not be required since the image is never being built or pushed?

https://github.com/hashicorp/waypoint/pull/3396 shows an example with no registry stanza. But not including it results in

» Building test...
✓ Running build v2
! There was an error while executing a Waypoint plugin for this operation!

  One or more required arguments for the plugin was not satisfied. This is usually
  due to a missing or incompatible set of plugins. For example, only certain build
  plugins are only compatible with certain registries, and so on. Please inspect
  the missing argument, the set of plugins you are using, and the documentation to
  determine if your plugin combination is valid.

  Plugin function:
  github.com/hashicorp/waypoint/builtin/aws/ecr/pull.(*Builder).BuildODR-fm

  ==> Missing arguments:

      - docker.AccessInfo

Steps to Reproduce

waypoint.hcl

project = "examples"

variable "tag" {
  type    = string
  description = "Git tag"
}

app "test" {
  runner {
    profile = "kubernetes-${workspace.name}"
  }

  build {
    use "aws-ecr-pull" {
      region             = "us-east-1"
      repository         = "test"
      tag                = var.tag
      disable_entrypoint = true
    }
  }

  deploy { 
    use "helm" {
      name  = app.name
      chart = "${path.app}/chart"
      set {
        name  = "environment"
        value = "${workspace.name}"
      }
      set {
        name  = "image.tag"
        value = var.tag
      }
    }
  }
}

Expected behavior Build should work without a registry stanza, or it should be possible to supply a null registry stanza as per comment https://github.com/hashicorp/waypoint/issues/3328#issuecomment-1130181491

Waypoint Platform Versions

Additional context

Failing command is waypoint up -w=development -var=tag=0.0.7 -p=examples -local=false (same error happens when running for Production)

Runners are configured using an On-Demand Runner installed on the control cluster using Helm, and Development and Production Runners installed using waypoint runner install

$ waypoint runner list
              ID             |   STATE    |  KIND  |          LABELS          | LAST REGISTERED
-----------------------------+------------+--------+--------------------------+------------------
  production                 | adopted    | remote | environment:production   | 28 minutes ago
  development                | adopted    | remote | environment:development  | 29 minutes ago
  DVJLFQLAOERHBUBGTAQTXRZYFU | preadopted | remote |                          | 16 minutes ago

$ waypoint runner profile list
Runner profiles
             NAME            | PLUGIN TYPE |                 OCI URL                 |         TARGET RUNNER          | DEFAULT
-----------------------------+-------------+-----------------------------------------+--------------------------------+----------
  DVJLFQLAOERHBUBGTAQTXRZYFU | kubernetes  | docker.io/hashicorp/waypoint-odr:0.11.3 | *                              | yes
  kubernetes-development     | kubernetes  | hashicorp/waypoint-odr:latest           | labels:                        |
                             |             |                                         | {"environment":"development"}  |
  kubernetes-production      | kubernetes  | hashicorp/waypoint-odr:latest           | labels:                        |
                             |             |                                         | {"environment":"production"}   |
magickatt commented 1 year ago

Been investigating this further and noticed the following quote from the Registry documentation

A registry is required unless using the Docker build plugin via a CLI runner. This is not the common case, and thusly almost always a registry stanza should be used.

https://developer.hashicorp.com/waypoint/docs/waypoint-hcl/registry

But surely this isn't true for either aws-ecr-pull or docker-pull since they will often be used in situations where the image is not pushed back? (based on the example waypoint.hcl snippets provided for both)

thangnc commented 1 year ago

i ran into the same issue with aws-ecr-pull for build and aws-ecs deploy. I have to hack by add registry aws-ecs stanza but this caused re-pushing image on ECR