A Gitlab Runner JSII construct lib for AWS CDK
Project description
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
In Group
Project > Settings > CI/CD > Runners
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
Wait about 6 mins , If success you will see your runner in that page .
you can use tag gitlab
, runner
, awscdk
,
Example gitlab-ci.yaml
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)
Built Distribution
Close
Hashes for cdk_gitlab_runner-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6be338f847c3643adf774a96ddc1607dcb7c5719d8e5cbfa930e2232cbf13f0 |
|
MD5 | 21f7dc15c65343d114d8bb74e6cf0cc1 |
|
BLAKE2b-256 | 1f610da0f30b28f2f8dc04d7f44ee3e4280d8ef099c1d66e441829fb0321b0bf |