Skip to main content

A Gitlab Runner JSII construct lib for AWS CDK

Project description

NPM version PyPI version Release

Welcome to cdk-gitlab-runner

This repository template helps you create gitlab runner on your aws account via AWS CDK one line.

note

Will help create a vpc ( only public subnet ) , and one T3.large ec2 Runner (change type feature will update soon ...)

Before start your need gitlab runner token in your gitlab project or gitlab group

In Group

Group > Settings > CI/CD group

In Group

Project > Settings > CI/CD > Runners project

Usage Replace your gitlab runner roken in $GITLABTOKEN

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from cdk_gitlab_runner import GitlabContainerRunner
from aws_cdk.aws_ec2 import InstanceType, InstanceClass, InstanceSize
# If want change instance type to t3.large .
GitlabContainerRunner(stack, "testing", gitlabtoken="$GITLABTOKEN", ec2type=InstanceType.of(InstanceClass.T2, InstanceSize.LARGE))
# OR
# Just create a gitlab runner , by default instance type is t3.small .
from cdk_gitlab_runner import GitlabContainerRunner
from aws_cdk.aws_ec2 import InstanceType, InstanceClass, InstanceSize
GitlabContainerRunner(stack, "testing", gitlabtoken="$GITLABTOKEN")

# If want change tags you want.
from cdk_gitlab_runner import GitlabContainerRunner
from aws_cdk.aws_ec2 import InstanceType, InstanceClass, InstanceSize
GitlabContainerRunner(stack, "testing-have-type-tag", gitlabtoken="GITLABTOKEN", tag1="aa", tag2="bb", tag3="cc")
# Example python instance type change to t3.small .
GitlabContainerRunner(self, 'gitlab-runner', gitlabtoken='$GITLABTOKEN',
                              ec2type=InstanceType.of(
                                  instance_class=InstanceClass.BURSTABLE3, instance_size=InstanceSize.SMALL), tag1='aa',tag2='bb',tag3='cc')

see more instance class and size

InstanceClass

InstanceSize

Wait about 6 mins , If success you will see your runner in that page .

runner

you can use tag gitlab , runner , awscdk ,

Example gitlab-ci.yaml

gitlab docs see more ...

dockerjob:
  image: docker:18.09-dind
  variables:
  tags:
    - runner
    - awscdk
    - gitlab
  variables:
    DOCKER_TLS_CERTDIR: ""
  before_script:
    - docker info
  script:
    - docker info;
    - echo 'test 123';
    - echo 'hello world 1228'

If your want to debug your can go to aws console

In your runner region !!!

AWS Systems Manager > Session Manager > Start a session

click your runner and click start session

in the brower console in put bash

# become to root
sudo -i

# list runner container .
root# docker ps -a

# modify gitlab-runner/config.toml

root# cd /home/ec2-user/.gitlab-runner/ && ls
config.toml

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cdk-gitlab-runner-1.0.0.tar.gz (597.2 kB view hashes)

Uploaded Source

Built Distribution

cdk_gitlab_runner-1.0.0-py3-none-any.whl (596.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page