gitlab-runner-registered-linux

Description

Ensure a gitlab runner is registered for a group or project.

Variables

Name Type Default Description

api_token

string --

Your private token to interact with the GitLab API. Required

description

string --

The unique name of the runner. Required

registration_token

string --

The registration token to use. Required

arch

string amd64

The architecture of the target system.

gitlab_url

string https://gitlab.com

The URL of the Gitlab server, with protocol (i.e. http or https).

install_docker

boolean False

Whether to also install Docker.

install_gitlab_runner

boolean False

Whether to also make sure a gitlab runner service is setup and running.

locked

boolean False

Whether the runner is locked or not.

run_untagged

boolean True

Run untagged jobs or not.

tags

list --

The tags that apply to the runner.

Code

doc:
  short_help: Ensure a gitlab runner is registered for a group or project.

args:
  _import: gitlab-runner-service-linux
  install_gitlab_runner:
    doc:
      short_help: Whether to also make sure a gitlab runner service is setup and running.
    type: boolean
    default: false
    cli:
      param_decls:
      - --install-gitlab-runner
  gitlab_url:
    doc:
      short_help: The URL of the Gitlab server, with protocol (i.e. http or https).
    type: string
    required: true
    default: https://gitlab.com
  api_token:
    doc:
      short_help: Your private token to interact with the GitLab API.
    type: string
    secret: true
    required: true
  registration_token:
    doc:
      short_help: The registration token to use.
    type: string
    required: true
  description:
    doc:
      short_help: The unique name of the runner.
    type: string
    required: true
  tags:
    doc:
      short_help: The tags that apply to the runner.
    type: list
    schema:
      type: string
    required: false
    cli:
      param_decls:
      - --tag
      - -t
  run_untagged:
    doc:
      short_help: Run untagged jobs or not.
    type: boolean
    required: false
    default: true
  locked:
    doc:
      short_help: Whether the runner is locked or not.
    type: boolean
    default: false
    required: false



frecklets:
- gitlab-runner-service-linux:
    frecklet::skip: '{{:: install_gitlab_runner | negate ::}}'
    install_docker: '{{:: install_docker ::}}'
    arch: '{{:: arch ::}}'
- pip-system-package-installed:
    package: python-gitlab
- frecklet:
    name: gitlab_runner
    type: ansible-module
    properties:
      elevated: false
      internet: true
      idempotent: true
    desc:
      short_help: register gitlab runner
  vars:
    url: '{{:: gitlab_url ::}}'
    api_token: '{{:: api_token ::}}'
    registration_token: '{{:: registration_token ::}}'
    description: '{{:: description ::}}'
    state: present
    active: true
    tag_list: '{{:: tags ::}}'
    run_untagged: '{{:: run_untagged ::}}'
    locked: '{{:: locked ::}}'
frecklecute gitlab-runner-registered-linux --help

Usage: frecklecute gitlab-runner-registered-linux [OPTIONS]

  Ensure a gitlab runner is registered for a group or project.

Options:
  --api-token API_TOKEN           Your private token to interact with the
                                  GitLab API.  [required]
  --description DESCRIPTION       The unique name of the runner.  [required]
  --registration-token REGISTRATION_TOKEN
                                  The registration token to use.  [required]
  --arch ARCH                     The architecture of the target system.
  --gitlab-url GITLAB_URL         The URL of the Gitlab server, with protocol
                                  (i.e. http or https).
  --install-docker                Whether to also install Docker.
  --install-gitlab-runner         Whether to also make sure a gitlab runner
                                  service is setup and running.
  --locked / --no-locked          Whether the runner is locked or not.
  --run-untagged / --no-run-untagged
                                  Run untagged jobs or not.
  -t, --tag TAGS                  The tags that apply to the runner.
  --help                          Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.gitlab_runner_registered_linux.GitlabRunnerRegisteredLinux
#


from dataclasses import dataclass
from pyckles import AutoPycklet
from typing import *    # noqa

@dataclass
class GitlabRunnerRegisteredLinux(AutoPycklet):
    """Ensure a gitlab runner is registered for a group or project.

       Args:
         api_token: Your private token to interact with the GitLab API.
         arch: The architecture of the target system.
         description: The unique name of the runner.
         gitlab_url: The URL of the Gitlab server, with protocol (i.e. http or https).
         install_docker: Whether to also install Docker.
         install_gitlab_runner: Whether to also make sure a gitlab runner service is setup and running.
         locked: Whether the runner is locked or not.
         registration_token: The registration token to use.
         run_untagged: Run untagged jobs or not.
         tags: The tags that apply to the runner.

    """

    FRECKLET_ID = "gitlab-runner-registered-linux"

    api_token: str = None
    arch: str = None
    description: str = None
    gitlab_url: str = None
    install_docker: bool = None
    install_gitlab_runner: bool = None
    locked: bool = None
    registration_token: str = None
    run_untagged: bool = None
    tags: List = None


    def __post_init__(self):
        super(GitlabRunnerRegisteredLinux, self).__init__(var_names=["api_token", "arch", "description", "gitlab_url", "install_docker", "install_gitlab_runner", "locked", "registration_token", "run_untagged", "tags"])


frecklet_class = GitlabRunnerRegisteredLinux
# -*- coding: utf-8 -*-


#
# module path: pycklets.gitlab_runner_registered_linux.GitlabRunnerRegisteredLinux
#


from pyckles import AutoPycklet

class GitlabRunnerRegisteredLinux(AutoPycklet):
    """Ensure a gitlab runner is registered for a group or project.

       Args:
         api_token: Your private token to interact with the GitLab API.
         arch: The architecture of the target system.
         description: The unique name of the runner.
         gitlab_url: The URL of the Gitlab server, with protocol (i.e. http or https).
         install_docker: Whether to also install Docker.
         install_gitlab_runner: Whether to also make sure a gitlab runner service is setup and running.
         locked: Whether the runner is locked or not.
         registration_token: The registration token to use.
         run_untagged: Run untagged jobs or not.
         tags: The tags that apply to the runner.

    """

    FRECKLET_ID = "gitlab-runner-registered-linux"

    def __init__(self, api_token=None, arch="amd64", description=None, gitlab_url="https://gitlab.com", install_docker=None, install_gitlab_runner=None, locked=None, registration_token=None, run_untagged=True, tags=None):

        super(GitlabRunnerRegisteredLinux, self).__init__(var_names=["api_token", "arch", "description", "gitlab_url", "install_docker", "install_gitlab_runner", "locked", "registration_token", "run_untagged", "tags"])
        self._api_token = api_token
        self._arch = arch
        self._description = description
        self._gitlab_url = gitlab_url
        self._install_docker = install_docker
        self._install_gitlab_runner = install_gitlab_runner
        self._locked = locked
        self._registration_token = registration_token
        self._run_untagged = run_untagged
        self._tags = tags

    @property
    def api_token(self):
        return self._api_token

    @api_token.setter
    def api_token(self, api_token):
        self._api_token = api_token

    @property
    def arch(self):
        return self._arch

    @arch.setter
    def arch(self, arch):
        self._arch = arch

    @property
    def description(self):
        return self._description

    @description.setter
    def description(self, description):
        self._description = description

    @property
    def gitlab_url(self):
        return self._gitlab_url

    @gitlab_url.setter
    def gitlab_url(self, gitlab_url):
        self._gitlab_url = gitlab_url

    @property
    def install_docker(self):
        return self._install_docker

    @install_docker.setter
    def install_docker(self, install_docker):
        self._install_docker = install_docker

    @property
    def install_gitlab_runner(self):
        return self._install_gitlab_runner

    @install_gitlab_runner.setter
    def install_gitlab_runner(self, install_gitlab_runner):
        self._install_gitlab_runner = install_gitlab_runner

    @property
    def locked(self):
        return self._locked

    @locked.setter
    def locked(self, locked):
        self._locked = locked

    @property
    def registration_token(self):
        return self._registration_token

    @registration_token.setter
    def registration_token(self, registration_token):
        self._registration_token = registration_token

    @property
    def run_untagged(self):
        return self._run_untagged

    @run_untagged.setter
    def run_untagged(self, run_untagged):
        self._run_untagged = run_untagged

    @property
    def tags(self):
        return self._tags

    @tags.setter
    def tags(self, tags):
        self._tags = tags



frecklet_class = GitlabRunnerRegisteredLinux