-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4484 from cloud-gov/chore-admin-qol
chore(admin): add extra information for testing scans
- Loading branch information
Showing
8 changed files
with
106 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<script> | ||
import { fetchTasks } from '../lib/api'; | ||
import { PaginatedQueryPage, TaskTable } from '../components'; | ||
const fields = {}; | ||
</script> | ||
|
||
<PaginatedQueryPage path="tasks" query={fetchTasks} {fields} let:data> | ||
<TaskTable tasks={data} /> | ||
<TaskTable tasks={data} showSite={true} /> | ||
</PaginatedQueryPage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* eslint-disable no-console */ | ||
const { Build, BuildTask, SiteBuildTask } = require('../api/models'); | ||
|
||
const logHelper = '[run-scans-for-build]'; | ||
|
||
async function main() { | ||
try { | ||
const args = Array.prototype.slice.call(process.argv, 2); | ||
|
||
if (args.length !== 1) { | ||
throw ` | ||
Please make sure you provide 1 arguments. (buildId).\n | ||
You provided the following: ${args} | ||
`; | ||
} | ||
|
||
const [buildId] = args; | ||
|
||
const build = await Build.findByPk(buildId); | ||
let tasks = []; | ||
try { | ||
// try to create build tasks, this will fail if they already | ||
// exist and throw a uniqueness violation | ||
tasks = await SiteBuildTask.createBuildTasks({ build }); | ||
console.log(`${logHelper} Created ${tasks.length} new scan(s)`); | ||
} catch { | ||
// if there are existing build tasks, find these | ||
tasks = await BuildTask.findAll({ where: { buildId: build.id } }); | ||
console.log(`${logHelper} Found ${tasks.length} existing scan(s)`); | ||
} | ||
|
||
await Promise.all(tasks.map(async task => task.enqueue())); | ||
|
||
console.log(`${logHelper} Successfully queued ${tasks.length} scan(s)`); | ||
|
||
process.exit(0); | ||
} catch (error) { | ||
console.error(error); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
main(); |