Skip to content

Commit 76dba12

Browse files
committed
(//ci): Added workflow file
Signed-off-by: Anurag Dixit <[email protected]>
1 parent dd99bd4 commit 76dba12

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

.github/workflows/blossom-ci.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Copyright (c) 2022, 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( 'andi4191,narendasan,peri044,ncomly-nvidia,', 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+
- name: Run blossom action
60+
uses: NVIDIA/blossom-action@main
61+
env:
62+
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
REPO_KEY_DATA: ${{ secrets.BLOSSOM_KEY }}
64+
with:
65+
args1: ${{ fromJson(needs.Authorization.outputs.args).args1 }}
66+
args2: ${{ fromJson(needs.Authorization.outputs.args).args2 }}
67+
args3: ${{ fromJson(needs.Authorization.outputs.args).args3 }}
68+
69+
Job-trigger:
70+
name: Start ci job
71+
needs: [Vulnerability-scan]
72+
runs-on: blossom
73+
steps:
74+
- name: Start ci job
75+
run: blossom-ci
76+
env:
77+
OPERATION: 'START-CI-JOB'
78+
CI_SERVER: ${{ secrets.CI_SERVER }}
79+
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
81+
Upload-Log:
82+
name: Upload log
83+
runs-on: blossom
84+
if : github.event_name == 'workflow_dispatch'
85+
steps:
86+
- name: Jenkins log for pull request ${{ fromJson(github.event.inputs.args).pr }} (click here)
87+
run: blossom-ci
88+
env:
89+
OPERATION: 'POST-PROCESSING'
90+
CI_SERVER: ${{ secrets.CI_SERVER }}
91+
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)