drop datacenter config as it is ignored by the api anyway
All checks were successful
Pipeline was successful

This commit is contained in:
Tobias Trabelsi 2023-11-10 21:27:19 +01:00
parent 6a63daab73
commit 41c9abbe3a
Signed by: lerentis
GPG Key ID: FF0C2839718CAF2E
3 changed files with 3 additions and 8 deletions

View File

@ -20,8 +20,7 @@ type Config = struct {
WoodpeckerAgentVersion string `default:"latest" env:"WOODPECKER_AUTOSCALER_WOODPECKER_AGENT_VERSION"`
HcloudToken string `default:"" env:"WOODPECKER_AUTOSCALER_HCLOUD_TOKEN"`
HcloudInstanceType string `default:"cpx21" env:"WOODPECKER_AUTOSCALER_HCLOUD_INSTANCE_TYPE"`
HcloudRegion string `default:"" env:"WOODPECKER_AUTOSCALER_HCLOUD_REGION"`
HcloudDatacenter string `default:"" env:"WOODPECKER_AUTOSCALER_HCLOUD_DATACENTER"`
HcloudLocation string `default:"" env:"WOODPECKER_AUTOSCALER_HCLOUD_LOCATION"`
HcloudSSHKeys string `default:"" env:"WOODPECKER_AUTOSCALER_HCLOUD_SSH_KEYS"`
HcloudIPv6Only bool `default:"false" env:"WOODPECKER_AUTOSCALER_HCLOUD_IPV6_ONLY"`
}

View File

@ -83,12 +83,10 @@ func CreateNewAgent(cfg *config.Config) (*hcloud.Server, error) {
}
img, _, err := client.Image.GetByNameAndArchitecture(context.Background(), "docker-ce", "x86")
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")
pln, _, err := client.ServerType.GetByName(context.Background(), cfg.HcloudInstanceType)
utils.CheckError(err, "GetServerTypeByName")
dc, _, err := client.Datacenter.GetByName(context.Background(), cfg.HcloudDatacenter)
utils.CheckError(err, "GetDatacenterByName")
labels := map[string]string{}
labels["Role"] = "WoodpeckerAgent"
labels["ControledBy"] = "WoodpeckerAutoscaler"
@ -104,7 +102,6 @@ func CreateNewAgent(cfg *config.Config) (*hcloud.Server, error) {
Image: img,
SSHKeys: keys,
Location: loc,
Datacenter: dc,
UserData: userdata,
StartAfterCreate: utils.BoolPointer(true),
Labels: labels,

View File

@ -19,8 +19,7 @@ func TestGenerateUserData(t *testing.T) {
WoodpeckerAgentVersion: "latest",
HcloudToken: "EvenMoreGeheim1!",
HcloudInstanceType: "cpx21",
HcloudRegion: "eu-central",
HcloudDatacenter: "fsn1-dc14",
HcloudLocation: "fsn1",
HcloudSSHKeys: "test-key",
}
wanted := `