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

fix: Remove extraneous slashes from SSM paths, other typos #2765

Merged
merged 2 commits into from
Dec 17, 2022

Conversation

kring
Copy link
Contributor

@kring kring commented Dec 14, 2022

I'm trying out v2.0.0-next.5 after using v1.18.0 successfully, and had a problem where my Windows runners failed to start up.

Connecting to the machine with SSM and looking at c:\UserData.log, the problem was that an extra slash was being added at the start of SSM paths. So instead of retrieving /github-actions-runner/whatever, it would try to retrieve //github-actions-runner/whatever and fail. So this PR removes the seemingly extraneous slashes, and now my runners are working well.

It's also possible that I've misconfigured something such that $ssm_config_path is not supposed to start with a slash, but it does in my case. Please let me know if this might be the case.

This PR also fixes a couple of typos in the powershell start-runner script.

@npalm npalm self-requested a review December 14, 2022 15:28
@npalm
Copy link
Member

npalm commented Dec 16, 2022

Did you used the default config? I used the example for multi-runner to test the setup.

@kring
Copy link
Contributor Author

kring commented Dec 16, 2022

I used my own hand-written config, based on the multi-runner example. Basically I include terraform-aws-github-runner as a submodule (at the label v2.0.0-next.5), and then my main.tf looks like this (sorry it's so long):

locals {
  environment = "cesiumci"
  aws_region  = "us-east-1"
}

resource "random_id" "random" {
  byte_length = 20
}

module "runners" {
  source = "./terraform-aws-github-runner/modules/multi-runner"

  multi_runner_config = {
    "windows-unreal" = {
      matcherConfig : {
        labelMatchers = [["self-hosted", "windows", "x64", "unreal"]]
        exactMatch    = true
      }
      fifo                = false
      delay_webhook_event = 0
      redrive_build_queue = {
        enabled         = false
        maxReceiveCount = null
      },
      runner_config = {
        runner_os           = "windows"
        runner_architecture = "x64"
        # we need to give the runner time to start because this is windows.
        runner_boot_time_in_minutes = 20
        # enable access to the runners via SSM
        enable_ssm_on_runners = true
        instance_types        = ["c5ad.2xlarge"]
        runner_extra_labels   = "windows,unreal"
        ami_filter            = { name = ["cesium-unreal-engine-5-0-preview2*"], state = ["available"] }
        ami_owners            = [var.aws_account_id]
        # Mount the ephemeral local SSD and use it as the runner root directory
        userdata_pre_install           = <<EOT
          Get-Disk | Where partitionstyle -eq 'raw' | Initialize-Disk -PartitionStyle MBR -PassThru | New-Partition -DriveLetter D -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel "build" -Confirm:$false
          mkdir C:\actions-runner
          New-Item -ItemType SymbolicLink -Path "c:\actions-runner\_work" -Target "d:\"
        EOT   
        scale_down_schedule_expression = "cron(* * * * ? *)"
        runners_maximum_count          = 20
        enabled_userdata               = true
        enable_ephemeral_runners       = true
        enable_organization_runners    = true
        enable_cloudwatch_agent        = false
      }
    }
    "windows-unreal-50" = {
      matcherConfig : {
        labelMatchers = [["self-hosted", "windows", "x64", "unreal-50"]]
        exactMatch    = true
      }
      fifo                = false
      delay_webhook_event = 0
      redrive_build_queue = {
        enabled         = false
        maxReceiveCount = null
      },
      runner_config = {
        runner_os           = "windows"
        runner_architecture = "x64"
        # we need to give the runner time to start because this is windows.
        runner_boot_time_in_minutes = 20
        # enable access to the runners via SSM
        enable_ssm_on_runners = true
        instance_types        = ["c5ad.2xlarge"]
        runner_extra_labels   = "windows,unreal-50"
        ami_filter            = { name = ["cesium-ci-windows-unreal-50*"], state = ["available"] }
        ami_owners            = [var.aws_account_id]
        # Mount the ephemeral local SSD and use it as the runner root directory
        userdata_pre_install           = <<EOT
          Get-Disk | Where partitionstyle -eq 'raw' | Initialize-Disk -PartitionStyle MBR -PassThru | New-Partition -DriveLetter D -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel "build" -Confirm:$false
          mkdir C:\actions-runner
          New-Item -ItemType SymbolicLink -Path "c:\actions-runner\_work" -Target "d:\"
        EOT   
        scale_down_schedule_expression = "cron(* * * * ? *)"
        runners_maximum_count          = 20
        enabled_userdata               = true
        enable_ephemeral_runners       = true
        enable_organization_runners    = true
        enable_cloudwatch_agent        = false
      }
    }
    "windows-unreal-51" = {
      matcherConfig : {
        labelMatchers = [["self-hosted", "windows", "x64", "unreal-51"]]
        exactMatch    = true
      }
      fifo                = false
      delay_webhook_event = 0
      redrive_build_queue = {
        enabled         = false
        maxReceiveCount = null
      },
      runner_config = {
        runner_os           = "windows"
        runner_architecture = "x64"
        # we need to give the runner time to start because this is windows.
        runner_boot_time_in_minutes = 20
        # enable access to the runners via SSM
        enable_ssm_on_runners = true
        instance_types        = ["c5ad.2xlarge"]
        runner_extra_labels   = "windows,unreal-51"
        ami_filter            = { name = ["cesium-ci-windows-unreal-51*"], state = ["available"] }
        ami_owners            = [var.aws_account_id]
        # Mount the ephemeral local SSD and use it as the runner root directory
        userdata_pre_install           = <<EOT
          Get-Disk | Where partitionstyle -eq 'raw' | Initialize-Disk -PartitionStyle MBR -PassThru | New-Partition -DriveLetter D -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel "build" -Confirm:$false
          mkdir C:\actions-runner
          New-Item -ItemType SymbolicLink -Path "c:\actions-runner\_work" -Target "d:\"
        EOT   
        scale_down_schedule_expression = "cron(* * * * ? *)"
        runners_maximum_count          = 20
        enabled_userdata               = true
        enable_ephemeral_runners       = true
        enable_organization_runners    = true
        enable_cloudwatch_agent        = false
      }
    }
    "windows-unity-2021-3" = {
      matcherConfig : {
        labelMatchers = [["self-hosted", "windows", "x64", "unity-2021-3"]]
        exactMatch    = true
      }
      fifo                = false
      delay_webhook_event = 0
      redrive_build_queue = {
        enabled         = false
        maxReceiveCount = null
      },
      runner_config = {
        runner_os           = "windows"
        runner_architecture = "x64"
        # we need to give the runner time to start because this is windows.
        runner_boot_time_in_minutes = 20
        # enable access to the runners via SSM
        enable_ssm_on_runners = true
        instance_types        = ["c5ad.2xlarge"]
        runner_extra_labels   = "windows,unity-2021-3"
        ami_filter            = { name = ["cesium-ci-windows-unity-2021-3*"], state = ["available"] }
        ami_owners            = [var.aws_account_id]
        # Mount the ephemeral local SSD and use it as the runner root directory
        userdata_pre_install           = <<EOT
          Get-Disk | Where partitionstyle -eq 'raw' | Initialize-Disk -PartitionStyle MBR -PassThru | New-Partition -DriveLetter D -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel "build" -Confirm:$false
          mkdir C:\actions-runner
          New-Item -ItemType SymbolicLink -Path "c:\actions-runner\_work" -Target "d:\"
        EOT   
        scale_down_schedule_expression = "cron(* * * * ? *)"
        runners_maximum_count          = 20
        enabled_userdata               = true
        enable_ephemeral_runners       = true
        enable_organization_runners    = true
        enable_cloudwatch_agent        = false
      }
    }
  }

  aws_region = local.aws_region
  vpc_id     = module.vpc.vpc_id
  subnet_ids = module.vpc.private_subnets
  prefix     = local.environment

  github_app = {
    key_base64     = var.github_app_key_base64
    id             = var.github_app_id
    webhook_secret = random_id.random.hex
  }

  # Grab the lambda packages from local directory. Must run /.ci/build.sh first
  webhook_lambda_zip                = "./lambdas-download/webhook.zip"
  runner_binaries_syncer_lambda_zip = "./lambdas-download/runner-binaries-syncer.zip"
  runners_lambda_zip                = "./lambdas-download/runners.zip"
}

module "windows-components" {
  source = "./image-builders/components/windows"
}

module "windows-unreal-50" {
  source     = "./image-builders/recipes/windows-unreal-50"
  components = module.windows-components
}

module "windows-unreal-51" {
  source     = "./image-builders/recipes/windows-unreal-51"
  components = module.windows-components
}

module "windows-unity-2021-3" {
  source     = "./image-builders/recipes/windows-unity-2021-3"
  components = module.windows-components
}

Copy link
Member

@npalm npalm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kring Thanks for the fix, strang my test instance was working. But agree the script was incorrect. Tested your change on the multi-runner example as well.

@npalm npalm merged commit e20c8e4 into philips-labs:next Dec 17, 2022
@npalm
Copy link
Member

npalm commented Dec 17, 2022

available in pre release v2.0.0-next.7

npalm pushed a commit that referenced this pull request Dec 28, 2022
* Remove extraneous slash.

* Remove more extraneous slashes.
npalm pushed a commit that referenced this pull request Dec 28, 2022
* Remove extraneous slash.

* Remove more extraneous slashes.
npalm pushed a commit that referenced this pull request Dec 28, 2022
* Remove extraneous slash.

* Remove more extraneous slashes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants