Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitcoder authored Aug 22, 2024
1 parent a760972 commit 22f71c0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ app.get('/async-status', async (req, res) => {

app.post('/git-scan/', async (req, res) => {
let job_name = `scanjob${generateRandomString(5).toLowerCase()}`;
let job_id = generateRandomString(5).toLowerCase();
let product_name = req.body.product_name;
let branch = req.body.branch;
let engagement_name = req.body.engagement_name;
Expand All @@ -40,7 +41,7 @@ app.post('/git-scan/', async (req, res) => {
"--code-path=" + repository_link,
"--commit-id=" + commit_id,
"--branch=" + branch,
"--job-id=" + job_name,
"--job-id=" + job_id,
]
if (product_name) {
job_args.push("--product-name=" + product_name);
Expand Down Expand Up @@ -89,7 +90,7 @@ app.post('/git-scan/', async (req, res) => {
"containers": [
{
"name": "scanjob",
"image": "asia.gcr.io/mgmt-infra-applayer-01-0864/hela:0.2",
"image": "rohitcoder/hela",
"imagePullPolicy": "Always",
"args": job_args,
}
Expand All @@ -103,6 +104,7 @@ app.post('/git-scan/', async (req, res) => {
let resp = await sendJobToK8S(scanJob);
res.status(200).json({
message: `Scan job ${job_name} started successfully!`,
job_id: job_id
});
}
catch (err) {
Expand Down

0 comments on commit 22f71c0

Please sign in to comment.