drop datacenter config as it is ignored by the api anyway
All checks were successful
Pipeline was successful
All checks were successful
Pipeline was successful
This commit is contained in:
parent
6a63daab73
commit
41c9abbe3a
@ -20,8 +20,7 @@ type Config = struct {
|
|||||||
WoodpeckerAgentVersion string `default:"latest" env:"WOODPECKER_AUTOSCALER_WOODPECKER_AGENT_VERSION"`
|
WoodpeckerAgentVersion string `default:"latest" env:"WOODPECKER_AUTOSCALER_WOODPECKER_AGENT_VERSION"`
|
||||||
HcloudToken string `default:"" env:"WOODPECKER_AUTOSCALER_HCLOUD_TOKEN"`
|
HcloudToken string `default:"" env:"WOODPECKER_AUTOSCALER_HCLOUD_TOKEN"`
|
||||||
HcloudInstanceType string `default:"cpx21" env:"WOODPECKER_AUTOSCALER_HCLOUD_INSTANCE_TYPE"`
|
HcloudInstanceType string `default:"cpx21" env:"WOODPECKER_AUTOSCALER_HCLOUD_INSTANCE_TYPE"`
|
||||||
HcloudRegion string `default:"" env:"WOODPECKER_AUTOSCALER_HCLOUD_REGION"`
|
HcloudLocation string `default:"" env:"WOODPECKER_AUTOSCALER_HCLOUD_LOCATION"`
|
||||||
HcloudDatacenter string `default:"" env:"WOODPECKER_AUTOSCALER_HCLOUD_DATACENTER"`
|
|
||||||
HcloudSSHKeys string `default:"" env:"WOODPECKER_AUTOSCALER_HCLOUD_SSH_KEYS"`
|
HcloudSSHKeys string `default:"" env:"WOODPECKER_AUTOSCALER_HCLOUD_SSH_KEYS"`
|
||||||
HcloudIPv6Only bool `default:"false" env:"WOODPECKER_AUTOSCALER_HCLOUD_IPV6_ONLY"`
|
HcloudIPv6Only bool `default:"false" env:"WOODPECKER_AUTOSCALER_HCLOUD_IPV6_ONLY"`
|
||||||
}
|
}
|
||||||
|
@ -83,12 +83,10 @@ func CreateNewAgent(cfg *config.Config) (*hcloud.Server, error) {
|
|||||||
}
|
}
|
||||||
img, _, err := client.Image.GetByNameAndArchitecture(context.Background(), "docker-ce", "x86")
|
img, _, err := client.Image.GetByNameAndArchitecture(context.Background(), "docker-ce", "x86")
|
||||||
utils.CheckError(err, "GetImageByNameAndArchitecture")
|
utils.CheckError(err, "GetImageByNameAndArchitecture")
|
||||||
loc, _, err := client.Location.GetByName(context.Background(), cfg.HcloudRegion)
|
loc, _, err := client.Location.GetByName(context.Background(), cfg.HcloudLocation)
|
||||||
utils.CheckError(err, "GetRegionByName")
|
utils.CheckError(err, "GetRegionByName")
|
||||||
pln, _, err := client.ServerType.GetByName(context.Background(), cfg.HcloudInstanceType)
|
pln, _, err := client.ServerType.GetByName(context.Background(), cfg.HcloudInstanceType)
|
||||||
utils.CheckError(err, "GetServerTypeByName")
|
utils.CheckError(err, "GetServerTypeByName")
|
||||||
dc, _, err := client.Datacenter.GetByName(context.Background(), cfg.HcloudDatacenter)
|
|
||||||
utils.CheckError(err, "GetDatacenterByName")
|
|
||||||
labels := map[string]string{}
|
labels := map[string]string{}
|
||||||
labels["Role"] = "WoodpeckerAgent"
|
labels["Role"] = "WoodpeckerAgent"
|
||||||
labels["ControledBy"] = "WoodpeckerAutoscaler"
|
labels["ControledBy"] = "WoodpeckerAutoscaler"
|
||||||
@ -104,7 +102,6 @@ func CreateNewAgent(cfg *config.Config) (*hcloud.Server, error) {
|
|||||||
Image: img,
|
Image: img,
|
||||||
SSHKeys: keys,
|
SSHKeys: keys,
|
||||||
Location: loc,
|
Location: loc,
|
||||||
Datacenter: dc,
|
|
||||||
UserData: userdata,
|
UserData: userdata,
|
||||||
StartAfterCreate: utils.BoolPointer(true),
|
StartAfterCreate: utils.BoolPointer(true),
|
||||||
Labels: labels,
|
Labels: labels,
|
||||||
|
@ -19,8 +19,7 @@ func TestGenerateUserData(t *testing.T) {
|
|||||||
WoodpeckerAgentVersion: "latest",
|
WoodpeckerAgentVersion: "latest",
|
||||||
HcloudToken: "EvenMoreGeheim1!",
|
HcloudToken: "EvenMoreGeheim1!",
|
||||||
HcloudInstanceType: "cpx21",
|
HcloudInstanceType: "cpx21",
|
||||||
HcloudRegion: "eu-central",
|
HcloudLocation: "fsn1",
|
||||||
HcloudDatacenter: "fsn1-dc14",
|
|
||||||
HcloudSSHKeys: "test-key",
|
HcloudSSHKeys: "test-key",
|
||||||
}
|
}
|
||||||
wanted := `
|
wanted := `
|
||||||
|
Loading…
Reference in New Issue
Block a user