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

Auto register runners #44

Closed
npalm opened this issue Mar 29, 2019 · 1 comment
Closed

Auto register runners #44

npalm opened this issue Mar 29, 2019 · 1 comment
Assignees

Comments

@npalm
Copy link
Collaborator

npalm commented Mar 29, 2019

Currently it is required to register the runner before running the terraform scripts. In branch https://github.com/npalm/terraform-aws-gitlab-runner/tree/feature/auto-register-runner I am preparing scripts so that the runner can register itself based on the registration token. Runner tokens will be kept in the parameter store.

@npalm npalm self-assigned this Mar 29, 2019
@npalm
Copy link
Collaborator Author

npalm commented Mar 29, 2019

The variable runners_token will become obsolete and replace it by a runner configuration which will be used to register the runner.

Define in the module the runner configuration as follow:

  gitlab_runner_registration_config = {
    registration_token = "<registration token>"
    tag_list           = "<your tags, comma separated"
    description        = "<some description>"
    locked_to_project  = "true"
    run_untagged       = "false"
    maximum_timeout    = "3600"
  }

And DO NOT specify the runners_token. The runner will then be created if there is not one registered before. Registered runners will be stored in the AWS parameter store.

For migration to the new setup simply add the runner token to the parameter store. Once the runner is started it will lookup required values in the parameter store. If the value is null a new runner will be created.

# set the following variables, look up the variables in your Terraform config.
# see your Terraform variables to fill in the vars below.
aws-region=<${var.aws_region}>
token=<runner-token-see-your-gitlab-runner>
parameter-name=<${var.environment}>-<${var.secure_parameter_store_runner_token_key}>

aws ssm put-parameter --overwrite --type SecureString  --name "${parameter-name}" --value ${token} --region "${aws-region}"

Once you have created the parameter, you have to remove the variable runners_token from your config. Then next time your gitlab runner instance is created it look up the token from the parameter store.

@npalm npalm closed this as completed in #46 Mar 29, 2019
npalm added a commit that referenced this issue Mar 29, 2019
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

No branches or pull requests

1 participant