Skip to content

Commit f6d5dc9

Browse files
authored
CI/CD Pipeline Setup (#215)
* new ci/cd setup; repo cleanup & refactor * refactor * license added * merged main; changed depandabot check to weekly * added ecs task config file
1 parent 55bf484 commit f6d5dc9

File tree

14 files changed

+96
-389
lines changed

14 files changed

+96
-389
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ updates:
77
- package-ecosystem: "github-actions"
88
directory: "/"
99
schedule:
10-
interval: "daily"
10+
interval: "weekly"
1111

1212
- package-ecosystem: "gomod"
1313
directory: "/"
1414
schedule:
15-
interval: "daily"
15+
interval: "weekly"

.github/workflows/build_prod.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright 2020 ChainSafe Systems
2+
# SPDX-License-Identifier: LGPL-3.0-only
3+
4+
name: Build & Push Docker Image to AWS ECR
5+
6+
on:
7+
push:
8+
tags:
9+
- v*
10+
11+
env:
12+
AWS_REGION: ${{ secrets.AWS_REGION }}
13+
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }
14+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
15+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
16+
ECR_REPO: ${{ secrets.AWS_ECR_REPO }}
17+
18+
jobs:
19+
build:
20+
name: build_prod
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
# download the source code into the runner
25+
- name: checkout
26+
uses: actions/checkout@v2
27+
28+
- name: short sha
29+
id: vars
30+
run: echo "::set-output name=sha::$(git rev-parse --short HEAD)"
31+
32+
# gather metadata from git & github actions to reference in docker
33+
- name: git & github metadata
34+
id: metadata
35+
uses: docker/metadata-action@v3
36+
with:
37+
images: ${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.AWS_ECR_REPO }}
38+
39+
# login in docker repository
40+
- name: docker login
41+
uses: aws-actions/amazon-ecr-login@v1
42+
43+
# build a docker image
44+
- name: docker & push image
45+
uses: docker/build-push-action@v2
46+
with:
47+
context: .
48+
file: ./Dockerfile
49+
push: true
50+
tags: |
51+
${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.AWS_ECR_REPO }}:latest
52+
${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.AWS_ECR_REPO }}:${{ steps.vars.outputs.sha }}

.github/workflows/deploy-stage.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/deploy_prod.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright 2020 ChainSafe Systems
2+
# SPDX-License-Identifier: LGPL-3.0-only
3+
4+
name: Deploy ECS Prod
5+
6+
on:
7+
push:
8+
tags:
9+
- v*
10+
11+
env:
12+
AWS_REGION: ${{ secrets.AWS_REGION }}
13+
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }
14+
ECR_REPO: ${{ secrets.AWS_ECR_REPO }}
15+
ENVIRONMENT: PROD
16+
17+
jobs:
18+
deploy:
19+
name: Deploy
20+
runs-on: ubuntu-latest
21+
22+
permissions:
23+
contents: read
24+
id-token: write
25+
26+
steps:
27+
- uses: actions/checkout@v2
28+
- run: sleep 5
29+
- name: Configure AWS Credentials
30+
uses: aws-actions/configure-aws-credentials@v1
31+
with:
32+
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/github-actions-${{ env.ENVIRONMENT }}-nodewatch
33+
aws-region: ${{ env.AWS_REGION }}
34+
role-session-name: GithubActions
35+
36+
- name: Deploy to Amazon ECS
37+
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
38+
with:
39+
task-definition: ecs/task_definition_${{ env.ENVIRONMENT }}.json
40+
service: nodewatch-${{ env.ENVIRONMENT }}-service
41+
cluster: nodewatch-${{ env.ENVIRONMENT }}-cluster
42+
wait-for-service-stability: true

helm/crawler/.helmignore

Lines changed: 0 additions & 23 deletions
This file was deleted.

helm/crawler/Chart.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

helm/crawler/templates/_helpers.tpl

Lines changed: 0 additions & 65 deletions
This file was deleted.

helm/crawler/templates/deployment.yaml

Lines changed: 0 additions & 61 deletions
This file was deleted.

helm/crawler/templates/hpa.yaml

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)