func (dr *dropletRunner) BuildDroplet(taskName, dropletName, buildpackUrl string, environment map[string]string, memoryMB, cpuWeight, diskMB int) error { builderConfig := buildpack_app_lifecycle.NewLifecycleBuilderConfig([]string{buildpackUrl}, true, false) action := models.WrapAction(&models.SerialAction{ Actions: []*models.Action{ models.WrapAction(&models.DownloadAction{ From: "http://file-server.service.cf.internal:8080/v1/static/cell-helpers/cell-helpers.tgz", To: "/tmp", User: "******", }), models.WrapAction(&models.DownloadAction{ From: "http://file-server.service.cf.internal:8080/v1/static/buildpack_app_lifecycle/buildpack_app_lifecycle.tgz", To: "/tmp", User: "******", }), dr.blobStore.DownloadAppBitsAction(dropletName), dr.blobStore.DeleteAppBitsAction(dropletName), models.WrapAction(&models.RunAction{ Path: "/bin/chmod", Dir: "/tmp/app", Args: []string{"-R", "a+X", "."}, User: "******", }), models.WrapAction(&models.RunAction{ Path: "/tmp/builder", Dir: "/", Args: builderConfig.Args(), User: "******", }), dr.blobStore.UploadDropletAction(dropletName), dr.blobStore.UploadDropletMetadataAction(dropletName), }, }) environment["CF_STACK"] = DropletStack environment["MEMORY_LIMIT"] = fmt.Sprintf("%dM", memoryMB) proxyConf, err := dr.proxyConfReader.ProxyConf() if err != nil { return err } environment["http_proxy"] = proxyConf.HTTPProxy environment["https_proxy"] = proxyConf.HTTPSProxy environment["no_proxy"] = proxyConf.NoProxy createTaskParams := task_runner.NewCreateTaskParams( action, taskName, DropletRootFS, "lattice", "BUILD", environment, []*models.SecurityGroupRule{}, memoryMB, cpuWeight, diskMB, ) return dr.taskRunner.CreateTask(createTaskParams) }
&models.SecurityGroupRule{ Protocol: models.TCPProtocol, Destinations: []string{"bermuda", "bahamas"}, Ports: []uint32{4242, 5353}, PortRange: &models.PortRange{6666, 7777}, Log: true, }, } createTaskParams = task_runner.NewCreateTaskParams( action, "task-name", "preloaded:my-rootfs", "task-domain", "log-source", map[string]string{ "MaRTY": "BiSHoP", "CoSMo": "CRaMeR", }, securityGroupRules, 128, 100, 0, ) }) It("creates a task", func() { err := taskRunner.CreateTask(createTaskParams) Expect(err).NotTo(HaveOccurred()) Expect(fakeReceptorClient.TasksCallCount()).To(Equal(1))