Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.
This repository was archived by the owner on Jan 8, 2024. It is now read-only.

Waypoint panic when release stanza scoped or empty #3759

@rastakajakwanna

Description

@rastakajakwanna

Describe the bug
For demo purposes I wanted to configure Waypoint in a way that it builds and deploys Docker container locally but if the workspace is "stable" it deploys to Kubernetes.

Documentation says:

If no default releaser exists for the deployment platform and no release is configured in the Waypoint project configuration, then each deploy is expected to already be released.

Therefore I would expect my configuration is valid and the Waypoint panic error is an unexpected bug.

Steps to Reproduce

project = "service-demo"

variable "auto_url" {
  default     = false
  type        = bool
  description = "provide automatic url"
}

variable "environment_stage" {
  type        = string
  default     = "staging"
  description = "Environment stage"
}

variable "image_tag_ecr" {
  type        = string
  default     = "develop"
  description = "The tag assigned to built Docker images in ECR."
}

app "service-demo" {
  labels = {
    "service" = "service"
    "type"    = "api"
    "env"     = var.environment_stage
  }

  build {
    use "docker" {}
    registry {
      use "docker" {
        local = true
        image = "service"
        tag   = var.image_tag_ecr
      }
    }
    workspace "stable" {
      use "docker" {}
      registry {
        use "aws-ecr" {
          region     = "us-east-1")
          repository = "service"
          tag        = var.image_tag_ecr
        }
      }
    }
  }

  deploy {
    use "docker" {
      command = [
        "-listen=:8080",
        "-text=\"hello waypoint\""
      ]
      service_port = 8080
      static_environment = {
        WAYPOINT_LOG_LEVEL = "ERROR"
      }
    }

    workspace "stable" {
      use "kubernetes" {
        namespace    = "${var.environment_stage}"
        service_port = 8080
        static_environment = {
          WAYPOINT_LOG_LEVEL = "ERROR"
        }
        pod {
          container {
            args = [
              "-listen=:8080",
              "-text=\"hello waypoint\""
            ]
          }
        }
        memory {
          request = "10Mi"
          limit   = "100Mi"
        }
      }
    }
  }

  url {
    auto_hostname = var.auto_url
  }

  release {
    workspace "stable" {
      use "kubernetes" {
        namespace = "${var.environment_stage}"
        ingress "http" {
          annotations = {
            "kubernetes.io/ingress.class" = "nginx-public"
          }
          host      = "myservice.mycloud"
          path_type = "Prefix"
          path      = "/"
        }
      }
    }
  }
}

Run waypoint up and expect default behavior (build docker image, run docker, release=empty/not_defined and therefore released automatically).

✓ Finished building report for Docker platform
✓ Finished building report for Docker network resource
✓ Finished building report for Docker container resource
✓ All 2 resources are reporting READY

» Releasing raw-data-service-demo...2022-08-30T13:56:47.081+0200 [DEBUG] waypoint.runner: pruning requested, gathering deployments to prune: job_id=01GBQ9RNCV9H6S4C92Q83QGXAQ job_op=*gen.Job_Up retain=2
2022-08-30T13:56:47.375+0200 [DEBUG] waypoint.runner: less than the limit deployments exists, no pruning: job_id=01GBQ9RNCV9H6S4C92Q83QGXAQ job_op=*gen.Job_Up
2022-08-30T13:56:47.375+0200 [INFO]  waypoint.runner: will prune deploys: job_id=01GBQ9RNCV9H6S4C92Q83QGXAQ job_op=*gen.Job_Up len=0
2022-08-30T13:56:47.376+0200 [DEBUG] waypoint.runner.app.raw-data-service-demo: querying artifact: job_id=01GBQ9RNCV9H6S4C92Q83QGXAQ job_op=*gen.Job_Up artifact_id=01GBQ9RT137RE1G914HE9YYHS8
2022-08-30T13:56:47.502+0200 [DEBUG] waypoint.runner.app.raw-data-service-demo: initializing release manager plugin: job_id=01GBQ9RNCV9H6S4C92Q83QGXAQ job_op=*gen.Job_Up
2022-08-30T13:56:47.502+0200 [DEBUG] waypoint.runner: closing project: job_id=01GBQ9RNCV9H6S4C92Q83QGXAQ job_op=*gen.Job_Up
2022-08-30T13:56:47.502+0200 [TRACE] waypoint.runner: closing app: job_id=01GBQ9RNCV9H6S4C92Q83QGXAQ job_op=*gen.Job_Up app=raw-data-service-demo
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x24381ec]

goroutine 44 [running]:
github.com/hashicorp/waypoint/internal/config.(*App).ReleaseUse(0x39f59f0, 0xc000128f91)
	/home/circleci/project/waypoint/internal/config/app.go:337 +0x2c
github.com/hashicorp/waypoint/internal/core.glob..func10(0xc0009e2dc0, 0xc000a2ccd8)
	/home/circleci/project/waypoint/internal/core/component_creator.go:114 +0x1d
github.com/hashicorp/waypoint/internal/core.(*componentCreator).create(0xc0006a8500, {0x39f3300, 0xc0000c9400}, 0xc0007e03c0, 0x1, 0x2dc3ec0)
	/home/circleci/project/waypoint/internal/core/component_creator.go:157 +0x95
github.com/hashicorp/waypoint/internal/core.(*componentCreator).Create(...)
	/home/circleci/project/waypoint/internal/core/component_creator.go:131
github.com/hashicorp/waypoint/internal/core.(*App).createReleaser(0xc0007e03c0, {0x39f3300, 0xc0000c9400}, 0xc000a2ccd8)
	/home/circleci/project/waypoint/internal/core/app_release.go:97 +0xbd
github.com/hashicorp/waypoint/internal/core.(*App).Release(0xc0007e03c0, {0x39f3300, 0xc0000c9400}, 0xc0012d0e00)
	/home/circleci/project/waypoint/internal/core/app_release.go:64 +0x425
github.com/hashicorp/waypoint/internal/runner.(*Runner).executeReleaseOp(0xc000a28240, {0x39f3300, 0xc0000c9400}, {0x3a81510, 0xc0008d6e80}, 0xc0016f50d8, 0xc00085a3c0)
	/home/circleci/project/waypoint/internal/runner/operation_release.go:130 +0x6d9
github.com/hashicorp/waypoint/internal/runner.(*Runner).executeUpOp(0xc000a28240, {0x39f3300, 0xc0000c9400}, {0x3a81510, 0xc0008d6e80}, 0xc000da5080, 0xc000aae280)
	/home/circleci/project/waypoint/internal/runner/operation_up.go:88 +0x725
github.com/hashicorp/waypoint/internal/runner.(*Runner).executeJob(0xc000a28240, {0x39f3300, 0xc0000c9400}, {0x3a81510, 0xc0008d6e80}, {0x3a4a658, 0xc0004166a8}, 0xc000347220, {0xc000078064, 0x24}, ...)
	/home/circleci/project/waypoint/internal/runner/operation.go:327 +0x255e
github.com/hashicorp/waypoint/internal/runner.(*Runner).prepareAndExecuteJob(0xc000921ef8, {0x39f3300, 0xc0000c9400}, {0x3a81510, 0xc0008d6e80}, {0x3a4a658, 0xc0004166a8}, 0xc000021c90, {0x3a4a6b0, 0xc000a18720}, ...)
	/home/circleci/project/waypoint/internal/runner/accept.go:601 +0x9a5
github.com/hashicorp/waypoint/internal/runner.(*Runner).accept(0xc000a28240, {0x39f3300, 0xc0006af940}, {0x0, 0x0})
	/home/circleci/project/waypoint/internal/runner/accept.go:455 +0x1a50
github.com/hashicorp/waypoint/internal/runner.(*Runner).Accept(...)
	/home/circleci/project/waypoint/internal/runner/accept.go:103
github.com/hashicorp/waypoint/internal/runner.(*Runner).AcceptMany(0xc000a28240, {0x39f3300, 0xc0006af940})
	/home/circleci/project/waypoint/internal/runner/accept.go:54 +0x45
github.com/hashicorp/waypoint/internal/client.(*Project).startRunner.func1()
	/home/circleci/project/waypoint/internal/client/runner.go:46 +0x73
created by github.com/hashicorp/waypoint/internal/client.(*Project).startRunner
	/home/circleci/project/waypoint/internal/client/runner.go:44 +0x23d

Waypoint status

waypoint status -app=service-demo
Current status for application "service-demo" in project "service-demo" in server context
"waypoint.myservice.mycloud:9701".

» Application Summary
APP                  	WORKSPACE	DEPLOYMENT STATUS	DEPLOYMENT CHECKED	RELEASE STATUS	RELEASE CHECKED 
service-demo	default  	✔ READY          	1 hour ago        	N/A           	               	


» Deployment Summary
APP NAME             	VERSION	WORKSPACE	PLATFORM	ARTIFACT	LIFECYCLE STATE	INSTANCES COUNT 
service-demo	v2     	default  	docker  	id:2    	SUCCESS        	0              	


» Deployment Resources Summary
TYPE     	NAME                                            	PLATFORM	HEALTH	TIME CREATED 
container	service-demo-01GBQ9RTZ56X13J81ZFZFD9EBB	docker  	READY 	1 hour ago  	
network  	waypoint                                        	docker  	READY 	1 hour ago  	

Expected behavior
No panic error.

Waypoint Platform Versions
Additional version and platform information to help triage the issue if
applicable:

  • Waypoint CLI Version: 0.9.0 - 0.9.1
  • Waypoint Server Platform and Version: 0.9.0 - 0.9.1
Client: Docker Engine - Community
 Version:           20.10.16
 API version:       1.41
 Go version:        go1.17.10
 Git commit:        aa7e414
 Built:             Thu May 12 09:17:39 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.16
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.10
  Git commit:       f756502
  Built:            Thu May 12 09:15:42 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.4
  GitCommit:        212e8b6fa2f44b9c21b2798135fc6fb7c53efc16
 runc:
  Version:          1.1.1
  GitCommit:        v1.1.1-0-g52de29d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
  • Waypoint Plugin: docker

Additional context
No additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions