Skip to content

Commit 98f8367

Browse files
authored
PLATFORM-859 feat: allow to specify runner for scan_code_net (#63)
1 parent 339697e commit 98f8367

File tree

3 files changed

+42
-28
lines changed

3 files changed

+42
-28
lines changed

.gflows/libs/job_scan_code.lib.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
#@ def generate_scan_code_job(section):
33
name: #@ section["name"]
4-
runs-on: ubuntu-latest
4+
runs-on: #@ getattr(section,"runner","ubuntu-latest")
55
timeout-minutes: 10
66
steps:
77
- uses: actions/checkout@v3

.gflows/workflow-configuration/build-publish/settings.yml

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,34 @@
44
---
55

66
generic_job_example:
7-
name: Auth #name for the UI
8-
slug: auth-service #used for job dependencies references
9-
7+
name: Auth #name for the UI
8+
slug: auth-service #used for job dependencies references
9+
1010
# optional, name of the Dockerfile to build. If presented, job will build image
1111
dockerfile: Dockerfile
12-
# optional, name of default image to export, as a result of build.
12+
# optional, name of default image to export, as a result of build.
1313
# Could be omitted if docker_export is presented
1414
# if dockerfile is missing, this field is considered as a dependency, all jobs will be searched for a one exporting this image name
1515
# image will be loaded into local docker to use for running or just use as a cache
1616
image_name: covergo/auth
1717
#optional. Array of parameters to pass to docker image during run.
18-
image_run_args:
18+
image_run_args:
1919
- "arg1"
2020
- "arg 2"
21-
21+
2222
#optional, docker cache configuration. Can be a map or an array
2323
cache_from:
24-
25-
#Map view:
24+
25+
#Map view:
2626
#optional, type of docker cache to use. Possible values: "gha" and "registry"
27-
#gha will use GitHub Cache API via docker gha cache exporter. Experimental, fast, and limited to 5GB per repo
27+
#gha will use GitHub Cache API via docker gha cache exporter. Experimental, fast, and limited to 5GB per repo
2828
#registry will create a special "cache" images containing all layers and used only for caching, branch-specific, and store it in ghcr.io
2929
type: registry #[gha,registry]
3030
# optional, dependencies on external docker images, produced by other jobs,
3131
# used as an additional cache during build process.
3232
# Can be used only for "registry" cache type
3333
from_images:
34-
# non-empty list containing names of the images. Should match "image_name" field of some sections in the same configuration file
34+
# non-empty list containing names of the images. Should match "image_name" field of some sections in the same configuration file
3535
# order matters, as cache will be used in the same order as declaration
3636
# cache order should reflect the dependencies from Dockerfile targets
3737
# base targets should come first
@@ -42,14 +42,14 @@ generic_job_example:
4242
# - covergo/auth
4343

4444
#optional, if presented means this job will run docker image as stand-alone or inside compose
45-
#represents the path to get some artifacts from the image (compose service) as a result of the run
46-
#artifacts will be treated based on other factor, e.g. it could be test results in some format, nuget package, or smth else
47-
#requires image_name to locate the target image
45+
#represents the path to get some artifacts from the image (compose service) as a result of the run
46+
#artifacts will be treated based on other factor, e.g. it could be test results in some format, nuget package, or smth else
47+
#requires image_name to locate the target image
4848
container_result_path: app/TestResults
4949

5050

5151
# option section for running compose
52-
# if presented, means job will run compose instead of docker
52+
# if presented, means job will run compose instead of docker
5353
compose_file: docker-compose.yml
5454
#service name in compose file to treat as SUT
5555
#results will be taken from this image, based on 'container_result_path' setting
@@ -61,7 +61,7 @@ generic_job_example:
6161
## end of compose section
6262

6363
#Deprecated in favor of services
64-
#service:
64+
#service:
6565

6666
#Should Only build and export docker images
6767
services:
@@ -72,7 +72,7 @@ services:
7272
image_name: covergo/auth
7373
generate_docker_meta: true
7474
output_docker_digest: true
75-
build_args:
75+
build_args:
7676
- NOW="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
7777
- name: Auth Predeployment
7878
slug: auth-predeployment
@@ -84,8 +84,8 @@ services:
8484
cache_from:
8585
- covergo/auth
8686

87-
#Runs an existing image, can build if needed
88-
unit_test: #docker-build-and-job
87+
#Runs an existing image, can build if needed
88+
unit_test: #docker-build-and-job
8989
- name: Unit tests
9090
slug: auth-test-unit
9191
container_result_path: app/TestResults
@@ -100,10 +100,10 @@ unit_test: #docker-build-and-job
100100
- covergo/auth
101101
upload_path: |
102102
bce
103-
!fge
103+
!fge
104104
!hep/**/.tmp
105105
#Runs existing images in compose, can build if needed
106-
integration_test: #array of docker-build-and-job
106+
integration_test: #array of docker-build-and-job
107107
- name: Integration tests
108108
slug: integration-tests
109109
container_result_path: app/TestResults
@@ -134,7 +134,7 @@ integration_test: #array of docker-build-and-job
134134
- covergo/auth
135135
- covergo/auth-test-unit
136136
- covergo/cases-api-test-integration
137-
137+
138138
- name: Integration API tests
139139
slug: api-test-integration
140140
runner: ubuntu-latest
@@ -152,14 +152,14 @@ integration_test: #array of docker-build-and-job
152152

153153

154154
#Only build and export docker images
155-
additional_images: #array of docker-build-and-job
155+
additional_images: #array of docker-build-and-job
156156
- name: Mongo db for Auth
157157
slug: auth-mongo
158158
dockerfile: Mongo.Dockerfile
159159
image_name: covergo/auth-mongo
160160

161161

162-
#Runs an exising image or build it, extract nuget package and publishes it
162+
#Runs an exising image or build it, extract nuget package and publishes it
163163
nuget: #docker-build-and-job with special treatment of artifact
164164
- name: Auth client nuget
165165
slug: auth-nuget
@@ -256,6 +256,7 @@ scan_code_net:
256256
name: Sonar Code
257257
slug: scan_code_net
258258
#optional
259+
runner: ubuntu-latest-4-cores
259260
cache_from:
260261
- covergo/auth
261262
- covergo/auth-test-unit
@@ -282,7 +283,7 @@ deploy_tenants:
282283
url: CoverGo/Documentation
283284
branch: master
284285
token: ${{ secrets.CR_PAT_FULL }}
285-
286+
286287
# Legacy way
287288
service: covergo-auth
288289
image: registry-intl.cn-hongkong.aliyuncs.com/covergo/auth:${{ needs.version.outputs.app_version }}

github-sample/workflows/build-publish.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
scan-code-net:
4747
name: Sonar scan
4848
timeout-minutes: 20
49-
runs-on: ubuntu-latest
49+
runs-on: ubuntu-latest-4-cores
5050
needs:
5151
- version
5252
- docker-build-auth-service
@@ -56,14 +56,19 @@ jobs:
5656
uses: actions/checkout@v3
5757
with:
5858
fetch-depth: 0
59+
- name: Set up Java 17
60+
uses: actions/setup-java@v3
61+
with:
62+
java-version: 17
63+
distribution: adopt
5964
- name: Add GitHub Packages to NuGet config
6065
env:
6166
GH_ACCOUNT: ${{ secrets.PAT_USER_READ_PACKAGES }}
6267
GH_TOKEN: ${{ secrets.PAT_READ_PACKAGES }}
6368
run: |
6469
dotnet nuget update source github --username ${GH_ACCOUNT} --password ${GH_TOKEN} --store-password-in-clear-text
6570
- name: Scan
66-
uses: NazmiAltun/dotnet-parallel-sonar-scan@v1.1.3
71+
uses: CoverGo/dotnet-parallel-sonar-scan@v1.0.1
6772
with:
6873
test-result-artifacts: Unit tests results,Integration tests results,Acceptance tests results,Integration API tests results
6974
sonar-token: ${{ secrets.SONAR_TOKEN }}
@@ -84,6 +89,11 @@ jobs:
8489
- uses: actions/checkout@v3
8590
with:
8691
fetch-depth: 0
92+
- name: Set up Java 17
93+
uses: actions/setup-java@v3
94+
with:
95+
java-version: 17
96+
distribution: adopt
8797
- name: downcase GITHUB_REPOSITORY_OWNER
8898
run: |
8999
echo "GITHUB_REPOSITORY_OWNER_DOWNCASE=${GITHUB_REPOSITORY_OWNER,,}" >>${GITHUB_ENV}
@@ -451,7 +461,10 @@ jobs:
451461
uses: actions/upload-artifact@v2
452462
with:
453463
name: Unit tests results
454-
path: "bce\n!fge \n!hep/**/.tmp\n"
464+
path: |
465+
bce
466+
!fge
467+
!hep/**/.tmp
455468
- name: Publish Unit tests results as check
456469
uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:latest
457470
if: always()

0 commit comments

Comments
 (0)