Conversation
| } | ||
|
|
||
| fmt.Printf("Starting sleep: %v\n", time.Now().Unix()) | ||
| time.Sleep(180 * time.Second) |
There was a problem hiding this comment.
I should probably alter this to just poll on the static IP I provide until it's available. This was a quick hack to fix an issue I had noticed around an agent getting assigned at times +1 builds.
There was a problem hiding this comment.
yes this should use polling, which is how we handle this for the other providers. You can use this example as reference https://github.com/drone/autoscaler/blob/master/drivers/amazon/create.go#L122:L175
| Msg("cannot terminate instance") | ||
| return err | ||
| } | ||
| return nil |
There was a problem hiding this comment.
I noticed lines 44-51 and 60-67 look to be the same
| if err != nil { | ||
| logger.Error(). | ||
| Err(err). | ||
| Msg("cannot terminate instance") | ||
| return err | ||
| } |
There was a problem hiding this comment.
this error is already handled at line 46
| } | ||
|
|
||
| // CreatePublicIP creates a new public IP | ||
| func (p *provider) createPublicIP(ctx context.Context, ipName string) (ip network.PublicIPAddress, err error) { |
There was a problem hiding this comment.
is creating a static public IP necessary? can we just use the ephemeral public IP address associated with the instance? This is what we do for other cloud providers.
| runner config.Runner | ||
| labels map[string]string | ||
| dockerUsername string | ||
| dockerPassword string |
There was a problem hiding this comment.
these changes can be removed. We have a separate PR that is proposing this change
There was a problem hiding this comment.
Yea I proposed that PR 😄 . I'll remove these from this PR
|
|
||
| [[override]] | ||
| name = "github.com/Azure/go-autorest" | ||
| version = "13.0.0" |
There was a problem hiding this comment.
the Gopkg files were removed and replaced with go.mod files. You may want to sync up your codebase with the latest version
| "github.com/drone/autoscaler" | ||
| "github.com/rs/zerolog/log" | ||
| "fmt" | ||
| "time" |
There was a problem hiding this comment.
best practice for import ordering https://github.com/golang/go/wiki/CodeReviewComments#imports
|
|
||
| func (p *provider) computeMachineRequest(ctx context.Context, base string, opts autoscaler.InstanceCreateOpts) (compute.VirtualMachine, *string, error) { | ||
| buf := new(bytes.Buffer) | ||
| err := p.userdata.Execute(buf, &opts) |
|
thanks for submitting the pull request. I have added some comments about specific sections of code. I also recommend taking a look at AWS or GCP and trying to more closely mirror the structure and conventions (logging, polling, functions, etc). For example, you will notice we have very detailed logging in the other providers. |
| *.env | ||
| *# | ||
| *.#* | ||
| *~ No newline at end of file |
There was a problem hiding this comment.
what are these lines for?
There was a problem hiding this comment.
these should be removed and added to your global .gitignore file or in .git/info/exclude
| return nil, err | ||
| } | ||
|
|
||
| azureInstance, err := future.Result(client) |
| } | ||
|
|
||
| azureInstance, err := future.Result(client) | ||
| client.Start(ctx, p.resourceGroup, p.vmName) |
There was a problem hiding this comment.
does start return any parameters? if it returns an error it needs to be handled
| return nil, err | ||
| } | ||
|
|
||
| fmt.Printf("Starting sleep: %v\n", time.Now().Unix()) |
There was a problem hiding this comment.
use logger instead of fmt.Print or println
No description provided.