Skip to content

add first_party_analysis boolean to all status reports #2111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
respond to review comments
  • Loading branch information
nickfyson committed Feb 21, 2024
commit ebda17e8597cc970bf2442f27c6f2a429d14826f
2 changes: 1 addition & 1 deletion lib/environment.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 18 additions & 25 deletions lib/status-report.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/status-report.test.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export enum EnvVar {
HAS_WARNED_ABOUT_DISK_SPACE = "CODEQL_ACTION_HAS_WARNED_ABOUT_DISK_SPACE",

/** Whether the init action has been run. */
INIT_ACTION_HAS_RUN = "CODEQL_INIT_ACTION_HAS_RUN",
INIT_ACTION_HAS_RUN = "CODEQL_ACTION_INIT_HAS_RUN",

/** UUID representing the current job run. */
JOB_RUN_UUID = "JOB_RUN_UUID",
Expand Down
56 changes: 24 additions & 32 deletions src/status-report.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,26 @@ import { withTmpDir } from "./util";

setupTests(test);

function setupEnvironmentAndStub(tmpDir: string) {
setupActionsVars(tmpDir, tmpDir);

process.env["CODEQL_ACTION_ANALYSIS_KEY"] = "analysis-key";
process.env["GITHUB_REF"] = "refs/heads/main";
process.env["GITHUB_REPOSITORY"] = "octocat/HelloWorld";
process.env["GITHUB_RUN_ATTEMPT"] = "2";
process.env["GITHUB_RUN_ID"] = "100";
process.env["GITHUB_SHA"] = "a".repeat(40);
process.env["ImageVersion"] = "2023.05.19.1";
process.env["RUNNER_OS"] = "macOS";
process.env["RUNNER_TEMP"] = tmpDir;

const getRequiredInput = sinon.stub(actionsUtil, "getRequiredInput");
getRequiredInput.withArgs("matrix").resolves("input/matrix");
}

test("createStatusReportBase", async (t) => {
await withTmpDir(async (tmpDir: string) => {
setupActionsVars(tmpDir, tmpDir);

process.env["CODEQL_ACTION_ANALYSIS_KEY"] = "analysis-key";
process.env["GITHUB_REF"] = "refs/heads/main";
process.env["GITHUB_REPOSITORY"] = "octocat/HelloWorld";
process.env["GITHUB_RUN_ATTEMPT"] = "2";
process.env["GITHUB_RUN_ID"] = "100";
process.env["GITHUB_SHA"] = "a".repeat(40);
process.env["ImageVersion"] = "2023.05.19.1";
process.env["RUNNER_OS"] = "macOS";

const getRequiredInput = sinon.stub(actionsUtil, "getRequiredInput");
getRequiredInput.withArgs("matrix").resolves("input/matrix");
setupEnvironmentAndStub(tmpDir);

const statusReport = await createStatusReportBase(
"init",
Expand All @@ -43,14 +48,14 @@ test("createStatusReportBase", async (t) => {
);
t.is(statusReport.analysis_key, "analysis-key");
t.is(statusReport.cause, "failure cause");
t.is(statusReport.commit_oid, process.env["GITHUB_SHA"]);
t.is(statusReport.commit_oid, process.env["GITHUB_SHA"]!);
t.is(statusReport.exception, "exception stack trace");
t.is(statusReport.job_name, process.env["GITHUB_JOB"] || "");
t.is(typeof statusReport.job_run_uuid, "string");
t.is(statusReport.ref, process.env["GITHUB_REF"]);
t.is(statusReport.ref, process.env["GITHUB_REF"]!);
t.is(statusReport.runner_available_disk_space_bytes, 100);
t.is(statusReport.runner_image_version, process.env["ImageVersion"]);
t.is(statusReport.runner_os, process.env["RUNNER_OS"]);
t.is(statusReport.runner_os, process.env["RUNNER_OS"]!);
t.is(statusReport.started_at, process.env[EnvVar.WORKFLOW_STARTED_AT]!);
t.is(statusReport.status, "failure");
t.is(statusReport.workflow_name, process.env["GITHUB_WORKFLOW"] || "");
Expand All @@ -61,20 +66,7 @@ test("createStatusReportBase", async (t) => {

test("createStatusReportBase_firstParty", async (t) => {
await withTmpDir(async (tmpDir: string) => {
setupActionsVars(tmpDir, tmpDir);

process.env["CODEQL_ACTION_ANALYSIS_KEY"] = "analysis-key";
process.env["GITHUB_REF"] = "refs/heads/main";
process.env["GITHUB_REPOSITORY"] = "octocat/HelloWorld";
process.env["GITHUB_RUN_ATTEMPT"] = "2";
process.env["GITHUB_RUN_ID"] = "100";
process.env["GITHUB_SHA"] = "a".repeat(40);
process.env["ImageVersion"] = "2023.05.19.1";
process.env["RUNNER_OS"] = "macOS";
process.env["RUNNER_TEMP"] = tmpDir;

const getRequiredInput = sinon.stub(actionsUtil, "getRequiredInput");
getRequiredInput.withArgs("matrix").resolves("input/matrix");
setupEnvironmentAndStub(tmpDir);

t.is(
(
Expand Down Expand Up @@ -104,7 +96,7 @@ test("createStatusReportBase_firstParty", async (t) => {
true,
);

process.env["CODEQL_INIT_ACTION_HAS_RUN"] = "foobar";
process.env["CODEQL_ACTION_INIT_HAS_RUN"] = "foobar";
t.is(
(
await createStatusReportBase(
Expand Down Expand Up @@ -133,7 +125,7 @@ test("createStatusReportBase_firstParty", async (t) => {
true,
);

process.env["CODEQL_INIT_ACTION_HAS_RUN"] = "true";
process.env["CODEQL_ACTION_INIT_HAS_RUN"] = "true";
t.is(
(
await createStatusReportBase(
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy