File tree Expand file tree Collapse file tree 5 files changed +45
-5
lines changed Expand file tree Collapse file tree 5 files changed +45
-5
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ variables:
1616 image_tag : v1.0
1717
1818run_unit_tests :
19+ tags :
20+ - ec2
21+ - aws
22+ - remote
1923 image : node:17-alpine3.14
2024 stage : test
2125 before_script :
@@ -27,6 +31,10 @@ run_unit_tests:
2731 - echo "Cleaning up temporary files..."
2832
2933run_lint_tests :
34+ tags :
35+ - ec2
36+ - aws
37+ - remote
3038 stage : test
3139 before_script :
3240 - echo "Preparing test data..."
@@ -40,6 +48,9 @@ run_lint_tests:
4048 - ls
4149
4250build_image :
51+ tags :
52+ - macos
53+ - local
4354 only :
4455 - main
4556 stage : build
@@ -48,6 +59,9 @@ build_image:
4859 - echo "Tagging the Docker image $image_repository:$image_tag"
4960
5061push_image :
62+ tags :
63+ - macos
64+ - local
5165 only :
5266 - main
5367 stage : build
@@ -58,6 +72,9 @@ push_image:
5872 - echo "Pushing Docker image $image_repository:$image_tag to registry..."
5973
6074deploy_image :
75+ tags :
76+ - macos
77+ - local
6178 only :
6279 - main
6380 stage : deploy
Original file line number Diff line number Diff line change 1111* Make sure you have your current IP on there and update to be sure it hasn't changed
1212* Make sure the key pair you're attempting to use corresponds to the one attached to your EC2
1313* Make sure your key pair on your local machine is chmod'ed correctly. I believe it's chmod 600 keypair.pem check this
14- * $ chmod 400 gitlab-runner-key.pem
15- * $ ssh -i ~ /Downloads/gitlab-runner-key.pem ubuntu@ec2-44-203-114-204.compute-1.amazonaws.com
14+ * ` $ chmod 400 gitlab-runner-key.pem `
15+ * ` $ ssh -i ~/Downloads/gitlab-runner-key.pem ubuntu@ec2-44-203-114-204.compute-1.amazonaws.com `
1616* Make sure you're in either your .ssh folder on your host OR correctly referencing it: HOME/.ssh/key.pem
1717* Last weird totally wishy-washy checks:
1818 * reboot instance
1919 * assign elastic IP and access that
2020 * switch from using the IP to Public DNS
21- * add a : at the end of user@ip:
21+ * add a : at the end of user@ip:
Original file line number Diff line number Diff line change 1+ pre steps:
2+ ` $ ssh -i ~/Downloads/gitlab-runner-key.pem ubuntu@ec2-44-203-114-204.compute-1.amazonaws.com `
3+
4+ ### After local connection to AWS EC2 instance:
5+ * ` $ apt-get update ` - to update the package before installing the tools
6+ * [ Installing GitLab Runner on Linux] ( https://docs.gitlab.com/runner/install/linux-repository.html )
7+ * ` $ curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash `
8+ * ` $ sudo apt-get install gitlab-runner ` - Install the latest version of GitLab Runner
9+ * ` $ sudo gitlab-runner -version `
10+ * ` $ sudo gitlab-runner -status `
11+ * ` $ sudo gitlab-runner register `
12+ * url - https://gitlab.com/
13+ * token - GR1348941c8-hse4jkvJn1E1y****
14+ * desc - ec2-runner
15+ * tags - ec2, aws, remote
16+ * note - The runner is using shell executor
17+ * executor - shell
18+ * ` $ sudo gitlab-runner -start ` - restart runner
19+ * ` $ sudo apt install nodejs ` - after adding tags to any job in .gitlab-ci.yml
20+ * ` $ sudo apt install npm ` - after adding tags to any job in .gitlab-ci.yml
Original file line number Diff line number Diff line change @@ -32,4 +32,7 @@ To have 10 runners on 1 machine with its own executor - [GitLab Executors](https
3232 2 . Group Runners - available to all projects in a group
3333 3 . Specific Runners - associated with a specific project (self-managed)
34349 . ** Specify a Docker image that the jobs runs in:**
35- 1 . "image: node:17-alpine" with a specific version
35+ 1 . "image: node:17-alpine" with a specific version
36+ 10 . ** Multiple Runners:**
37+ 1 . 1 job runs on a specific runner with configured setup for that job (** flexibility** )
38+ 2 . Multiple runners with the same configuration for jobs when 1 of that runners fails (** scalability** )
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ To install GitLab Runner using Homebrew:
2323 1 . Enter the GitLab instance URL\
2424 https://gitlab.com/
2525 2 . Enter the registration token:\
26- GR1348941c8-hse4jkvJn1E1yaWpC - from [ settings/ci_cd] ( https://gitlab.com/JavaScriptonit/mynodeapp-cicd-project/-/settings/ci_cd )
26+ GR1348941c8-hse4jkvJn1E1y **** - from [ settings/ci_cd] ( https://gitlab.com/JavaScriptonit/mynodeapp-cicd-project/-/settings/ci_cd )
2727 3 . Enter a description for the runner:\
2828 local-runner
2929 4 . Enter tags for the runner (comma-separated):\
You can’t perform that action at this time.
0 commit comments