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

Breaking Change: Migrate to v7 #819

Closed
2 tasks done
kayman-mk opened this issue Apr 27, 2023 · 14 comments · Fixed by #723
Closed
2 tasks done

Breaking Change: Migrate to v7 #819

kayman-mk opened this issue Apr 27, 2023 · 14 comments · Fixed by #723
Labels
enhancement 🆕 New feature or request

Comments

@kayman-mk
Copy link
Collaborator

kayman-mk commented Apr 27, 2023

I will add some information on how to migrate to the new version in the next days. Still some time to go and not 100% discussed internally.

ToDo:

Major Version 7

Main reasons

  • harmonize the variable names
  • harmonize the documentation
  • remove deprecated variables
  • gain a better overview of the features provided
  • upgrade to Terraform 1.3+ for optional variables in maps

Feature added

  • all possible Docker settings
  • idle_scale_factor

Migration

We know that this is a breaking change causing some pain, but we think it is worth it. We hope you agree. And to make the
transition as smooth as possible, we have added a migration script. It will cover almost all cases, but some minor rework might still be possible.

Steps to follow:

  1. copy your module call in a separate file
  2. remove all comments. They might cause problems
  3. run the migration script on this file
  4. fix minor bugs in the output manually
  5. sort the variable for a clean module call
@kayman-mk kayman-mk added the enhancement 🆕 New feature or request label Apr 27, 2023
@kayman-mk kayman-mk pinned this issue Apr 29, 2023
kayman-mk added a commit that referenced this issue Jun 5, 2023
## Description

This PR adds the `wait_for_services_timeout` docker setting for the
executor (see
https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnersdocker-section).

I've found #513 while looking for a solution to our problem. After
migrating from the Kubernetes executer to the docker-machine executer,
we have had a couple of Gitlab jobs that are always waiting 30s before
actually running the defined steps.

I am aware of #819 but I believe this might be a quick win.

## Migrations required

 NO

## Test the change

In order to test my change, I recommend to set
```hcl
  debug = { "output_runner_config_to_file": true, "output_runner_user_data_to_file": false }
```

and then run `terraform plan`.

It will print the locally rendered `config.toml` that now contains the
new setting:
```
[...]
  pre_clone_script = ""
  request_concurrency = 1
  output_limit = 4096
  limit = 0
  wait_for_services_timeout = 30
[...]
```

---------

Co-authored-by: Matthias Kay <[email protected]>
@github-actions
Copy link
Contributor

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days.

@github-actions github-actions bot added the stale Issue/PR is stale and closed automatically label Aug 21, 2023
@kayman-mk kayman-mk removed the stale Issue/PR is stale and closed automatically label Aug 31, 2023
@kayman-mk
Copy link
Collaborator Author

@npalm Can we go ahead with this one?

@npalm
Copy link
Collaborator

npalm commented Sep 5, 2023

NO objection

@kayman-mk
Copy link
Collaborator Author

Great, I will release the changes on Sunday, September 10th at 1900z

@kayman-mk
Copy link
Collaborator Author

Changes have been released on Sunday. Will closely monitor the issues here within this week.

@kayman-mk
Copy link
Collaborator Author

❗ Just found out that the conversion script has a bug. Please check the instance type of the Runner Worker machines. I guess they are all m5.large (the module default).

See #975

@kayman-mk kayman-mk changed the title Breaking Change Ahead: Version 7 Breaking Change: Migrate to v7 Oct 5, 2023
@ryancausey
Copy link
Contributor

I have tried to migrate to the newer v7.x series of this module, but I am running into issues where my runners no longer register with GitLab. As far as I can tell from applying the configuration, there were no changes required to the actual resources. Can someone look at the v6.5.1 config vs the v7.1.0 one and tell me if I misplaced some config value? As far as I can tell they are equivalent:

v6.5.1

module "runner" {
  source  = "npalm/gitlab-runner/aws"
  version = "6.5.1"

  aws_region = var.aws_region
  # We need to override the environment name to be less than 64 characters in length.
  #
  # The module code uses the environment name + some postfix string by default, so we
  # use that limited to a max length of 21 to allow for postfix string lengths.
  environment = substr(var.environment_name, 0, 21)

  # To allow the runner to access the internet without requiring a NAT gateway, we must
  # give them a public IP.
  runners_use_private_address = false
  enable_eip                  = true

  vpc_id                                = data.aws_vpc.main.id
  subnet_ids_gitlab_runner              = data.aws_subnets.public_subnet_ids.ids
  subnet_id_runners                     = data.aws_subnets.public_subnet_ids.ids[0]
  extra_security_group_ids_runner_agent = [data.aws_security_group.rds.id]
  enable_cloudwatch_logging             = false
  cache_bucket_set_random_suffix        = true

  # This has the jobs run on the same EC2 instance as the agent, no autoscaling is used.
  runners_executor   = "docker"
  runners_name       = "django-project-${var.environment_name}"
  runners_gitlab_url = "https://gitlab.com"

  gitlab_runner_registration_config = {
    registration_token = var.runner_token
    tag_list           = join(", ", var.runner_tags)
    description        = "Ephemeral runner for the project."
    locked_to_project  = "true"
    run_untagged       = "false"
    maximum_timeout    = "3600"
  }

  # Buff our runner instance size since we aren't using the docker+machine. This means
  # the jobs run directly on a runner, so a t3.micro instance might not cut it.
  instance_type = "m5.large"

  gitlab_runner_version = "15.11.0"

  # Allow SSM access to help debug if runner issues arise.
  enable_runner_ssm_access = true
}

v7.1.0

module "runner" {
  source  = "npalm/gitlab-runner/aws"
  version = "7.1.0"

  # We need to override the environment name to be less than 64 characters in length.
  #
  # The module code uses the environment name + some postfix string by default, so we
  # use that limited to a max length of 21 to allow for postfix string lengths.
  environment = substr(var.environment_name, 0, 21)

  vpc_id    = data.aws_vpc.main.id
  subnet_id = data.aws_subnets.public_subnet_ids.ids[0]

  runner_gitlab_registration_config = {
    registration_token = var.runner_token
    description        = "Ephemeral runner for the project."
    locked_to_project  = "true"
    run_untagged       = "false"
    maximum_timeout    = "3600"
  }

  runner_instance = {
    # Buff our runner instance size since we aren't using the docker+machine. This means
    # the jobs run directly on a runner, so a t3.micro instance might not cut it.
    type = "m5.large"
    # To allow the runner to access the internet without requiring a NAT gateway, we must
    # give them a public IP.
    use_eip              = true
    private_address_only = false
    name                 = "django-project-${var.environment_name}"
    # Allow SSM access to help debug if runner issues arise.
    ssm_access = true
    tag_list   = join(", ", var.runner_tags)
  }

  runner_gitlab = {
    url            = "https://gitlab.com"
    runner_version = "15.11.0"
  }

  runner_cloudwatch = {
    enable = false
  }

  # This has the jobs run on the same EC2 instance as the agent, no autoscaling is used.
  runner_worker = {
    type = "docker"
  }

  runner_worker_cache = {
    random_suffix = true
  }

  runner_networking = {
    security_group_ids = [data.aws_security_group.rds.id]
  }

  # This ends up taking precedence over the `subnet_id` input above, but that input is
  # required.
  # https://github.com/cattle-ops/terraform-aws-gitlab-runner/blob/5100efd3445c3f06e5089d970da5a3a0341624eb/main.tf#L177C42-L177C79
  runner_worker_docker_machine_instance = {
    subnet_ids = data.aws_subnets.public_subnet_ids.ids
  }
}

@kayman-mk
Copy link
Collaborator Author

@ryancausey Could you share the error message from theogs please?

@ryancausey
Copy link
Contributor

@kayman-mk here's what I get from journalctl. This is using runner version 16.2.2.

 journalctl -u gitlab-runner.service --no-pager
-- Logs begin at Wed 2023-10-25 21:06:51 UTC, end at Wed 2023-10-25 21:24:42 UTC. --
Oct 25 21:09:22 ip-10-0-2-65.us-west-2.compute.internal systemd[1]: Started GitLab Runner.
Oct 25 21:09:22 ip-10-0-2-65.us-west-2.compute.internal gitlab-runner[3374]: Runtime platform                                    arch=amd64 os=linux pid=3374 revision=30ac8e7f version=16.2.2
Oct 25 21:09:22 ip-10-0-2-65.us-west-2.compute.internal gitlab-runner[3374]: Starting multi-runner from /etc/gitlab-runner/config.toml...  builds=0 max_builds=0
Oct 25 21:09:22 ip-10-0-2-65.us-west-2.compute.internal gitlab-runner[3374]: Running in system-mode.
Oct 25 21:09:22 ip-10-0-2-65.us-west-2.compute.internal gitlab-runner[3374]:
Oct 25 21:09:22 ip-10-0-2-65.us-west-2.compute.internal gitlab-runner[3374]: There might be a problem with your config based on jsonschema annotations in common/config.go (experimental feature):
Oct 25 21:09:22 ip-10-0-2-65.us-west-2.compute.internal gitlab-runner[3374]: jsonschema: '/runners/0/docker/ulimit' does not validate with https://gitlab.com/gitlab-org/gitlab-runner/common/config#/$ref/properties/runners/items/$ref/properties/docker/$ref/properties/ulimit/type: expected object, but got null
Oct 25 21:09:22 ip-10-0-2-65.us-west-2.compute.internal gitlab-runner[3374]:
Oct 25 21:09:22 ip-10-0-2-65.us-west-2.compute.internal gitlab-runner[3374]: Created missing unique system ID                    system_id=s_e39bc281c21d
Oct 25 21:09:22 ip-10-0-2-65.us-west-2.compute.internal gitlab-runner[3374]: {"builds":0,"level":"info","max_builds":10,"msg":"Configuration loaded","time":"2023-10-25T21:09:22Z"}
Oct 25 21:09:22 ip-10-0-2-65.us-west-2.compute.internal gitlab-runner[3374]: {"builds":0,"level":"info","max_builds":10,"msg":"listen_address not defined, metrics \u0026 debug endpoints disabled","time":"2023-10-25T21:09:22Z"}
Oct 25 21:09:22 ip-10-0-2-65.us-west-2.compute.internal gitlab-runner[3374]: {"builds":0,"level":"info","max_builds":10,"msg":"[session_server].listen_address not defined, session endpoints disabled","time":"2023-10-25T21:09:22Z"}
Oct 25 21:09:22 ip-10-0-2-65.us-west-2.compute.internal gitlab-runner[3374]: {"builds":0,"level":"info","max_builds":10,"msg":"Initializing executor providers","time":"2023-10-25T21:09:22Z"}
Oct 25 21:09:23 ip-10-0-2-65.us-west-2.compute.internal gitlab-runner[3374]: {"level":"error","msg":"Checking for jobs... forbidden","runner":"null","time":"2023-10-25T21:09:23Z"}
Oct 25 21:09:26 ip-10-0-2-65.us-west-2.compute.internal gitlab-runner[3374]: {"level":"error","msg":"Checking for jobs... forbidden","runner":"null","time":"2023-10-25T21:09:26Z"}
Oct 25 21:09:29 ip-10-0-2-65.us-west-2.compute.internal gitlab-runner[3374]: {"level":"error","msg":"Checking for jobs... forbidden","runner":"null","time":"2023-10-25T21:09:29Z"}
Oct 25 21:09:29 ip-10-0-2-65.us-west-2.compute.internal gitlab-runner[3374]: {"level":"error","msg":"Runner \"https://gitlab.comnull\" is unhealthy and will be disabled for 1h0m0s seconds!","time":"2023-10-25T21:09:29Z","unhealthy_requests":3,"unhealthy_requests_limit":3}

@kayman-mk
Copy link
Collaborator Author

The last line looks strange. It says Runner \"https://gitlab.comnull\" is unhealthy. Could you please show the relevant parts of the etc/gitlab-runner/config.toml which is dealing with the names of the machines?

Seems that something is broken with the URL and the name. The relevant parts should be these

[[runners]]
  name = "prod-gitlab-runner"
  url = "https://gitlab.my.instance"
  token = "a valid token here, but not null or similar"
  executor = "docker+machine"

[runners.machine]
    MachineDriver = "amazonec2"
    MachineName = "XS-eu-central-1a-%s"

Are there any lines in the config.toml which show null?

@ryancausey
Copy link
Contributor

@kayman-mk it looks like the token is missing.

Here's config.toml for module version 7.1.1

# cat /etc/gitlab-runner/config.toml

concurrent = 10
check_interval = 3
sentry_dsn = ""
log_format = "json"
listen_address = ""

[[runners]]
  name = "runner-nonprod259196356"
  url = "https://gitlab.com"

  clone_url = ""
  token = "null"
  executor = "docker"
  environment = []
  pre_build_script = ""
  post_build_script = ""
  pre_clone_script = ""
  request_concurrency = 1
  output_limit = 4096
  limit = 0

    [runners.docker]
    disable_cache = false
    image = "docker:18.03.1-ce"
    privileged = true
    pull_policies = ["always"]
    shm_size = 0
    tls_verify = false
    volumes = ["/cache"]




  [runners.docker.tmpfs]


  [runners.docker.services_tmpfs]


  [runners.cache]
    Type = "s3"
    Shared = false
    [runners.cache.s3]
      AuthenticationType = "iam"
      ServerAddress = "s3.amazonaws.com"
      BucketName = "<bucket name>"
      BucketLocation = "us-west-2"
      Insecure = false

  [runners.machine]
    IdleCount = 0
    IdleTime = 600

    MachineDriver = "amazonec2"
    MachineName = "nonprod259196356-%s"
    MachineOptions = [
      "amazonec2-instance-type=m5.large",
      "amazonec2-region=us-west-2",
      "amazonec2-zone=b",
      "amazonec2-vpc-id=<vpc id>",
      "amazonec2-subnet-id=<subnet id>",
      "amazonec2-subnet-id=<subnet id>",
      "amazonec2-subnet-id=<subnet id>",
      "amazonec2-subnet-id=<subnet id>",
      "amazonec2-private-address-only=true",
      "amazonec2-use-private-address=false",
      "amazonec2-request-spot-instance=true",
      "amazonec2-security-group=",
      "amazonec2-tags=Environment,nonprod259196356,gitlab-runner-parent-id,i-0b9646157e05a5e79",
      "amazonec2-use-ebs-optimized-instance=true",
      "amazonec2-monitoring=false",
      "amazonec2-iam-instance-profile=",
      "amazonec2-root-size=8",
      "amazonec2-volume-type=gp2",
      "amazonec2-userdata=",
      "amazonec2-ami="
      ,"amazonec2-metadata-token=required", "amazonec2-metadata-token-response-hop-limit=2",
    ]
    MaxGrowthRate = 0

Compare the above to the config.toml for module version 6.5.2

# cat /etc/gitlab-runner/config.toml

concurrent = 10
check_interval = 3
sentry_dsn = ""
log_format = "json"
listen_address = ""

[[runners]]
  name = "runner-nonprod259196356"
  url = "https://gitlab.com"

  clone_url = ""
  token = "<token is populated>"
  executor = "docker"
  environment = []
  pre_build_script = ""
  post_build_script = ""
  pre_clone_script = ""
  request_concurrency = 1
  output_limit = 4096
  limit = 0
  [runners.docker]
    tls_verify = false
    image = "docker:18.03.1-ce"
    privileged = true
    disable_cache = false
    volumes = ["/cache"]
    extra_hosts = []
    shm_size = 0
    pull_policy = ["always"]
    runtime = ""
    helper_image = ""
    wait_for_services_timeout = 30

  [runners.docker.tmpfs]

  [runners.docker.services_tmpfs]

  [runners.cache]
    Type = "s3"
    Shared = false
    [runners.cache.s3]
      AuthenticationType = "iam"
      ServerAddress = "s3.amazonaws.com"
      BucketName = "<bucket name>"
      BucketLocation = "us-west-2"
      Insecure = false
  [runners.machine]
    IdleCount = 0
    IdleTime = 600

    MachineDriver = "amazonec2"
    MachineName = "nonprod259196356-%s"
    MachineOptions = [
      "amazonec2-instance-type=m5.large",
      "amazonec2-region=us-west-2",
      "amazonec2-zone=b",
      "amazonec2-vpc-id=<vpc id>",
      "amazonec2-subnet-id=<subnet id>",
      "amazonec2-private-address-only=false",
      "amazonec2-use-private-address=true",
      "amazonec2-request-spot-instance=true",
      "amazonec2-security-group=",
      "amazonec2-tags=Environment,nonprod259196356,gitlab-runner-parent-id,i-0063aa2426d25b3f5",
      "amazonec2-use-ebs-optimized-instance=true",
      "amazonec2-monitoring=false",
      "amazonec2-iam-instance-profile=",
      "amazonec2-root-size=16",
      "amazonec2-volume-type=gp2",
      "amazonec2-userdata=",
      "amazonec2-ami="
      ,"amazonec2-metadata-token=required", "amazonec2-metadata-token-response-hop-limit=2",
    ]

@mahela-aws
Copy link

@kayman-mk we are getting below errors when trying to execute the migration script.

bash migrate-to-7-0-0.sh runner.tf
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
head: illegal line count -- -1
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
migrate-to-7-0-0.sh: line 661: subnet_id: command not found
migrate-to-7-0-0.sh: line 661: subnet_id_runners: command not found
Not all cases are handled by this script. Please check the output file and make sure that all variables are converted correctly.
Take some time and sort the variables again for better readability.

Known issues:
  - commented lines are not supported. Remove them.
  - variable definitions with multiple lines are not supported. Rework manually.
  -  was taken from . Make sure that this is correct.

Module call converted. Output: runner.tf.new
MacBook-Pro:gitlab-runner mahela$ ls
locals.tf		migrate-to-7-0-0.sh	runner.tf		runner.tf.new		variables.tf
MacBook-Pro:gitlab-runner mahela$ rm runner.tf.new
MacBook-Pro:gitlab-runner mahela$ bash migrate-to-7-0-0.sh runner.tf
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
head: illegal line count -- -1
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
sed: -I or -i may not be used with stdin
migrate-to-7-0-0.sh: line 661: subnet_id: command not found
migrate-to-7-0-0.sh: line 661: subnet_id_runners: command not found
Not all cases are handled by this script. Please check the output file and make sure that all variables are converted correctly.
Take some time and sort the variables again for better readability.

Known issues:
  - commented lines are not supported. Remove them.
  - variable definitions with multiple lines are not supported. Rework manually.
  -  was taken from . Make sure that this is correct.

runner.tf module calling file looks like below

  source  = "npalm/gitlab-runner/aws"
  version = "6.5.1"

  aws_region  = var.aws_region
  environment = var.bn_context

  vpc_id              = var.vpc_id
  subnet_id           = var.subnet_type == "private" ? element(data.aws_subnets.private.ids, 0) : element(data.aws_subnets.public.ids, 0)
  metrics_autoscaling = ["GroupDesiredCapacity", "GroupInServiceCapacity"]

  instance_type                     = "t3a.medium"
  runner_instance_enable_monitoring = false
  show_user_data_in_plan            = false
  runner_root_block_device = {
    volume_size = 32
  }

  use_fleet           = true
  fleet_key_pair_name = "${var.name}-${local.subnet_type}-fleet-key"
  docker_machine_instance_types_fleet = [
    "r6a.large",
    "m6a.large",
    "m5a.large",
    "r5a.large",
    "r5ad.large",
    "m5ad.large",
  ]
  enable_runner_ssm_access                                     = true
  runners_name                                                 = var.name
  runners_gitlab_url                                           = var.gitlab_url
  runners_max_builds                                           = 8
  runners_root_size                                            = 32
  runners_request_concurrency                                  = 20
  runners_request_spot_instance                                = true
  enable_eip                                                   = var.subnet_type != "private"
  runners_use_private_address                                  = var.subnet_type == "private"
  runner_agent_uses_private_address                            = var.subnet_type == "private"
  runners_output_limit                                         = 51200
  gitlab_runner_version                                        = "16.1.0"
  docker_machine_spot_price_bid                                = "on-demand-price"
  enable_schedule                                              = false
  runners_volume_type                                          = "gp3"
  runners_image                                                = "docker:20.10.24"
  secure_parameter_store_gitlab_runner_registration_token_name = "registration_token"
  secure_parameter_store_runner_token_key                      = "${local.subnet_type}-runner-token"
  secure_parameter_store_runner_sentry_dsn                     = "${local.subnet_type}-sentry-dsn"
  asg_terminate_lifecycle_hook_name                            = "${local.subnet_type}-terminate-instances"

  gitlab_runner_registration_config = {
    tag_list          = format("aws_runner_spot%s", var.subnet_type == "private" ? "_${local.subnet_type}" : "")
    description       = "runner docker+machine - scalable"
    locked_to_project = "false"
    run_untagged      = "false"
    maximum_timeout   = "3600"
  }

  overrides = {
    name_sg                    = "${var.bn_context}-${var.aws_region}-${local.subnet_type}-glr"
    name_iam_objects           = "${var.bn_context}-${var.aws_region}-${local.subnet_type}-glr"
    name_runner_agent_instance = "${var.bn_context}-${var.aws_region}-${local.subnet_type}-glr"
    name_docker_machine_runners = "${var.bn_context}-${local.subnet_type}-glr"
  }

  log_group_name             = "/ec2/${var.name}-${var.aws_region}-${local.subnet_type}-glr"
  runners_privileged         = "true"
  runners_additional_volumes = ["/certs/client"]

  runners_volumes_tmpfs = [
    {
      volume  = "/var/opt/cache",
      options = "rw,noexec"
    }
  ]

  runners_services_volumes_tmpfs = [
    {
      volume  = "/var/lib/mysql",
      options = "rw,noexec"
    }
  ]

  cache_bucket_prefix            = var.aws_region
  cache_bucket_set_random_suffix = true
  cache_expiration_days          = 30
  tags = {
    "Terraform"                              = "True"
    "tf-aws-gitlab-runner:instancelifecycle" = "spot:yes"
  }
}

would you be able to help us on this ?

@mahela-aws
Copy link

running this in macos

@kayman-mk
Copy link
Collaborator Author

Yeah, have hear about MacOS before. As far as I remember there is a comment somewhere. In case it doesnn't run on the machine, try starting an Alpine Linux and run the script inside. This should fix the problems.

@kayman-mk kayman-mk unpinned this issue Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🆕 New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants