-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (89 loc) · 2.93 KB
/
reconciler-workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# CI for NVIP
name: Reconciler Workflow
on:
pull_request:
branches:
- main
- dev
push:
branches:
- main
- dev
- 'cicd/**'
paths-ignore:
- 'productnameextractor/**'
- 'exploitfinder/**'
- 'patchfinder/**'
- 'crawler/**'
env:
AWS_REGION: 'us-east-1'
OUTPUT_DIR: 'output'
RESOURCE_DIR: 'nvip_data'
jobs:
# Build and Test Reconciler Component
build-test-reconciler:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
with:
lfs: 'true'
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Test and Build Reconciler with Maven
run: |
mvn test --projects=db,reconciler
- name: Publish Test Report
if: success() || failure()
uses: scacap/action-surefire-report@v1
with:
check_name: Reconciler Test Report
# Deploy reconciler component project to container registry
staging-deploy:
runs-on: ubuntu-latest
needs: build-test-reconciler
if: ${{ success() && github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image for Reconciler
run: |
docker build . -f reconciler/Dockerfile -t nvip-reconciler:staging -t ghcr.io/softwaredesignlab/nvip-reconciler:staging
docker push ghcr.io/softwaredesignlab/nvip-reconciler:staging
# Deploy reconciler component project to container registry
production-deploy:
runs-on: ubuntu-latest
environment: production
needs: staging-deploy
steps:
- uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image for Reconciler
run: |
docker build . -f reconciler/Dockerfile -t nvip-reconciler -t ghcr.io/softwaredesignlab/nvip-reconciler
docker push ghcr.io/softwaredesignlab/nvip-reconciler