Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error creating instance - Hostname too long #536

Closed
jonpas opened this issue Aug 26, 2022 · 9 comments · Fixed by #538 or #549
Closed

Error creating instance - Hostname too long #536

jonpas opened this issue Aug 26, 2022 · 9 comments · Fixed by #538 or #549
Labels

Comments

@jonpas
Copy link

jonpas commented Aug 26, 2022

v5.2.0+ creates runner instances with very long names, eg. runner-2stajshg-gitlab-runner-beefy-docker-machine-1661510762-2a25d6d4 (where gitlab-runner-beefy is our environment name). This causes the instances to fail to create with the following errors in CloudWatch:

Aug 26 10:46:31 ip-10-63-101-56 gitlab-runner: {
    "driver": "amazonec2",
    "level": "error",
    "msg": "Error creating machine: Error running provisioning: ssh command error:",
    "name": "runner-2stajshg-gitlab-runner-beefy-docker-machine-1661510762-2a25d6d4",
    "operation": "create",
    "time": "2022-08-26T10:46:31Z"
}

Aug 26 10:46:31 ip-10-63-101-56 gitlab-runner: {
    "driver": "amazonec2",
    "level": "error",
    "msg": "command : sudo hostname runner-2stajshg-gitlab-runner-beefy-docker-machine-1661510762-2a25d6d4 && echo \"runner-2stajshg-gitlab-runner-beefy-docker-machine-1661510762-2a25d6d4\" | sudo tee /etc/hostname",
    "name": "runner-2stajshg-gitlab-runner-beefy-docker-machine-1661510762-2a25d6d4",
    "operation": "create",
    "time": "2022-08-26T10:46:31Z"
}

Aug 26 10:46:31 ip-10-63-101-56 gitlab-runner: {
    "driver": "amazonec2",
    "level": "error",
    "msg": "err     : exit status 1",
    "name": "runner-2stajshg-gitlab-runner-beefy-docker-machine-1661510762-2a25d6d4",
    "operation": "create",
    "time": "2022-08-26T10:46:31Z"
}

Aug 26 10:46:31 ip-10-63-101-56 gitlab-runner: {
    "driver": "amazonec2",
    "level": "error",
    "msg": "output  : hostname: name too long",
    "name": "runner-2stajshg-gitlab-runner-beefy-docker-machine-1661510762-2a25d6d4",
    "operation": "create",
    "time": "2022-08-26T10:46:31Z"
}
@kayman-mk
Copy link
Collaborator

Same problem here. Tried the update today and it failed.

@macnibblet
Copy link

Same here, have managed to figure out how to solve it? I tried downgrading but an older version but that didn't help.

@kayman-mk
Copy link
Collaborator

No solution so far. Downgrading to 5.1.0 worked here. Using shorter hostnames is also not working. The machine is created and dies seconds later.

@kayman-mk
Copy link
Collaborator

kayman-mk commented Sep 1, 2022

Hmm, strange. Shortening the hostname works now.

  overrides = {
    name_sg                     = ""
    name_iam_objects            = ""
    name_runner_agent_instance  = "Gitlab-Agent-TEST-${local.gitlab_test_subnet.availability_zone}"
    name_docker_machine_runners = "TEST"
  }

Setting a short value for name_docker_machine_runners does the job.

@kayman-mk
Copy link
Collaborator

Did some analysis on one of my runners:

  • maximum hostname length is 64 characters
  • the default name set by the docker machine driver is 35 characters long

Thus the maximum user defined part of the hostname is 64-35-1=28 characters (-1 as we loose one character for a hyphen to separate our name from the one added by the docker machine driver).

Example:

  overrides = {
    name_sg                     = ""
    name_iam_objects            = ""
    name_runner_agent_instance  = "Gitlab-Agent-TEST-${local.gitlab_test_subnet.availability_zone}"
    name_docker_machine_runners = "TEST"
  }

The runners are named like runner-TEST-2345014313-f7a3debe

@nathan-gilbert
Copy link

Bumping into this problem today. Anyone know when the fix will be released?

@toxinu
Copy link

toxinu commented Sep 19, 2022

Same problem here.

@bishtawi
Copy link
Contributor

I am running into this bug too. For now I've downgraded to 5.1.0 which fixed the problem.

@semantic-releaser
Copy link
Contributor

🎉 This issue has been resolved in version 5.3.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants