-
Notifications
You must be signed in to change notification settings - Fork 6
chore: Add in debug logs for all upload params #179
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
Changes from 7 commits
c46e06e
2ca76b2
d648709
9a73e3e
42079f4
0a49d45
366bfa9
425ca53
0a7a12b
2a774c3
b9a3621
282c5d8
e363b90
60a113f
c972fdd
8de35cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| "@codecov/bundler-plugin-core": minor | ||
| "@codecov/bundle-analyzer": minor | ||
| "@codecov/nextjs-webpack-plugin": minor | ||
| "@codecov/nuxt-plugin": minor | ||
| "@codecov/remix-vite-plugin": minor | ||
| "@codecov/rollup-plugin": minor | ||
| "@codecov/solidstart-plugin": minor | ||
| "@codecov/sveltekit-plugin": minor | ||
| "@codecov/vite-plugin": minor | ||
| "@codecov/webpack-plugin": minor | ||
| --- | ||
|
|
||
| Add in debug logs for each param for each provider for better debugging. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,56 +13,87 @@ export function detect(envs: ProviderEnvs): boolean { | |
| ); | ||
| } | ||
|
|
||
| function _getBuild(inputs: ProviderUtilInputs): ProviderServiceParams["build"] { | ||
| function _getBuild( | ||
| inputs: ProviderUtilInputs, | ||
| output: Output, | ||
| ): ProviderServiceParams["build"] { | ||
| const { args, envs } = inputs; | ||
| if (args?.build && args.build !== "") { | ||
| debug(`Using build: ${args.build}`, { enabled: output.debug }); | ||
| return args.build; | ||
| } | ||
| return envs?.APPVEYOR_JOB_ID ?? null; | ||
|
|
||
| const build = envs?.APPVEYOR_BUILD_ID ?? null; | ||
| debug(`Using build: ${build}`, { enabled: output.debug }); | ||
|
|
||
| return build; | ||
| } | ||
|
|
||
| function _getBuildURL( | ||
| inputs: ProviderUtilInputs, | ||
| output: Output, | ||
| ): ProviderServiceParams["buildURL"] { | ||
| const { envs } = inputs; | ||
| let buildUrl: string | null = null; | ||
|
|
||
| if ( | ||
| envs?.APPVEYOR_URL && | ||
| envs?.APPVEYOR_REPO_NAME && | ||
| envs?.APPVEYOR_BUILD_ID && | ||
| envs?.APPVEYOR_JOB_ID | ||
| ) { | ||
| return `${envs?.APPVEYOR_URL}/project/${envs?.APPVEYOR_REPO_NAME}/builds/${envs?.APPVEYOR_BUILD_ID}/job/${envs?.APPVEYOR_JOB_ID}`; | ||
| buildUrl = `${envs?.APPVEYOR_URL}/project/${envs?.APPVEYOR_REPO_NAME}/builds/${envs?.APPVEYOR_BUILD_ID}/job/${envs?.APPVEYOR_JOB_ID}`; | ||
| } | ||
| return null; | ||
|
|
||
| debug(`Using build URL: ${buildUrl}`, { enabled: output.debug }); | ||
| return buildUrl; | ||
| } | ||
|
|
||
| function _getBranch( | ||
| inputs: ProviderUtilInputs, | ||
| output: Output, | ||
| ): ProviderServiceParams["branch"] { | ||
| const { args, envs } = inputs; | ||
| if (args?.branch && args.branch !== "") { | ||
| debug(`Using branch: ${args.branch}`, { enabled: output.debug }); | ||
| return args.branch; | ||
| } | ||
| return envs?.APPVEYOR_REPO_BRANCH ?? null; | ||
| const branch = envs?.APPVEYOR_REPO_BRANCH ?? null; | ||
| debug(`Using branch: ${branch}`, { enabled: output.debug }); | ||
| return branch; | ||
| } | ||
|
|
||
| function _getJob(envs: ProviderEnvs): ProviderServiceParams["job"] { | ||
| function _getJob( | ||
| envs: ProviderEnvs, | ||
| output: Output, | ||
| ): ProviderServiceParams["job"] { | ||
| let job: string | null = null; | ||
|
|
||
| if ( | ||
| envs?.APPVEYOR_ACCOUNT_NAME && | ||
| envs?.APPVEYOR_PROJECT_SLUG && | ||
| envs?.APPVEYOR_BUILD_VERSION | ||
| ) { | ||
| return `${envs?.APPVEYOR_ACCOUNT_NAME}/${envs?.APPVEYOR_PROJECT_SLUG}/${envs?.APPVEYOR_BUILD_VERSION}`; | ||
| job = `${envs.APPVEYOR_ACCOUNT_NAME}/${envs.APPVEYOR_PROJECT_SLUG}/${envs.APPVEYOR_BUILD_VERSION}`; | ||
| } | ||
| return null; | ||
|
|
||
| debug(`Using job: ${job}`, { enabled: output.debug }); | ||
| return job; | ||
| } | ||
|
|
||
| function _getPR(inputs: ProviderUtilInputs): ProviderServiceParams["pr"] { | ||
| function _getPR( | ||
| inputs: ProviderUtilInputs, | ||
| output: Output, | ||
| ): ProviderServiceParams["pr"] { | ||
| const { args, envs } = inputs; | ||
| if (args?.pr && args.pr !== "") { | ||
| debug(`Using PR number: ${args.pr}`, { enabled: output.debug }); | ||
| return args.pr; | ||
| } | ||
| return envs?.APPVEYOR_PULL_REQUEST_NUMBER ?? null; | ||
|
|
||
| const pr = envs?.APPVEYOR_PULL_REQUEST_NUMBER ?? null; | ||
| debug(`Using PR number: ${pr}`, { enabled: output.debug }); | ||
| return pr; | ||
| } | ||
|
|
||
| function _getService(): ProviderServiceParams["service"] { | ||
|
|
@@ -86,19 +117,24 @@ function _getSHA( | |
| const commitSha = | ||
| envs?.APPVEYOR_PULL_REQUEST_HEAD_COMMIT ?? envs?.APPVEYOR_REPO_COMMIT; | ||
|
|
||
| debug(`Using commit: ${commitSha ?? ""}`, { | ||
| enabled: output.debug, | ||
| }); | ||
| debug(`Using commit: ${commitSha}`, { enabled: output.debug }); | ||
|
|
||
| return commitSha ?? null; | ||
| } | ||
|
|
||
| function _getSlug(inputs: ProviderUtilInputs): ProviderServiceParams["slug"] { | ||
| function _getSlug( | ||
| inputs: ProviderUtilInputs, | ||
| output: Output, | ||
| ): ProviderServiceParams["slug"] { | ||
| const { args, envs } = inputs; | ||
| if (args?.slug && args.slug !== "") { | ||
| debug(`Using slug: ${args.slug}`, { enabled: output.debug }); | ||
| return args.slug; | ||
| } | ||
| return envs?.APPVEYOR_REPO_NAME ?? null; | ||
|
|
||
| const slug = envs?.APPVEYOR_REPO_NAME ?? null; | ||
| debug(`Using slug: ${slug}`, { enabled: output.debug }); | ||
| return slug; | ||
| } | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/require-await | ||
|
|
@@ -107,14 +143,14 @@ export async function getServiceParams( | |
| output: Output, | ||
| ): Promise<ProviderServiceParams> { | ||
| return { | ||
| branch: _getBranch(inputs), | ||
| build: _getBuild(inputs), | ||
| buildURL: _getBuildURL(inputs), | ||
| branch: _getBranch(inputs, output), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I personally found the arg name Fine to leave as is since the pattern is already well-established across the rest of the code, just a passing musing |
||
| build: _getBuild(inputs, output), | ||
| buildURL: _getBuildURL(inputs, output), | ||
| commit: _getSHA(inputs, output), | ||
| job: _getJob(inputs.envs), | ||
| pr: _getPR(inputs), | ||
| job: _getJob(inputs.envs, output), | ||
| pr: _getPR(inputs, output), | ||
| service: _getService(), | ||
| slug: _getSlug(inputs), | ||
| slug: _getSlug(inputs, output), | ||
| }; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not needed right now but devs that are debugging may find it helpful in the future if we log the source as well (as in from
argsorenv).