-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (118 loc) · 3.78 KB
/
car-demo-pipeline.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: GCP Pipeline
on:
push:
branches: [ main ]
env:
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
jobs:
sonarcloud:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '19'
# - name: Cache SonarCloud packages
# uses: actions/cache@v2
# with:
# path: |
# ~/.sonar/cache
# ~/.sonar/cache-*
# key: ${{ runner.os }}-sonar
# restore-keys: |
# ${{ runner.os }}-sonar
# # - name: Run SonarCloud for Each Repository
# # run: |
# # cat projects-changes-deploy.txt | while read repo; do
# # echo "Processing repository: $repo"
# # cd $repo
# # mvn clean install sonar:sonar
# # cd ..
# # done
# # sonarcloud1:
# # runs-on: ubuntu-latest
# # steps:
# # - name: Checkout Repository
# # uses: actions/checkout@v2
# # - name: List Directory Contents
# # run: ls -R
# # - name: Set up JDK
# # uses: actions/setup-java@v2
# # with:
# # distribution: 'adopt'
# # java-version: '19'
# # - name: Cache SonarCloud packages
# # uses: actions/cache@v2
# # with:
# # path: |
# # ~/.sonar/cache
# # ~/.sonar/cache-*
# # key: ${{ runner.os }}-sonar
# # restore-keys: |
# # ${{ runner.os }}-sonar
# - name: Build and Analyze with SonarCloud
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# run: |
# cd car-demo/shipment-service # Adjust the path accordingly
# mvn -X clean install sonar:sonar
#sonarcloud:
# name: SonarCloud
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Set up JDK 19
# uses: actions/setup-java@v3
# with:
# java-version: '19'
# distribution: 'temurin'
# cache: maven
# - name: SonarCloud Scan
#working-directory: ./shipment-service
#run: mvn clean verify sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=nashtech
#run: mvn clean verify sonar:sonar -X
# run: |
# cd car-demo/shipment-service # Adjust the path accordingly
# mvn clean install sonar:sonar
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
setup-build-publish-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up JDK 19
uses: actions/setup-java@v3
with:
java-version: '19'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }}
- uses: 'google-github-actions/auth@v1'
with:
credentials_json: ${{ secrets.GKE_KEY }}
- uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ env.GKE_PROJECT }}
# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- name: configure docker
run: |-
gcloud --quiet auth configure-docker
# - name: Configure Maven settings
# run: |
# mkdir -p $HOME/.m2
# echo "${{ secrets.MAVEN_SETTINGS_XML }}" > $HOME/.m2/settings.xml
# - name: Build, Publish, and Deploy
# run: |
# . apps-deployment-script.sh "us-east1"
# env:
# GITHUB_USERNAME: ${{ secrets.CUSTOM_GITHUB_USERNAME }}
# #GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}