-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathBuild-and-deploy-data-ingestion.yaml
More file actions
70 lines (65 loc) · 2.28 KB
/
Build-and-deploy-data-ingestion.yaml
File metadata and controls
70 lines (65 loc) · 2.28 KB
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
name: Build and push data-ingestion-service images to ECR
on:
push:
branches:
- main
- master
- rel-**
paths:
- "data-ingestion-service/**"
- "hl7-parser/**"
- "phdc-xsd-jaxb/**"
jobs:
sonar_scan:
permissions:
id-token: write
contents: read
uses: ./.github/workflows/sonar.yaml
secrets:
CDC_NBS_SANDBOX_SHARED_SERVICES_ACCOUNTID: ${{secrets.CDC_NBS_SANDBOX_SHARED_SERVICES_ACCOUNTID}}
PASSED_GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
DATABASE_USER: ${{secrets.DATABASE_USER}}
DATABASE_PASSWORD: ${{secrets.DATABASE_PASSWORD}}
PARAMETER_SECRET: ${{secrets.PARAMETER_SECRET}}
TOKEN_SECRET: ${{secrets.TOKEN_SECRET}}
extract-version-suffix:
needs: sonar_scan
name: Extract image tag from version
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.parse.outputs.image_tag }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Read version from build.gradle and extract suffix
id: parse
run: |
version_line=$(grep "^version" ./data-ingestion-service/build.gradle)
version=$(echo "$version_line" | sed -E "s/version *= *['\"]([^'\"]+)['\"]/\1/")
echo "Full version: $version"
# Default value
image_tag="SNAPSHOT"
# Match SNAPSHOT-123
if [[ "$version" =~ SNAPSHOT-([0-9]+) ]]; then
image_tag="SNAPSHOT-${BASH_REMATCH[1]}"
elif [[ "$version" =~ SNAPSHOT ]]; then
image_tag="SNAPSHOT"
fi
echo "image_tag=$image_tag" >> $GITHUB_OUTPUT
echo "Final image tag for build: $image_tag"
call-build-microservice-container-workflow:
permissions:
id-token: write
contents: read
security-events: write
name: Build Container
needs: extract-version-suffix
uses: CDCgov/NEDSS-Workflows/.github/workflows/Build-gradle-microservice-container.yaml@main
with:
microservice_name: nbs7-dataingestion-service
dockerfile_relative_path: -f ./data-ingestion-service/Dockerfile .
environment_classifier: ${{ needs.extract-version-suffix.outputs.image_tag }}
java_version: "21"
secrets:
NBS_ACCOUNTID: ${{secrets.NBS_ACCOUNTID}}