|
6 | 6 | GitMeta, |
7 | 7 | DeploymentFinalizedEvent, |
8 | 8 | DeploymentEventFromString, |
| 9 | + DeploymentTriggeredVia, |
9 | 10 | } from "@trigger.dev/core/v3/schemas"; |
10 | 11 | import { Command, Option as CommandOption } from "commander"; |
11 | 12 | import { join, relative, resolve } from "node:path"; |
@@ -48,7 +49,7 @@ import { |
48 | 49 | import { loadDotEnvVars } from "../utilities/dotEnv.js"; |
49 | 50 | import { isDirectory } from "../utilities/fileSystem.js"; |
50 | 51 | import { setGithubActionsOutputAndEnvVars } from "../utilities/githubActions.js"; |
51 | | -import { createGitMeta } from "../utilities/gitMeta.js"; |
| 52 | +import { createGitMeta, isGitHubActions } from "../utilities/gitMeta.js"; |
52 | 53 | import { printStandloneInitialBanner } from "../utilities/initialBanner.js"; |
53 | 54 | import { resolveLocalEnvVars } from "../utilities/localEnvVars.js"; |
54 | 55 | import { logger } from "../utilities/logger.js"; |
@@ -382,6 +383,7 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) { |
382 | 383 | type: features.run_engine_v2 ? "MANAGED" : "V1", |
383 | 384 | runtime: buildManifest.runtime, |
384 | 385 | isNativeBuild: false, |
| 386 | + triggeredVia: getTriggeredVia(), |
385 | 387 | }, |
386 | 388 | envVars.TRIGGER_EXISTING_DEPLOYMENT_ID |
387 | 389 | ); |
@@ -893,6 +895,40 @@ async function initializeOrAttachDeployment( |
893 | 895 | return newDeploymentOrError.data; |
894 | 896 | } |
895 | 897 |
|
| 898 | +function getTriggeredVia(): DeploymentTriggeredVia { |
| 899 | + // Check specific CI providers first (most specific to least specific) |
| 900 | + if (isGitHubActions()) { |
| 901 | + return "cli:github_actions"; |
| 902 | + } |
| 903 | + if (process.env.GITLAB_CI === "true") { |
| 904 | + return "cli:gitlab_ci"; |
| 905 | + } |
| 906 | + if (process.env.CIRCLECI === "true") { |
| 907 | + return "cli:circleci"; |
| 908 | + } |
| 909 | + if (process.env.JENKINS_URL) { |
| 910 | + return "cli:jenkins"; |
| 911 | + } |
| 912 | + if (process.env.TF_BUILD === "True") { |
| 913 | + return "cli:azure_pipelines"; |
| 914 | + } |
| 915 | + if (process.env.BITBUCKET_BUILD_NUMBER) { |
| 916 | + return "cli:bitbucket_pipelines"; |
| 917 | + } |
| 918 | + if (process.env.TRAVIS === "true") { |
| 919 | + return "cli:travis_ci"; |
| 920 | + } |
| 921 | + if (process.env.BUILDKITE === "true") { |
| 922 | + return "cli:buildkite"; |
| 923 | + } |
| 924 | + // Fallback for other/unknown CI environments |
| 925 | + if (isCI) { |
| 926 | + return "cli:ci_other"; |
| 927 | + } |
| 928 | + |
| 929 | + return "cli:manual"; |
| 930 | +} |
| 931 | + |
896 | 932 | async function handleNativeBuildServerDeploy({ |
897 | 933 | apiClient, |
898 | 934 | options, |
@@ -998,6 +1034,7 @@ async function handleNativeBuildServerDeploy({ |
998 | 1034 | artifactKey, |
999 | 1035 | skipPromotion: options.skipPromotion, |
1000 | 1036 | configFilePath, |
| 1037 | + triggeredVia: getTriggeredVia(), |
1001 | 1038 | }); |
1002 | 1039 |
|
1003 | 1040 | if (!initializeDeploymentResult.success) { |
|
0 commit comments