Skip to content

Commit a167852

Browse files
committed
Create blossom-ci.yml
Signed-off-by: Samurdhi Karunaratne <skarunaratne@nvidia.com>
1 parent 1c0e3fd commit a167852

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

.github/workflows/blossom-ci.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Copyright (c) 2020-2021, NVIDIA CORPORATION.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# A workflow to trigger ci on hybrid infra (github + self hosted runner)
16+
name: Blossom-CI
17+
on:
18+
issue_comment:
19+
types: [created]
20+
workflow_dispatch:
21+
inputs:
22+
platform:
23+
description: 'runs-on argument'
24+
required: false
25+
args:
26+
description: 'argument'
27+
required: false
28+
jobs:
29+
Authorization:
30+
name: Authorization
31+
runs-on: blossom
32+
outputs:
33+
args: ${{ env.args }}
34+
35+
# This job only runs for pull request comments
36+
if: |
37+
contains( 'rajeevsrao,kevinch-nv,ttyio,samurdhikaru,zerollzeng,nvpohanh', format('{0},', github.actor)) &&
38+
github.event.comment.body == '/blossom-ci'
39+
steps:
40+
- name: Check if comment is issued by authorized person
41+
run: blossom-ci
42+
env:
43+
OPERATION: 'AUTH'
44+
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
REPO_KEY_DATA: ${{ secrets.BLOSSOM_KEY }}
46+
47+
Vulnerability-scan:
48+
name: Vulnerability scan
49+
needs: [Authorization]
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Checkout code
53+
uses: actions/checkout@v2
54+
with:
55+
repository: ${{ fromJson(needs.Authorization.outputs.args).repo }}
56+
ref: ${{ fromJson(needs.Authorization.outputs.args).ref }}
57+
lfs: 'true'
58+
59+
# repo specific steps
60+
#- name: Setup java
61+
# uses: actions/setup-java@v1
62+
# with:
63+
# java-version: 1.8
64+
65+
# add blackduck properties https://synopsys.atlassian.net/wiki/spaces/INTDOCS/pages/631308372/Methods+for+Configuring+Analysis#Using-a-configuration-file
66+
#- name: Setup blackduck properties
67+
# run: |
68+
# PROJECTS=$(mvn -am dependency:tree | grep maven-dependency-plugin | awk '{ out="com.nvidia:"$(NF-1);print out }' | grep rapids | xargs | sed -e 's/ /,/g')
69+
# echo detect.maven.build.command="-pl=$PROJECTS -am" >> application.properties
70+
# echo detect.maven.included.scopes=compile >> application.properties
71+
72+
- name: Run blossom action
73+
uses: NVIDIA/blossom-action@main
74+
env:
75+
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
REPO_KEY_DATA: ${{ secrets.BLOSSOM_KEY }}
77+
with:
78+
args1: ${{ fromJson(needs.Authorization.outputs.args).args1 }}
79+
args2: ${{ fromJson(needs.Authorization.outputs.args).args2 }}
80+
args3: ${{ fromJson(needs.Authorization.outputs.args).args3 }}
81+
82+
Job-trigger:
83+
name: Start ci job
84+
needs: [Vulnerability-scan]
85+
runs-on: blossom
86+
steps:
87+
- name: Start ci job
88+
run: blossom-ci
89+
env:
90+
OPERATION: 'START-CI-JOB'
91+
CI_SERVER: ${{ secrets.CI_SERVER }}
92+
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93+
94+
Upload-Log:
95+
name: Upload log
96+
runs-on: blossom
97+
if : github.event_name == 'workflow_dispatch'
98+
steps:
99+
- name: Jenkins log for pull request ${{ fromJson(github.event.inputs.args).pr }} (click here)
100+
run: blossom-ci
101+
env:
102+
OPERATION: 'POST-PROCESSING'
103+
CI_SERVER: ${{ secrets.CI_SERVER }}
104+
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)